/* Modern design system for Studdyco */

:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: #eef2ff;
  --secondary: #64748b;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --dark: #1e293b;
  --light: #f8fafc;
  --surface: #ffffff;
  --surface-muted: #fafafa;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 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);
  --radius: 0.75rem;
  --radius-sm: 0.5rem;
  --call-stage-bg: #111827;
  --focus-ring: rgb(99 102 241 / 0.25);
  --hero-grad-start: var(--primary-light);
  --hero-grad-mid: var(--surface);
  --hero-grad-end: #faf5ff;
  --tone-blue-bg: #eff6ff;
  --tone-blue-fg: #1d4ed8;
  --tone-amber-bg: #fef3c7;
  --tone-amber-fg: #b45309;
  --tone-green-bg: #f0fdf4;
  --tone-green-fg: #166534;
  --tone-pink-bg: #fce7f3;
  --tone-pink-fg: #be185d;
  --tone-cyan-bg: #ecfeff;
  --tone-cyan-fg: #0891b2;
  --tone-violet-bg: #f5f3ff;
  --tone-violet-fg: #7c3aed;
  --chip-bg: var(--surface-muted);
  --chip-fg: var(--dark);
  --star-empty: #e2e8f0;
}

html[data-bs-theme="dark"] {
  --dark: #e5e7eb;
  --light: #0b1220;
  --surface: #0f172a;
  --surface-muted: #111827;
  --border: #233044;
  --secondary: #9aa7ba;
  --primary-light: rgb(99 102 241 / 0.18);
  --focus-ring: rgb(99 102 241 / 0.35);
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.35);
  --shadow: 0 6px 12px -6px rgb(0 0 0 / 0.55);
  --shadow-lg: 0 18px 30px -18px rgb(0 0 0 / 0.7);
  --hero-grad-start: rgb(99 102 241 / 0.18);
  --hero-grad-mid: var(--surface);
  --hero-grad-end: rgb(139 92 246 / 0.10);
  --tone-blue-bg: rgb(37 99 235 / 0.12);
  --tone-blue-fg: #bfdbfe;
  --tone-amber-bg: rgb(245 158 11 / 0.14);
  --tone-amber-fg: #fde68a;
  --tone-green-bg: rgb(16 185 129 / 0.12);
  --tone-green-fg: #bbf7d0;
  --tone-pink-bg: rgb(236 72 153 / 0.12);
  --tone-pink-fg: #fbcfe8;
  --tone-cyan-bg: rgb(6 182 212 / 0.12);
  --tone-cyan-fg: #a5f3fc;
  --tone-violet-bg: rgb(139 92 246 / 0.14);
  --tone-violet-fg: #ddd6fe;
  --chip-bg: var(--surface-muted);
  --chip-fg: var(--dark);
  --star-empty: #475569;
}

/* Typography */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--light);
  color: var(--dark);
  line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--dark);
}

/* Navbar */
.navbar {
  background: var(--surface) !important;
  box-shadow: var(--shadow-sm);
  padding: 0.75rem 0;
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--dark);
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
}
.navbar-brand-wordmark {
  height: 44px;
  width: auto;
  object-fit: contain;
  display: block;
}

.nav-create-btn {
  width: 34px;
  height: 34px;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  padding: 0 !important;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary) !important;
  font-size: 1.1rem;
  transition: all 0.2s ease;
}
.nav-create-btn::after {
  display: none;
}
.nav-create-btn:hover {
  background: var(--primary);
  color: white !important;
}
.buddybucks-icon {
  object-fit: cover;
  vertical-align: middle;
  border-radius: 50%;
}

.nav-link {
  font-weight: 500;
  color: var(--secondary) !important;
  padding: 0.5rem 1rem !important;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.nav-link:hover {
  color: var(--primary) !important;
  background: var(--primary-light);
}

/* Buttons */
.btn {
  font-weight: 500;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  border: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-hover), #7c3aed);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.btn-outline-primary {
  color: var(--primary);
  border: 2px solid var(--primary);
  background: transparent;
}

