/* ==============================
   CSS Variables
   ============================== */
:root {
  --color-dark: #473a4b;
  --color-gold: #d3b338;
  --color-gold-hover: #b89a20;
  --color-bg: #f8f7f5;
  --color-surface: #ffffff;
  --color-text: #2d2d2d;
  --color-text-muted: #6b7280;
  --color-border: #e5e7eb;
  --color-danger: #dc3545;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* ==============================
   Base
   ============================== */
body {
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 600;
  letter-spacing: -0.01em;
}

a {
  color: var(--color-gold);
}

a:hover {
  color: var(--color-gold-hover);
}

main.page-content {
  padding: 2rem 0 3rem;
}

/* ==============================
   Navbar
   ============================== */
.navbar-custom {
  background-color: var(--color-dark);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

.navbar-custom .nav-link,
.navbar-custom .navbar-brand {
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.navbar-custom .navbar-brand {
  padding: 0 0.85rem;
}

.navbar-custom .nav-link:hover {
  background-color: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.navbar-custom .navbar-toggler {
  border-color: rgba(255, 255, 255, 0.2);
}

.navbar-custom .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 1%29' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.navbar-logo {
  height: 48px;
  width: auto;
  margin: 0;
  padding-right: 0.5rem;
}

.nav-item {
  padding: 0.1rem 0.2rem;
}

.navbar-custom .form-select {
  background-color: transparent;
  color: rgba(255, 255, 255, 0.9);
  border-color: rgba(255, 255, 255, 0.25);
  font-size: 0.85rem;
}

.navbar-custom .form-select:focus {
  box-shadow: 0 0 0 2px rgba(211, 179, 56, 0.4);
  border-color: var(--color-gold);
  color: rgba(255, 255, 255, 0.9);
}

.navbar-custom .form-select option {
  background-color: var(--color-dark);
  color: white;
}

.navbar-custom button.nav-link {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.9);
}

.navbar-custom button.nav-link:hover {
  background-color: rgba(255, 255, 255, 0.12) !important;
  color: #fff !important;
}

/* ==============================
   Footer
   ============================== */
.site-footer {
  background-color: var(--color-dark);
  color: rgba(255, 255, 255, 0.85);
  padding: 3rem 1.5rem 2rem;
  text-align: center;
  margin-top: 4rem;
}

.site-footer .footer-section {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
}

.site-footer a {
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  padding: 6px 14px;
  display: inline-block;
  border-radius: var(--radius-sm);
  font-weight: 500;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.site-footer a:hover {
  background-color: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.site-footer img.logo {
  width: 60px;
  height: 60px;
  margin-bottom: 1.25rem;
  opacity: 0.9;
}

.site-footer img.social-icon {
  width: 28px;
  height: 28px;
  margin: 0 6px;
  vertical-align: middle;
  opacity: 0.8;
  transition: opacity 0.15s ease;
}

.site-footer img.social-icon:hover {
  opacity: 1;
}

.site-footer .copyright {
  font-size: 0.85em;
  margin-top: 1.25rem;
  color: rgba(255, 255, 255, 0.4);
}

@media (max-width: 600px) {
  .site-footer .footer-section {
    flex-direction: column;
    align-items: center;
  }

  .site-footer a {
    padding: 5px 10px;
  }
}

/* ==============================
   Cards
   ============================== */
.card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-header {
  background-color: #f3f2f0;
  border-bottom: 1px solid var(--color-border);
}

.card-header h5,
.card-header h4 {
  margin: 0;
}

/* ==============================
   Buttons
   ============================== */
.btn {
  border-radius: var(--radius-sm);
  font-weight: 500;
}

.btn-primary {
  background-color: var(--color-gold);
  border-color: var(--color-gold);
  color: #2d2d2d;
}

.btn-primary:hover,
.btn-primary:active {
  background-color: var(--color-gold-hover);
  border-color: var(--color-gold-hover);
  color: #2d2d2d;
}

.btn-primary:focus-visible {
  background-color: var(--color-gold-hover);
  border-color: var(--color-gold-hover);
  box-shadow: 0 0 0 3px rgba(211, 179, 56, 0.35);
  color: #2d2d2d;
}

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

.btn-outline-primary:hover {
  background-color: var(--color-gold);
  border-color: var(--color-gold);
  color: #2d2d2d;
}

/* ==============================
   Forms (Bootstrap overrides)
   ============================== */
.form-control,
.form-select {
  border-radius: var(--radius-sm);
  border-color: var(--color-border);
  font-family: inherit;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--color-gold);
  box-shadow: 0 0 0 3px rgba(211, 179, 56, 0.25);
}

.form-label {
  font-weight: 500;
}

/* ==============================
   Form Card (auth + narrow forms)
   ============================== */
.form-card {
  max-width: 420px;
  margin: 3rem auto;
  padding: 2rem 2.25rem;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.form-card h2 {
  text-align: center;
  margin-bottom: 1.5rem;
  font-size: 1.4rem;
}

.form-card label {
  display: block;
  margin: 0.75rem 0 0.25rem;
  font-weight: 500;
  font-size: 0.9rem;
}

.form-card input[type="text"],
.form-card input[type="email"],
.form-card input[type="password"],
.form-card input[type="tel"] {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  background-color: var(--color-surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-card input:focus {
  outline: none;
  border-color: var(--color-gold);
  box-shadow: 0 0 0 3px rgba(211, 179, 56, 0.25);
}

.form-card .error-message {
  color: var(--color-danger);
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

.form-card .form-links {
  text-align: center;
  margin-top: 1rem;
  font-size: 0.9rem;
}

.form-card .form-links a {
  color: var(--color-gold-hover);
}

/* Password toggle */
.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrapper input {
  width: 100%;
  padding-right: 40px;
}

.toggle-password {
  position: absolute;
  right: 12px;
  cursor: pointer;
  color: var(--color-text-muted);
  transition: color 0.15s ease;
}

.toggle-password:hover {
  color: var(--color-text);
}

/* ==============================
   Wide Form Card (external booking / password reset)
   ============================== */
.form-card-wide {
  max-width: 620px;
  margin: 2rem auto 3rem;
  padding: 1.75rem 2rem;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.form-card-wide fieldset {
  border: none;
  padding: 0;
  margin-bottom: 1.5rem;
}

.form-card-wide legend {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.75rem;
  padding: 0;
}

.form-card-wide label {
  display: block;
  margin: 0.6rem 0 0.2rem;
  font-weight: 500;
  font-size: 0.9rem;
}

.form-card-wide input[type="text"],
.form-card-wide input[type="email"],
.form-card-wide input[type="tel"],
.form-card-wide input[type="password"],
.form-card-wide input[type="date"],
.form-card-wide input[type="datetime-local"],
.form-card-wide select,
.form-card-wide textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  background-color: var(--color-surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-sizing: border-box;
}

.form-card-wide input:focus,
.form-card-wide select:focus,
.form-card-wide textarea:focus {
  outline: none;
  border-color: var(--color-gold);
  box-shadow: 0 0 0 3px rgba(211, 179, 56, 0.25);
}

.form-card-wide .submit-btn {
  width: 100%;
  padding: 0.75rem;
  background-color: var(--color-gold);
  color: var(--color-text);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease;
  font-family: inherit;
}

.form-card-wide .submit-btn:hover {
  background-color: var(--color-gold-hover);
}

.form-card-wide .submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.form-card-wide .error-message {
  color: var(--color-danger);
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

/* Payment amount display */
.payment-summary {
  text-align: center;
  font-weight: 600;
  font-size: 1.05rem;
  margin: 1rem 0;
  padding: 0.75rem;
  background-color: var(--color-bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

/* ==============================
   Lesson Booking: slot flex layout
   ============================== */
.slot-group {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.85rem 0;
}

.slot-group+.slot-group {
  border-top: 1px solid var(--color-border);
}

.slot-time-col {
  min-width: 100px;
  padding-top: 0.1rem;
  flex-shrink: 0;
}

.slot-time-col .time-label {
  display: block;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.15rem;
}

.slot-time-col .time-range {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
}

.slot-lessons-col {
  flex: 1;
  min-width: 0;
}

.lesson-entry+.lesson-entry {
  border-top: 1px solid var(--color-border);
  padding-top: 0.5rem;
  margin-top: 0.5rem;
}

.lesson-entry .lesson-action-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.lesson-entry .lesson-action-row form {
  margin: 0;
}

@media (max-width: 400px) {
  .slot-group {
    flex-direction: column;
    gap: 0.4rem;
  }

  .slot-time-col {
    min-width: unset;
  }

  .lesson-entry .lesson-action-row .btn {
    width: 100%;
  }
}

/* ==============================
   Tables
   ============================== */
.table {
  font-size: 0.9rem;
  border-color: var(--color-border);
  table-layout: auto;
  width: 100%;
}

.table th {
  font-weight: 600;
  background-color: #f3f2f0;
}

.table-bordered th,
.table-bordered td {
  border-color: var(--color-border);
}

/* ==============================
   Badges
   ============================== */
.badge {
  font-weight: 500;
  font-size: 0.78rem;
}

/* ==============================
   Alerts (Django messages)
   ============================== */
.alert {
  border-radius: var(--radius-sm);
}

/* ==============================
   Finance
   ============================== */
.finance-container {
  max-width: 860px;
  margin: 0 auto;
  padding: 10px;
}

.pay-container {
  max-width: 620px;
  margin: 0 auto;
  padding: 10px;
}

.quick-container {
  max-width: 820px;
  margin: 0 auto;
  padding: 10px;
}

.item-amount {
  white-space: nowrap;
  width: 110px;
}

.total-row td {
  font-weight: bold;
  background-color: #f3f2f0;
}

.actions-col {
  width: 90px;
  white-space: nowrap;
}

.add-form-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.add-form-row input[type="text"],
.add-form-row input[type="number"] {
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.95em;
  font-family: inherit;
}

#student-input {
  width: 260px;
}

#description {
  width: 220px;
}

#amount {
  width: 90px;
}

#feedback {
  font-size: 0.88em;
  min-height: 1.2em;
  margin-top: 6px;
}

#feedback.ok {
  color: #2e7d32;
}

#feedback.err {
  color: #c62828;
}

#student-input.unmatched {
  border-color: #e57373;
}

.alert-payment_block {
  background-color: #dc3545;
  color: white;
}

.inline-input {
  padding: 3px 6px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.9em;
  font-family: inherit;
  width: 280px;
}

.inline-input-amount {
  padding: 3px 6px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.9em;
  font-family: inherit;
  width: 100px;
}

/* ==============================
   Tabs (single_student.html)
   ============================== */
.tabs {
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tab-button {
  padding: 8px 18px;
  cursor: pointer;
  background-color: #f3f2f0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-family: inherit;
  transition: background-color 0.15s ease, color 0.15s ease;
  text-decoration: none;
  color: var(--color-text);
  display: inline-block;
}

.tab-button.active {
  background-color: var(--color-dark);
  color: white;
  border-color: var(--color-dark);
}

.tab-button:hover:not(.active) {
  background-color: #e8e6e3;
  color: var(--color-text);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}