:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --secondary: #1e293b;
  --success: #16a34a;
  --success-light: #dcfce7;
  --warning: #f59e0b;
  --danger: #dc2626;
  --light-bg: #f8fafc;
  --dark-bg: #0f172a;
  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
  --card-shadow-hover: 0 10px 25px rgba(0, 0, 0, 0.1), 0 4px 10px rgba(0, 0, 0, 0.06);
  --transition: all 0.3s ease;
}

[data-bs-theme="dark"] {
  --light-bg: #0f172a;
  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  --card-shadow-hover: 0 10px 25px rgba(0, 0, 0, 0.4), 0 4px 10px rgba(0, 0, 0, 0.3);
}

body {
  background-color: var(--light-bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Navbar */
.navbar {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark)) !important;
  padding: 0.75rem 0;
}

.navbar .nav-link {
  font-weight: 500;
  padding: 0.5rem 1rem !important;
  border-radius: 0.375rem;
  transition: var(--transition);
}

.navbar .nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
}

.navbar .nav-link.btn {
  padding: 0.5rem 1rem !important;
}

.navbar-brand {
  font-size: 1.4rem;
  letter-spacing: -0.5px;
}

/* Hero */
.hero-section {
  background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 50%, var(--primary-dark) 100%);
  padding: 5rem 0;
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.hero-section h1 {
  font-size: 3.5rem;
  font-weight: 800;
  letter-spacing: -1.5px;
}

.hero-section .lead {
  font-size: 1.25rem;
  opacity: 0.9;
}

@media (max-width: 768px) {
  .hero-section {
    padding: 3rem 0;
  }
  .hero-section h1 {
    font-size: 2.25rem;
  }
  .hero-section .lead {
    font-size: 1.1rem;
  }
}

/* Cards */
.card {
  border: none;
  border-radius: 0.75rem;
  box-shadow: var(--card-shadow);
  transition: var(--transition);
  overflow: hidden;
}

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

.card-header {
  font-weight: 600;
  background: transparent;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  padding: 1rem 1.25rem;
}

.card-body {
  padding: 1.5rem;
}

/* Stat Cards */
.stat-card {
  text-align: center;
  padding: 2rem 1rem;
  background: white;
}

.stat-card .stat-icon {
  font-size: 2.5rem;
  color: var(--primary);
  margin-bottom: 1rem;
}

.stat-card .stat-number {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--secondary);
  line-height: 1.2;
}