.btn-outline-primary:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.btn-outline-secondary {
  color: var(--secondary);
  border: 2px solid var(--border);
  background: transparent;
}

.btn-outline-secondary:hover {
  background: var(--light);
  border-color: var(--secondary);
  color: var(--dark);
}

.btn-outline-danger {
  color: var(--danger);
  border: 2px solid var(--danger);
}

.btn-outline-danger:hover {
  background: var(--danger);
  color: white;
}

/* Cards */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  background: var(--surface);
}

.card:hover {
  box-shadow: var(--shadow);
}

.event-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: all 0.25s ease;
}

.event-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.event-card .card-title a {
  color: var(--dark);
  font-weight: 600;
}

.event-card .card-title a:hover {
  color: var(--primary);
}

.card-body {
  padding: 1.25rem;
}

.card-footer {
  padding: 1rem 1.25rem;
  background: var(--surface-muted);
  border-top: 1px solid var(--border);
}

/* Hero section */
.hero {
  background: linear-gradient(
    135deg,
    var(--hero-grad-start) 0%,
    var(--hero-grad-mid) 50%,
    var(--hero-grad-end) 100%
  );
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  margin-bottom: 2rem;
}

.hero h1 {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}

.hero p {
  color: var(--secondary);
  font-size: 1.1rem;
}

/* Forms */
.form-control, .form-select {
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 1rem;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  background-color: var(--surface);
  color: var(--dark);
}

.form-select {
  cursor: pointer;
  padding-right: 2.5rem;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
::placeholder {
  color: color-mix(in srgb, var(--secondary) 85%, transparent);
}

.form-label {
  font-weight: 500;
  color: var(--dark);
  margin-bottom: 0.4rem;
}

.form-text {
  color: var(--secondary);
  font-size: 0.85rem;
}

.form-check-input:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}

textarea.form-control {
  min-height: 100px;
}

/* Dark theme tweaks for Bootstrap utilities we use in templates */
html[data-bs-theme="dark"] .bg-white,
html[data-bs-theme="dark"] .bg-light {
  background-color: var(--surface) !important;
}
html[data-bs-theme="dark"] .text-dark {
  color: var(--dark) !important;
}
html[data-bs-theme="dark"] .text-muted {
  color: var(--secondary) !important;
}
html[data-bs-theme="dark"] .dropdown-menu {
  background-color: var(--surface);
  border-color: var(--border);
}
html[data-bs-theme="dark"] .dropdown-item {
  color: var(--dark);
}
html[data-bs-theme="dark"] .dropdown-item:hover,
html[data-bs-theme="dark"] .dropdown-item:focus {
  background-color: var(--surface-muted);
  color: var(--dark);
}
html[data-bs-theme="dark"] .alert-light {
  background-color: var(--surface-muted);
  border-color: var(--border);
  color: var(--dark);
}
html[data-bs-theme="dark"] .input-group-text {
  background-color: var(--surface-muted) !important;
  border-color: var(--border) !important;
  color: var(--secondary) !important;
}
html[data-bs-theme="dark"] .card-footer.bg-white {
  background-color: var(--surface-muted) !important;
}

html[data-bs-theme="dark"] .list-group {
  background-color: var(--surface);
  border-color: var(--border);
}
html[data-bs-theme="dark"] .list-group-item {
  background-color: var(--surface);
  border-color: var(--border);
  color: var(--dark);
}
html[data-bs-theme="dark"] .list-group-item:hover,
html[data-bs-theme="dark"] .list-group-item:focus {
  background-color: var(--surface-muted);
}

/* Badges */
.badge {
  font-weight: 500;
  padding: 0.4em 0.8em;
  border-radius: var(--radius-sm);
}
html[data-bs-theme="dark"] .badge.bg-light,
html[data-bs-theme="dark"] .badge.bg-white {
  background-color: var(--chip-bg) !important;
  color: var(--chip-fg) !important;
}
html[data-bs-theme="dark"] .badge.border {
  border-color: var(--border) !important;
}

