/* Phase 3: Advanced Features Styles */

/* Theme Variables */
:root {
  --primary-color: #205081;
  --secondary-color: #667eea;
  --accent-color: #4fd1c7;
  --text-color: #333;
  --bg-color: #ffffff;
  --card-bg: #f8f9fa;
  --border-color: #e9ecef;
  --shadow: 0 2px 10px rgba(0,0,0,0.1);
}

[data-theme="dark"] {
  --primary-color: #4fd1c7;
  --secondary-color: #667eea;
  --accent-color: #f093fb;
  --text-color: #e2e8f0;
  --bg-color: #1a202c;
  --card-bg: #2d3748;
  --border-color: #4a5568;
  --shadow: 0 2px 10px rgba(0,0,0,0.3);
}

/* Theme Toggle Button */
.theme-toggle {
  position: fixed;
  top: 20px;
  left: 20px;
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 10px 15px;
  border-radius: 25px;
  cursor: pointer;
  font-size: 0.9em;
  font-weight: 600;
  z-index: 1000;
  transition: all 0.3s ease;
  box-shadow: var(--shadow);
}

.theme-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

/* Search Button */
.search-btn {
  position: fixed;
  top: 20px;
  left: 180px;
  background: var(--secondary-color);
  color: white;
  border: none;
  padding: 10px 15px;
  border-radius: 25px;
  cursor: pointer;
  font-size: 0.9em;
  font-weight: 600;
  z-index: 1000;
  transition: all 0.3s ease;
  box-shadow: var(--shadow);
}

.search-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  background: var(--accent-color);
}

/* Search Modal */
.search-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 2000;
  backdrop-filter: blur(5px);
}

.search-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-color);
  border-radius: 15px;
  padding: 25px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

.search-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.search-header h3 {
  color: var(--text-color);
  margin: 0;
}

.close-search {
  background: none;
  border: none;
  font-size: 1.5em;
  cursor: pointer;
  color: var(--text-color);
}

.search-input-container {
  position: relative;
  margin-bottom: 20px;
}

.search-input {
  width: 100%;
  padding: 12px 45px 12px 15px;
  border: 2px solid var(--border-color);
  border-radius: 25px;
  font-size: 1em;
  background: var(--card-bg);
  color: var(--text-color);
  outline: none;
  transition: all 0.3s ease;
}

.search-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(32, 80, 129, 0.1);
}

.search-icon {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-color);
  opacity: 0.6;
}

.search-results {
  max-height: 400px;
  overflow-y: auto;
}

.search-result {
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 10px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.3s ease;
}

.search-result:hover {
  background: var(--primary-color);
  color: white;
  transform: translateX(-3px);
}

.result-title {
  font-weight: 600;
  margin-bottom: 5px;
}

.result-module {
  font-size: 0.9em;
  opacity: 0.8;
  margin-bottom: 3px;
}

.result-score {
  font-size: 0.8em;
  opacity: 0.6;
}

.no-results {
  text-align: center;
  padding: 40px;
  color: var(--text-color);
  opacity: 0.6;
  font-style: italic;
}

/* Search Button */
.search-btn {
  position: fixed;
  top: 20px;
  left: 200px;
  background: var(--secondary-color);
  color: white;
  border: none;
  padding: 10px 15px;
  border-radius: 25px;
  cursor: pointer;
  font-size: 0.9em;
  font-weight: 600;
  z-index: 1000;
  transition: all 0.3s ease;
  box-shadow: var(--shadow);
}

.search-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

/* Recommendations Section */
.recommendations-section {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 20px;
  margin: 20px 0;
  border: 1px solid var(--border-color);
}

.recommendations-section h3 {
  color: var(--text-color);
  margin-bottom: 15px;
  text-align: center;
}

.recommendations-list {
  display: grid;
  gap: 15px;
}

.recommendation-item {
  background: var(--bg-color);
  border-radius: 8px;
  padding: 15px;
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

.recommendation-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.recommendation-item.priority-high {
  border-left: 4px solid #e53e3e;
}

.recommendation-item.priority-medium {
  border-left: 4px solid #ed8936;
}

.rec-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.rec-type {
  font-weight: 600;
  color: var(--primary-color);
}

.rec-lesson {
  font-size: 1.1em;
  font-weight: 600;
  color: var(--text-color);
  cursor: pointer;
  margin-bottom: 5px;
  transition: color 0.3s ease;
}

.rec-lesson:hover {
  color: var(--secondary-color);
}

.rec-reason {
  font-size: 0.9em;
  color: var(--text-color);
  opacity: 0.7;
}

/* Analytics Dashboard */
.analytics-dashboard {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 20px;
  margin: 20px 0;
  border: 1px solid var(--border-color);
}

.analytics-dashboard h3 {
  color: var(--text-color);
  margin-bottom: 20px;
  text-align: center;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.analytics-card {
  background: var(--bg-color);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

.analytics-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.card-value {
  font-size: 2em;
  font-weight: bold;
  color: var(--primary-color);
  margin-bottom: 5px;
}

.card-label {
  font-size: 0.9em;
  color: var(--text-color);
  opacity: 0.8;
}

.most-viewed {
  background: var(--bg-color);
  border-radius: 8px;
  padding: 15px;
  border: 1px solid var(--border-color);
}

.most-viewed h4 {
  color: var(--text-color);
  margin-bottom: 15px;
  text-align: center;
}

.viewed-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-color);
}

.viewed-item:last-child {
  border-bottom: none;
}

.view-count {
  background: var(--primary-color);
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.8em;
}

/* Theme Transition */
* {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Responsive Design */
@media (max-width: 768px) {
  .theme-toggle,
  .search-btn {
    position: relative;
    top: auto;
    left: auto;
    margin: 5px;
    display: inline-block;
  }
  
  .search-container {
    width: 95%;
    padding: 15px;
  }
  
  .analytics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .recommendations-list {
    gap: 10px;
  }
  
  .rec-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }
}

/* Dark theme specific adjustments */
[data-theme="dark"] .search-modal {
  background: rgba(0,0,0,0.8);
}

[data-theme="dark"] .search-result:hover {
  background: var(--secondary-color);
}

[data-theme="dark"] .analytics-card:hover,
[data-theme="dark"] .recommendation-item:hover {
  box-shadow: 0 4px 15px rgba(255,255,255,0.1);
}
