/* Import Google Fonts */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Poppins:wght@400;500;600;700&display=swap");

/* CSS Variables for consistent theming */
:root {
  --primary-color: #4f46e5;
  --primary-dark: #3730a3;
  --primary-light: #6366f1;
  --secondary-color: #059669;
  --danger-color: #dc2626;
  --warning-color: #f59e0b;
  --success-color: #10b981;
  --neutral-50: #f9fafb;
  --neutral-100: #f3f4f6;
  --neutral-200: #e5e7eb;
  --neutral-300: #d1d5db;
  --neutral-400: #9ca3af;
  --neutral-500: #6b7280;
  --neutral-600: #4b5563;
  --neutral-700: #374151;
  --neutral-800: #1f2937;
  --neutral-900: #111827;
  --white: #ffffff;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1),
    0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1),
    0 8px 10px -6px rgb(0 0 0 / 0.1);
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
}

/* Global Styles */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui,
    sans-serif;
  background: linear-gradient(135deg, var(--neutral-50) 0%, #f8fafc 100%);
  color: var(--neutral-700);
  line-height: 1.6;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Modern Header */
.header {
  height: 70px;
  background: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--primary-dark) 100%
  );
  color: var(--white);
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-lg);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  z-index: -1;
}

.header h1 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  font-family: "Poppins", sans-serif;
  letter-spacing: -0.025em;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header nav {
  display: flex;
  gap: 8px;
}

.header nav a {
  color: var(--white);
  text-decoration: none;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius-lg);
  transition: all 0.2s ease;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.header nav a:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Container Layout */
.container {
  display: flex;
  min-height: calc(100vh - 140px);
  gap: 0;
}

/* Modern Sidebar */
.sidebar {
  width: 320px;
  background: var(--white);
  border-right: 1px solid var(--neutral-200);
  padding: 24px 16px;
  overflow-y: auto;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.sidebar::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: linear-gradient(
    to bottom,
    var(--primary-color),
    var(--primary-light)
  );
}

/* Scrollbar Styling */
.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: var(--neutral-100);
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--neutral-300);
  border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--neutral-400);
}

/* Modern Accordion */
.accordion {
  margin-bottom: 12px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all 0.3s ease;
  border: 1px solid var(--neutral-200);
  background: var(--white);
}

.accordion:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary-color);
}

.accordion button {
  width: 100%;
  text-align: left;
  padding: 16px 20px;
  background: var(--white);
  border: none;
  font-weight: 600;
  color: var(--neutral-700);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px; /*original 15px*/
  position: relative;
}

.accordion button::after {
  content: "+";
  font-size: 18px;
  font-weight: 300;
  color: var(--primary-color);
  transition: transform 0.2s ease;
}

.accordion button:hover {
  background: var(--neutral-50);
  color: var(--primary-color);
}

.accordion button.active::after {
  transform: rotate(45deg);
}

.accordion-content {
  padding: 8px 16px 16px;
  display: none;
  background: var(--neutral-50);
  border-top: 1px solid var(--neutral-200);
}

/* Modern Session Cards */
/*.session-card {
  background: var(--white);
  border: 1px solid var(--neutral-200);
  padding: 16px;
  margin: 8px 0;
  border-radius: var(--radius-lg);
  transition: all 0.2s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}*/

.session-card {
  background: var(--white);
  border: 1px solid var(--neutral-200);
  padding: 8px 12px; /* Reduced from 16px */
  margin: 6px 0; /* Slightly tighter spacing */
  border-radius: var(--radius-md); /* Optional: smaller radius */
  transition: all 0.2s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  padding-bottom: 8px; /* reduced bottom padding*/
}

.session-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--primary-color);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.session-card:hover {
  box-shadow: var(--shadow-lg);
  background: var(--white);
  border-color: var(--primary-color);
  transform: translateY(-2px);
}

.session-card:hover::before {
  opacity: 1;
}

.session-card:active {
  transform: translateY(0);
}

/* Session Card Content */
.session-card > div:first-child {
  font-weight: 600;
  color: var(--neutral-800);
  margin-bottom: 8px;
  font-size: 14px;
}

.session-card.selected {
  background-color: #e0f7fa; /* Light cyan or any highlight color */
  border-color: #00acc1; /* Optional: accent border */
}

.session-card > div:last-child {
  color: var(--neutral-600);
  font-size: 13px;
  font-weight: 500;
}

/* Modern Progress Bar */
.progress-bar {
  height: 8px;
  background: var(--neutral-200);
  border-radius: var(--radius-sm);
  margin: 8px 0;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-sm);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.progress-fill::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* Main Panel */
.main-panel {
  flex: 1;
  padding: 32px;
  background: var(--white);
  margin: 16px;
  margin-left: 0;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.main-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(
    90deg,
    var(--primary-color),
    var(--primary-light),
    var(--secondary-color)
  );
}

.main-panel h2 {
  color: var(--neutral-800);
  font-size: 1.5rem; /*changed from 2rem*/
  font-weight: 700;
  margin-bottom: 8px;
  font-family: "Poppins", sans-serif;
}

.main-panel p {
  color: var(--neutral-600);
  font-size: 16px;
  margin-bottom: 24px;
}

/* MCQ Styles */
#mcq-container .session-card {
  margin-bottom: 24px;
  padding: 24px;
  border: 1px solid var(--neutral-200);
}

.mcq-meta {
  background: var(--neutral-50);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--neutral-600);
  border-left: 4px solid var(--primary-color);
}

#mcq-container strong {
  color: var(--neutral-800);
  font-weight: 800;
}