.text-bg-light {
  background: var(--light) !important;
  color: var(--dark) !important;
}

.units-badge {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #92400e;
  font-weight: 600;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid #fcd34d;
}

/* Alerts */
.alert {
  border-radius: var(--radius-sm);
  border: none;
  padding: 1rem 1.25rem;
}

.alert-info {
  background: var(--primary-light);
  color: var(--primary-hover);
}
html[data-bs-theme="dark"] .alert-info {
  background: rgb(99 102 241 / 0.18);
  color: #c7d2fe;
}

.alert-light {
  background: white;
  border: 1px solid var(--border);
}

/* Event details */
.event-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--secondary);
  font-size: 0.9rem;
}

.event-meta svg {
  width: 1rem;
  height: 1rem;
  opacity: 0.7;
}

/* Profile */
.profile-avatar {
  border: 3px solid var(--primary-light);
  box-shadow: var(--shadow);
}

/* Brand assets */
html[data-bs-theme="dark"] .navbar-brand-wordmark,
html[data-bs-theme="dark"] .studdyco-wordmark {
  filter: invert(1) hue-rotate(180deg) brightness(1.15) contrast(1.05);
}

.stat-card {
  text-align: center;
  padding: 1.5rem;
}

.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-card .stat-label {
  color: var(--secondary);
  font-size: 0.9rem;
}

/* Pagination */
.pagination .page-link {
  border: 2px solid var(--border);
  color: var(--secondary);
  padding: 0.5rem 1rem;
  margin: 0 0.25rem;
  border-radius: var(--radius-sm);
}

.pagination .page-link:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.pagination .page-item.disabled .page-link {
  background: var(--light);
  color: #cbd5e1;
}

/* Utility classes */
.text-muted {
  color: var(--secondary) !important;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 1.5rem 0;
}

/* Animation */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.3s ease;
}

/* Time dropdowns: keep arrow beside value, no wrap */
.event-time-select {
  width: 4.5rem;
  min-width: 4.5rem;
  display: inline-block;
}

.drag-handle {
  cursor: grab;
  user-select: none;
}
.drag-handle:active {
  cursor: grabbing;
}

.card-description-content p:last-child {
  margin-bottom: 0;
}
.card-description-content ul,
.card-description-content ol {
  padding-left: 1.25rem;
  margin-bottom: 0.5rem;
}
.card-description-content li {
  margin-bottom: 0.25rem;
}

.task-question-content,
.task-explanation-content {
  display: inline;
}
.task-question-content p,
.task-explanation-content p {
  margin-bottom: 0.25rem;
}
.task-question-content p:last-child,
.task-explanation-content p:last-child {
  margin-bottom: 0;
}
.task-question-content code,
.task-explanation-content code {
  font-size: 0.9em;
  background: var(--light);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  border: 1px solid var(--border);
}
.task-question-content pre,
.task-explanation-content pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  background: var(--light);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  overflow-x: auto;
  margin: 0.25rem 0;
}
.task-question-content pre code,
.task-explanation-content pre code {
  background: none;
  padding: 0;
  border: none;
}

/* Code tasks (programming cards: Python, Java, etc.) */
.code-task,
.code-task-inline {
  font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.9rem;
  background: var(--light);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  margin: 0;
  overflow-x: auto;
  white-space: pre;
}
.code-task code,
.code-task-inline code {
  background: none;
  padding: 0;
  font-size: inherit;
}
.code-task-inline {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  font-size: 0.85rem;
}

.task-answer-block .CodeMirror {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 8rem;
  font-size: 0.9rem;
}

/* Preparation card picker */
.prep-cards-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1050;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  max-height: 220px;
  overflow-y: auto;
}
.prep-cards-option {
  cursor: pointer;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
}
.prep-cards-option:last-child {
  border-bottom: none;
}
.prep-cards-option:hover {
  background: var(--primary-light);
}
.prep-card-pill {
  font-size: 0.85rem;
  padding: 0.3rem 0.6rem;
}

