/* ─── Variables ─────────────────────────────────────────────────────────── */
:root {
  --son-color: #2563EB;
  --son-light: #DBEAFE;
  --daughter-color: #DB2777;
  --daughter-light: #FCE7F3;
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --border: #E2E8F0;
  --text: #1E293B;
  --text-muted: #64748B;
  --success: #16A34A;
  --danger: #DC2626;
  --warning: #D97706;
  --radius: 12px;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
}

/* ─── Base ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body {
  font-family: 'Noto Sans KR', 'Apple SD Gothic Neo', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─── Navbar ─────────────────────────────────────────────────────────────── */
.nav-active {
  background: rgba(255,255,255,0.22) !important;
  font-weight: 600;
}
.navbar-toggler:focus { box-shadow: none; }

/* ─── Main Container ─────────────────────────────────────────────────────── */
.main-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1rem 2rem;
  flex: 1;
  width: 100%;
}

/* ─── Cards ─────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius) !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow);
}
.card-body { padding: 1.25rem 1.5rem; }
.card-section-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text);
}

/* ─── Tags / Badges ─────────────────────────────────────────────────────── */
.child-tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.child-tag-lg {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  color: white;
  font-size: 0.82rem;
  font-weight: 600;
  background: rgba(255,255,255,0.25);
}
.subject-tag {
  background: #F1F5F9;
  color: var(--text-muted);
  padding: 0.1rem 0.5rem;
  border-radius: 6px;
  font-size: 0.8rem;
}
.time-tag { color: var(--text-muted); font-size: 0.85rem; }
.child-legend {
  font-size: 0.85rem;
  color: var(--text-muted);
}
.legend-dot {
  display: inline-block;
  width: 11px; height: 11px;
  border-radius: 50%;
  margin-right: 3px;
  vertical-align: middle;
}

/* ─── Shuttle Badge ──────────────────────────────────────────────────────── */
.shuttle-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: #ECFDF5;
  color: #059669;
  border: 1px solid #A7F3D0;
  border-radius: 6px;
  padding: 0.1rem 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
}
.shuttle-info {
  font-size: 0.85rem;
  color: #059669;
  background: #ECFDF5;
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
  border: 1px solid #A7F3D0;
}

/* ─── Today Card ─────────────────────────────────────────────────────────── */
.today-list { display: flex; flex-direction: column; gap: 0.5rem; }
.today-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.8rem;
  background: #F8FAFC;
  border-radius: 8px;
  flex-wrap: wrap;
}

/* ─── Payment Summary ────────────────────────────────────────────────────── */
.payment-summary-list { display: flex; flex-direction: column; gap: 0.4rem; }
.payment-summary-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  background: #F8FAFC;
  flex-wrap: wrap;
}
.payment-summary-item.status-paid { border-left: 3px solid var(--success); }
.payment-summary-item.status-unpaid { border-left: 3px solid var(--warning); }
.pay-academy { flex: 1; font-weight: 500; min-width: 100px; }
.pay-amount { font-weight: 700; }
.pay-due { color: var(--text-muted); font-size: 0.85rem; }
.pay-status.paid { color: var(--success); font-size: 0.8rem; font-weight: 600; }
.pay-status.unpaid { color: var(--warning); font-size: 0.8rem; font-weight: 600; }

/* ─── Weekly Timetable ───────────────────────────────────────────────────── */
.timetable-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.timetable {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
  font-size: 0.82rem;
}
.timetable th {
  background: #F1F5F9;
  padding: 0.45rem 0.4rem;
  text-align: center;
  border: 1px solid var(--border);
  font-weight: 700;
  white-space: nowrap;
  color: var(--text);
}
.timetable th.time-col { width: 56px; }
.timetable th.today-col {
  background: #DBEAFE;
  color: var(--son-color);
}
.timetable td {
  border: 1px solid var(--border);
  padding: 0.2rem;
  vertical-align: top;
}
.time-cell {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  background: #FAFAFA;
  font-weight: 500;
  padding: 0.3rem 0.2rem;
}
.schedule-cell { min-width: 80px; }
.schedule-block {
  padding: 0.18rem 0.3rem;
  border-radius: 5px;
  margin-bottom: 2px;
  font-size: 0.75rem;
  line-height: 1.4;
}
.block-child {
  display: inline-block;
  padding: 0 0.25rem;
  border-radius: 3px;
  color: white;
  font-size: 0.62rem;
  font-weight: 700;
  margin-right: 2px;
}
.block-name { font-weight: 600; }
.block-time { display: block; color: rgba(0,0,0,0.45); font-size: 0.68rem; }
.schedule-card .card-body { padding-bottom: 1rem; }

