:root {
  --primary: #1a3c6e;
  --primary-dark: #12294d;
  --accent: #d4a017;
  --accent-dark: #b3860f;
  --bg: #f5f7fa;
  --card-bg: #ffffff;
  --text: #1f2933;
  --text-muted: #6b7280;
  --border: #e2e5ea;
  --success: #1e8e5a;
  --danger: #c0392b;
  --radius: 10px;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.07);
  --max-width: 1140px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a {
  text-decoration: none;
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Top bar ---------- */
.site-header {
  background: var(--primary);
  color: #fff;
  padding: 16px 0;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-header .brand {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* ---------- Course grid ---------- */
.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  padding: 32px 0;
}

.course-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.course-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.course-card .thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--border);
}

.course-card .body {
  padding: 18px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.course-card h3 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.course-card p {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin: 0 0 14px;
  flex: 1;
}

.price-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 14px;
}

.price-row .final {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
}

.price-row .original {
  text-decoration: line-through;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 8px;
  padding: 12px 22px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.btn-primary {
  background: var(--accent);
  color: #1a1a1a;
}

.btn-primary:hover {
  background: var(--accent-dark);
}

.btn-outline {
  background: transparent;
  border: 1px solid #fff;
  color: #fff;
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.85rem;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-success {
  background: var(--success);
  color: #fff;
}

/* ---------- Course detail page ---------- */
.course-detail {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 32px;
  padding: 32px 0 60px;
  align-items: start;
}

.course-detail .main-image {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.course-detail h1 {
  margin-top: 0;
  font-size: 1.8rem;
  color: var(--primary);
}

.meta-list {
  list-style: none;
  padding: 0;
  margin: 16px 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.meta-list li {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.9rem;
}

.meta-list li strong {
  display: block;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ---------- Registration card ---------- */
.register-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  position: sticky;
  top: 20px;
}

.register-card h2 {
  margin-top: 0;
  font-size: 1.2rem;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  background: #fff;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 60, 110, 0.12);
}

.field-error {
  color: var(--danger);
  font-size: 0.8rem;
  margin-top: 4px;
}

.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.alert-success {
  background: #e5f7ee;
  color: var(--success);
  border: 1px solid #b8e6cd;
}

.alert-danger {
  background: #fdecea;
  color: var(--danger);
  border: 1px solid #f5c6c0;
}

/* ---------- Result pages ---------- */
.result-page {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.result-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px;
  text-align: center;
  max-width: 480px;
  width: 100%;
}

.result-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 2rem;
  color: #fff;
}

.result-icon.success { background: var(--success); }
.result-icon.failed { background: var(--danger); }

/* ---------- Admin layout ---------- */
.admin-wrapper {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 240px;
  background: var(--primary-dark);
  color: #fff;
  flex-shrink: 0;
  padding: 20px 0;
}

.admin-sidebar .brand {
  padding: 0 20px 20px;
  font-weight: 700;
  font-size: 1.1rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 12px;
}

.admin-sidebar nav a {
  display: block;
  padding: 12px 20px;
  color: rgba(255,255,255,0.85);
  font-size: 0.92rem;
}

.admin-sidebar nav a:hover,
.admin-sidebar nav a.active {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.admin-content {
  flex: 1;
  padding: 28px;
  min-width: 0;
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.admin-topbar h1 {
  margin: 0;
  font-size: 1.4rem;
}

.mobile-toggle {
  display: none;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 1.1rem;
}

/* ---------- Cards / tables ---------- */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}

.stat-card .label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-card .value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  margin-top: 4px;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

table.data-table th,
table.data-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  white-space: nowrap;
}

table.data-table th {
  background: var(--bg);
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.4px;
}

table.data-table tbody tr:hover {
  background: #fafbfc;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: capitalize;
}

.badge-paid { background: #e5f7ee; color: var(--success); }
.badge-pending { background: #fff6e5; color: #a67c00; }
.badge-failed { background: #fdecea; color: var(--danger); }
.badge-active { background: #e5f7ee; color: var(--success); }
.badge-inactive { background: #eee; color: #666; }

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.filter-bar .form-control {
  width: auto;
  min-width: 160px;
}

.pagination {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.pagination a,
.pagination span {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 0.85rem;
}

.pagination .active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.actions-cell {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------- Razorpay loading overlay ---------- */
.pay-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  flex-direction: column;
  gap: 12px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- Responsive breakpoints ---------- */
@media (max-width: 992px) {
  .course-detail {
    grid-template-columns: 1fr;
  }

  .register-card {
    position: static;
  }
}

@media (max-width: 768px) {
  .admin-sidebar {
    position: fixed;
    left: -240px;
    top: 0;
    bottom: 0;
    z-index: 1000;
    transition: left 0.2s ease;
    overflow-y: auto;
  }

  .admin-sidebar.open {
    left: 0;
    box-shadow: 4px 0 16px rgba(0,0,0,0.2);
  }

  .mobile-toggle {
    display: inline-block;
  }

  .admin-content {
    padding: 18px;
  }

  .course-grid {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 20px 0;
  }

  .filter-bar .form-control {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 14px;
  }

  .result-card {
    padding: 28px 20px;
  }

  .site-header .brand {
    font-size: 1.05rem;
  }
}

.offer-timer {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fdecea;
  color: var(--danger);
  border: 1px solid #f5c6c0;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.88rem;
  margin-bottom: 18px;
}

.offer-timer-icon {
  font-size: 1.1rem;
}

.offer-timer strong {
  font-variant-numeric: tabular-nums;
}