.stat-card .stat-label {
  color: #64748b;
  font-weight: 500;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

[data-bs-theme="dark"] .stat-card {
  background: var(--dark-bg);
}

[data-bs-theme="dark"] .stat-card .stat-number {
  color: #f1f5f9;
}

/* Feature Cards */
.feature-card {
  padding: 2rem 1.5rem;
  text-align: center;
  height: 100%;
  background: white;
}

.feature-card .feature-icon {
  width: 64px;
  height: 64px;
  background: var(--primary-light);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
  font-size: 1.75rem;
  color: var(--primary);
}

.feature-card h5 {
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.feature-card p {
  color: #64748b;
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

[data-bs-theme="dark"] .feature-card {
  background: var(--dark-bg);
}

/* Calculator Cards */
.calculator-card {
  text-align: center;
  padding: 1.75rem 1rem;
  height: 100%;
  cursor: pointer;
  background: white;
}

.calculator-card .calc-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  font-size: 1.5rem;
  color: white;
  background: var(--primary);
}

.calculator-card h6 {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.calculator-card .badge {
  font-weight: 500;
}

[data-bs-theme="dark"] .calculator-card {
  background: var(--dark-bg);
}

/* Plan Cards */
.plan-card {
  height: 100%;
  background: white;
}

.plan-card .card-body {
  display: flex;
  flex-direction: column;
}

.plan-card .plan-duration {
  font-size: 0.85rem;
  color: #64748b;
}

[data-bs-theme="dark"] .plan-card {
  background: var(--dark-bg);
}

/* Badge Cards */
.badge-card {
  text-align: center;
  padding: 1.5rem;
  height: 100%;
  background: white;
}

.badge-card .badge-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
  transition: var(--transition);
}

.badge-card.locked {
  opacity: 0.5;
  filter: grayscale(1);
}

.badge-card.unlocked {
  background: var(--primary-light);
}

.badge-card.unlocked .badge-icon {
  color: var(--primary);
}

[data-bs-theme="dark"] .badge-card {
  background: var(--dark-bg);
}

[data-bs-theme="dark"] .badge-card.unlocked {
  background: rgba(37, 99, 235, 0.15);
}

/* Buttons */
.btn-primary {
  background-color: var(--primary);
  border-color: var(--primary);
  font-weight: 600;
}

.btn-primary:hover {
  background-color: var(--primary-dark);
  border-color: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-success {
  font-weight: 600;
}

.btn-success:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}

.btn-outline-light:hover {
  transform: translateY(-1px);
}

/* Progress */
.progress {
  height: 0.75rem;
  border-radius: 1rem;
  background: #e2e8f0;
}

.progress-bar {
  border-radius: 1rem;
  background: linear-gradient(90deg, var(--primary), #7c3aed);
}

/* Article Cards */
.article-card {
  height: 100%;
  background: white;
}

.article-card .card-footer {
  background: transparent;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

[data-bs-theme="dark"] .article-card {
  background: var(--dark-bg);
}

/* Form Styling */
.form-control, .form-select {
  border-radius: 0.5rem;
  padding: 0.625rem 1rem;
  border: 1.5px solid #e2e8f0;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Dashboard */
.dashboard-sidebar {
  background: white;
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: var(--card-shadow);
}

[data-bs-theme="dark"] .dashboard-sidebar {
  background: var(--dark-bg);
}

/* Section Titles */
.section-title {
  font-weight: 800;
  color: var(--secondary);
  margin-bottom: 0.5rem;
}

.section-subtitle {
  color: #64748b;
  margin-bottom: 2rem;
}

[data-bs-theme="dark"] .section-title {
  color: #f1f5f9;
}

/* Timeline */
.week-schedule {
  border-left: 3px solid var(--primary);
  padding-left: 1rem;
}

.week-day {
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.week-day:last-child {
  border-bottom: none;
}

.week-day .day-label {
  font-weight: 600;
  color: var(--primary);
  min-width: 100px;
}

/* Auth Pages */
.auth-section {
  min-height: calc(100vh - 200px);
  display: flex;
  align-items: center;
}

.auth-card {
  max-width: 460px;
  width: 100%;
  margin: 2rem auto;
  background: white;
}

[data-bs-theme="dark"] .auth-card {
  background: var(--dark-bg);
}

/* Page Header */
.page-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  padding: 3rem 0;
  color: white;
}

.page-header h1 {
  font-weight: 800;
}

.page-header .breadcrumb {
  background: transparent;
  padding: 0;
  margin-bottom: 0.5rem;
}

.page-header .breadcrumb-item,
.page-header .breadcrumb-item a {
  color: rgba(255, 255, 255, 0.8);
}

.page-header .breadcrumb-item.active {
  color: white;
}

.page-header .breadcrumb-item + .breadcrumb-item::before {
  color: rgba(255, 255, 255, 0.5);
}

/* Section Backgrounds */
.section-light {
  background: white;
  padding: 4rem 0;
}

[data-bs-theme="dark"] .section-light {
  background: var(--dark-bg);
}

/* Search */
.search-box .input-group {
  box-shadow: var(--card-shadow);
  border-radius: 0.5rem;
  overflow: hidden;
}

.search-box .form-control {
  border: 1.5px solid #e2e8f0;
  border-right: none;
}

.search-box .btn {
  border: 1.5px solid #e2e8f0;
  border-left: none;
}

/* Responsive Tables */
.table-schedule th {
  font-weight: 600;
  color: var(--secondary);
  border-top: none;
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-up {
  animation: fadeInUp 0.5s ease forwards;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--light-bg);
}

::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

/* Badge variants */
.bg-soft-primary {
  background: var(--primary-light);
  color: var(--primary);
}

.bg-soft-success {
  background: var(--success-light);
  color: var(--success);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #94a3b8;
}

.empty-state i {
  font-size: 4rem;
  margin-bottom: 1rem;
}

/* Print */
@media print {
  .navbar, .footer, .btn { display: none !important; }
}