#mcq-container ul {
  list-style: none;
  padding: 0;
  margin: 16px 0;
}

#mcq-container li {
  margin: 12px 0;
  padding: 12px 16px;
  background: var(--neutral-50);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  border: 1px solid var(--neutral-200);
}

#mcq-container li:hover {
  background: var(--primary-color);
  color: var(--white);
  transform: translateX(4px);
}

#mcq-container label {
  cursor: pointer;
  display: flex;
  align-items: center;
  width: 100%;
  font-weight: 500;
}

#mcq-container input[type="radio"] {
  margin-right: 12px;
  transform: scale(1.2);
  accent-color: var(--primary-color);
}

/* Modern Button */
button {
  background: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--primary-light) 100%
  );
  color: var(--white);
  border: none;
  padding: 12px 24px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

button::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  transition: left 0.5s;
}

button:hover::before {
  left: 100%;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-xl);
}

button:active {
  transform: translateY(0);
}

/* Modern Footer */
.footer {
  background: var(--neutral-800);
  color: var(--neutral-300);
  text-align: center;
  padding: 24px;
  margin-top: 16px;
  border-top: 1px solid var(--neutral-200);
  font-size: 14px;
}

/* Results Styling */
.session-card[style*="border-left: 4px solid #4caf50"] {
  background: linear-gradient(135deg, #f0fff4 0%, #f0f9f4 100%);
  border-color: var(--success-color) !important;
}

.session-card[style*="border-left: 4px solid #f44336"] {
  background: linear-gradient(135deg, #fef2f2 0%, #fef1f1 100%);
  border-color: var(--danger-color) !important;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .sidebar {
    width: 280px;
  }

  .main-panel {
    margin: 8px;
    margin-left: 0;
    padding: 24px;
  }
}

@media (max-width: 768px) {
  .container {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    max-height: 300px;
  }

  .header h1 {
    font-size: 1.5rem;
  }

  .header nav {
    gap: 4px;
  }

  .header nav a {
    padding: 6px 12px;
    font-size: 13px;
  }

  .main-panel {
    margin: 8px;
    padding: 16px;
  }
}

/* Loading Animation */
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.loading {
  animation: pulse 2s infinite;
}

/* Utility Classes */
.text-center {
  text-align: center;
}
.text-primary {
  color: var(--primary-color);
}
.text-success {
  color: var(--success-color);
}
.text-danger {
  color: var(--danger-color);
}
.text-warning {
  color: var(--warning-color);
}
.bg-primary {
  background-color: var(--primary-color);
}
.bg-success {
  background-color: var(--success-color);
}
.bg-danger {
  background-color: var(--danger-color);
}
.bg-warning {
  background-color: var(--warning-color);
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus states for accessibility */
button:focus-visible,
.session-card:focus-visible,
.accordion button:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Disable text selection (optional) */
/*
body {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}
*/
.score-card {
  padding: 1rem;
  border-radius: 8px;
  background-color: #f9f9f9;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.score-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.score-inline {
  display: flex;
  gap: 1rem;
  align-items: center;
  font-size: 1.1rem;
}

.score-display {
  font-weight: bold;
}

.performance-text.excellent {
  color: #2e8b57;
  font-weight: bold;
}

.performance-text.good {
  color: #1e90ff;
}

.performance-text.needs-improvement {
  color: #ff6347;
}

.percentage {
  margin-top: 0.5rem;
  font-size: 1.2rem;
  font-weight: bold;
}

/* new addition for reducing side bard item buttons*/
.sidebar-item {
  padding: 4px 8px;
  font-size: 0.85rem;
  line-height: 1.2;
  margin-bottom: 2px;
  border-radius: 4px;
  cursor: pointer;
  background-color: #fff;
  border: 1px solid #ccc;
}

.sidebar-item:hover {
  background-color: #f0f0f0;
}
/*chapter review buttons*/
.chapter-review-btn {
  background-color: #0077cc;
  color: #fff;
  border: none;
  padding: 8px 16px;
  font-size: 14px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  margin-top: 12px;
}

.chapter-review-btn:hover {
  background-color: #005fa3;
}

/* Welcome page styles */

.welcome-page {
  .welcome-section {
    text-align: center;
    padding: 2rem;
  }

  .quick-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
  }

  .stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
  }

  .stat-card h3 {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    opacity: 0.9;
  }

  .stat-number {
    font-size: 2rem;
    font-weight: bold;
  }

  .features {
    margin-top: 3rem;
  }

  .features h3 {
    color: #1f2937;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
  }

  .feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
  }

  .feature-item {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    text-align: left;
    border-left: 4px solid #3b82f6;
  }

  .feature-item h4 {
    color: #1f2937;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
  }

  .feature-item p {
    color: #6b7280;
    font-size: 0.9rem;
    line-height: 1.5;
  }

  @media (max-width: 768px) {
    .quick-stats {
      grid-template-columns: 1fr;
    }

    .feature-grid {
      grid-template-columns: 1fr;
    }
  }
}

/* Sidebar logged-out styles */
.sidebar-logged-out {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  padding: 16px;

  button {
    width: 100%;
    margin: 0;
    padding: 12px;
    font-size: 16px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
  }

  .trial-btn {
    background: #0077cc;
    color: #fff;
  }
  .trial-btn:hover {
    background: #005fa3;
  }
  .signup-btn {
    background: #00aa88;
    color: #fff;
  }
  .signup-btn:hover {
    background: #008f73;
  }
  .signin-btn {
    background: #444;
    color: #fff;
  }
  .signin-btn:hover {
    background: #222;
  }
}