/* ─── Academy Cards Grid ─────────────────────────────────────────────────── */
.academies-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}
.academy-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}
.academy-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.academy-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.85rem;
  color: white;
}
.academy-actions { display: flex; gap: 0.25rem; }
.academy-card-body { padding: 0.9rem 1rem; }
.academy-card-body h3 { font-size: 1.05rem; margin-bottom: 0.2rem; }
.subject { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 0.5rem; }
.days-display { display: flex; gap: 0.25rem; margin-bottom: 0.45rem; flex-wrap: wrap; }
.day-chip {
  width: 27px; height: 27px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  font-size: 0.73rem;
  font-weight: 600;
  background: #F1F5F9;
  color: #94A3B8;
}
.day-chip.active { background: var(--son-color); color: white; }
.time-display { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.35rem; }
.fee-display { font-size: 0.9rem; font-weight: 600; display: flex; align-items: center; gap: 0.5rem; }
.payment-day { font-size: 0.75rem; color: var(--text-muted); font-weight: 400; }
.notes { font-size: 0.82rem; color: var(--text-muted); margin-top: 0.4rem; }
.btn-icon {
  background: rgba(255,255,255,0.15);
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 0.2rem 0.35rem;
  border-radius: 5px;
  transition: background 0.15s;
  line-height: 1;
}
.btn-icon:hover { background: rgba(255,255,255,0.35); }

/* ─── Filter Bar ─────────────────────────────────────────────────────────── */
.filter-bar { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.filter-btn {
  padding: 0.35rem 0.85rem;
  border-radius: 20px;
  border: 2px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: 0.83rem;
  font-weight: 500;
  transition: all 0.18s;
  font-family: inherit;
  color: var(--text);
}
.filter-btn:hover { border-color: var(--son-color); color: var(--son-color); }
.filter-btn.active { background: var(--son-color); border-color: var(--son-color); color: white; }
.filter-btn.son.active { background: var(--son-color); border-color: var(--son-color); }
.filter-btn.daughter.active { background: var(--daughter-color); border-color: var(--daughter-color); }

/* ─── Stats Row ──────────────────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.75rem;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.son-stat { border-top: 3px solid var(--son-color); }
.daughter-stat { border-top: 3px solid var(--daughter-color); }
.unpaid-stat { border-top: 3px solid var(--warning); }
.stat-label { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 0.25rem; }
.stat-value { font-size: 1.25rem; font-weight: 700; }

/* ─── Payments List ──────────────────────────────────────────────────────── */
.payments-list { display: flex; flex-direction: column; gap: 0.6rem; }
.payment-row {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 0.7rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid var(--border);
  flex-wrap: wrap;
  box-shadow: var(--shadow);
}
.payment-row.status-paid { border-left: 4px solid var(--success); }
.payment-row.status-unpaid { border-left: 4px solid var(--warning); }
.payment-left { display: flex; align-items: center; gap: 0.6rem; flex: 1; min-width: 160px; }
.payment-info { display: flex; flex-direction: column; }
.payment-info strong { font-size: 0.95rem; }
.notes-small { font-size: 0.78rem; color: var(--text-muted); }
.payment-right { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.pay-amount-lg { font-size: 1rem; font-weight: 700; }
.pay-due-sm, .pay-paid-sm { font-size: 0.8rem; color: var(--text-muted); }
.status-badge {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
}
.status-badge.paid { background: #DCFCE7; color: var(--success); }
.status-badge.unpaid { background: #FEF9C3; color: var(--warning); }
.payment-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; }

/* ─── Day Picker (Form) ──────────────────────────────────────────────────── */
.day-picker { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.day-label {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.3rem 0.55rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.15s;
  user-select: none;
}
.day-label:has(input:checked) {
  background: var(--son-color);
  border-color: var(--son-color);
  color: white;
}
.day-label input { display: none; }

/* ─── Empty State ────────────────────────────────────────────────────────── */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
}
.empty-state p { margin-bottom: 1rem; font-size: 1rem; }
.empty-msg { text-align: center; color: var(--text-muted); padding: 1rem; font-size: 0.9rem; }

/* ─── Toast ──────────────────────────────────────────────────────────────── */
.app-toast {
  position: fixed;
  bottom: 1.5rem; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1E293B;
  color: white;
  padding: 0.65rem 1.4rem;
  border-radius: 24px;
  font-size: 0.9rem;
  opacity: 0;
  transition: all 0.3s;
  z-index: 9999;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.app-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.app-toast.app-toast-error { background: var(--danger); }

/* ─── Footer ─────────────────────────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 0.9rem 1rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

/* ─── Bootstrap Overrides ────────────────────────────────────────────────── */
.form-control:focus, .form-select:focus {
  border-color: var(--son-color);
  box-shadow: 0 0 0 0.18rem rgba(37,99,235,0.18);
}
.modal-content { border-radius: var(--radius) !important; border: none; }
.modal-header { border-bottom: 1px solid var(--border); }
.modal-footer { border-top: 1px solid var(--border); }
.btn-primary { background: var(--son-color); border-color: var(--son-color); }
.btn-primary:hover, .btn-primary:focus { background: #1D4ED8; border-color: #1D4ED8; }

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .card-body { padding: 1rem; }
  .timetable { font-size: 0.7rem; }
  .academies-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .payment-row { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 380px) {
  .stats-row { grid-template-columns: 1fr; }
}