/* Topic suggestion dropdown */
.topic-suggest-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1050;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  max-height: 200px;
  overflow-y: auto;
}
.topic-suggest-option {
  cursor: pointer;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
}
.topic-suggest-option:last-child {
  border-bottom: none;
}
.topic-suggest-option:hover {
  background: var(--primary-light);
}

/* Course module card search */
.module-card-search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1050;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  max-height: 220px;
  overflow-y: auto;
}
.module-card-search-option {
  cursor: pointer;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
}
.module-card-search-option:last-child {
  border-bottom: none;
}
.module-card-search-option:hover {
  background: var(--primary-light);
}

/* Course module drag-and-drop */
.module-item-drag-handle {
  cursor: grab;
  color: var(--secondary);
  font-size: 0.9rem;
}
.module-item-drag-handle:hover {
  color: var(--primary);
}
.module-item-dragging {
  opacity: 0.5;
  border: 1px dashed var(--primary) !important;
}

/* AI suggestion styles */
.ai-suggestion-item {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  margin-bottom: 0.5rem;
}
.ai-suggestion-item:hover {
  background: var(--primary-light);
}

/* Landing page */
.landing-hero {
  background: linear-gradient(
    135deg,
    var(--hero-grad-start) 0%,
    var(--hero-grad-mid) 40%,
    var(--hero-grad-end) 100%
  );
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3.5rem 3rem;
  margin-bottom: 3rem;
}

.landing-hero-title {
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1rem;
}

.landing-hero-subtitle {
  font-size: 1.15rem;
  color: var(--secondary);
  line-height: 1.7;
  max-width: 520px;
}

.landing-hero-visual {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
}

.landing-hero-icon {
  width: 80px;
  height: 80px;
  border-radius: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  color: var(--primary);
}

.landing-hero-icon:nth-child(1) {
  color: #0891b2;
}
.landing-hero-icon:nth-child(2) {
  color: #8b5cf6;
  transform: translateY(-12px);
}
.landing-hero-icon:nth-child(3) {
  transform: translateY(-12px);
}
.landing-hero-icon:nth-child(4) {
  color: #16a34a;
}

.landing-pillars {
  margin-bottom: 3rem;
}

.landing-pillar-card {
  border: 1px solid var(--border);
  transition: all 0.25s ease;
}
.landing-pillar-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}

.landing-pillar-icon {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.landing-pillar-card h4 {
  font-size: 1.1rem;
  margin-bottom: 0.4rem;
}

.landing-pillar-card p {
  color: var(--secondary);
  font-size: 0.9rem;
  margin-bottom: 0;
  line-height: 1.6;
}

.landing-economy {
  margin-bottom: 3rem;
}

.landing-economy .card {
  background: linear-gradient(
    135deg,
    var(--tone-amber-bg) 0%,
    var(--hero-grad-mid) 60%,
    var(--surface) 100%
  );
  border: 1px solid color-mix(in srgb, var(--tone-amber-fg) 28%, var(--border));
}

.landing-bb-stat {
  padding: 1rem 0.5rem;
}

.landing-bb-value {
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1.2;
}

.landing-bb-label {
  font-size: 0.85rem;
  color: var(--secondary);
  margin-top: 0.25rem;
}

.landing-preview {
  margin-bottom: 3rem;
}

.landing-cta {
  background: linear-gradient(
    135deg,
    var(--hero-grad-start) 0%,
    var(--surface) 100%
  );
  border-radius: var(--radius);
  padding: 3rem 2rem;
  margin-bottom: 1rem;
}

.landing-cta h2 {
  font-size: 1.6rem;
  margin-bottom: 0.5rem;
}

/* Responsive */
@media (max-width: 768px) {
  .hero {
    padding: 1.5rem;
  }
  
  .hero h1 {
    font-size: 1.4rem;
  }

  .landing-hero {
    padding: 2rem 1.5rem;
  }

  .landing-hero-title {
    font-size: 1.7rem;
  }

  .landing-bb-value {
    font-size: 1.3rem;
  }
}
