/* ============================================================
   TutorTrack - Mobile-First App Styles
   ============================================================ */

:root {
  --primary:        #4F46E5;
  --primary-dark:   #3730A3;
  --primary-light:  #EEF2FF;
  --accent:         #10B981;
  --accent-light:   #D1FAE5;
  --warning:        #F59E0B;
  --warning-light:  #FEF3C7;
  --danger:         #EF4444;
  --danger-light:   #FEE2E2;
  --surface:        #FFFFFF;
  --bg:             #F5F7FF;
  --text:           #1E1B4B;
  --text-muted:     #6B7280;
  --border:         #E5E7EB;
  --topbar-h:       56px;
  --bottomnav-h:    66px;
  --radius:         14px;
  --radius-sm:      8px;
  --shadow:         0 2px 12px rgba(79,70,229,.10);
  --shadow-card:    0 1px 4px rgba(0,0,0,.08);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); font-size: 15px; }
a { text-decoration: none; color: var(--primary); }
img { max-width: 100%; }

/* ── Top Bar ─────────────────────────────────────────────── */
.app-topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  height: var(--topbar-h);
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.topbar-title  { font-size: 17px; font-weight: 700; letter-spacing: .3px; flex: 1; text-align: center; }
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 4px; min-width: 44px; }
.topbar-right  { justify-content: flex-end; }
.topbar-back, .topbar-icon-btn {
  color: #fff; background: rgba(255,255,255,.15); border-radius: 50%;
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  font-size: 18px; position: relative;
}
.topbar-logo { font-size: 22px; }

.badge-dot {
  position: absolute; top: 4px; right: 4px;
  width: 9px; height: 9px; border-radius: 50%;
  background: #EF4444; border: 2px solid var(--primary);
}

/* ── Main Content ─────────────────────────────────────────── */
.app-content {
  padding-top: calc(var(--topbar-h) + 8px);
  padding-bottom: calc(var(--bottomnav-h) + 10px);
  padding-left: 12px; padding-right: 12px;
  min-height: 100vh;
}

/* ── Bottom Nav ───────────────────────────────────────────── */
.app-bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000;
  height: var(--bottomnav-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex; align-items: stretch;
  box-shadow: 0 -2px 12px rgba(0,0,0,.08);
}
.bottomnav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 11px; gap: 3px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  transition: color .15s;
}
.bottomnav-item i  { font-size: 21px; }
.bottomnav-item.active { color: var(--primary); }
.bottomnav-item.active i { transform: scale(1.1); }

/* ── Cards ────────────────────────────────────────────────── */
.app-card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow-card); padding: 14px 16px; margin-bottom: 10px;
}
.app-card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.app-card-title { font-size: 15px; font-weight: 700; color: var(--text); }
.app-card-sub   { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Class Card */
.class-card { border-left: 4px solid var(--primary); cursor: pointer; }
.class-card:hover { box-shadow: var(--shadow); }
.class-card .class-icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: 20px;
  flex-shrink: 0;
}

/* Session Card */
.session-card-done     { border-left: 4px solid var(--accent); }
.session-card-scheduled{ border-left: 4px solid var(--primary); }
.session-card-postponed{ border-left: 4px solid var(--warning); }

/* Stat Cards (dashboard) */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.stat-card {
  background: var(--surface); border-radius: var(--radius-sm);
  padding: 14px 12px; box-shadow: var(--shadow-card);
  display: flex; flex-direction: column; gap: 4px;
}
.stat-card .stat-icon { font-size: 22px; margin-bottom: 4px; }
.stat-card .stat-val  { font-size: 22px; font-weight: 800; color: var(--primary); }
.stat-card .stat-lbl  { font-size: 11px; color: var(--text-muted); }
.stat-primary { border-top: 3px solid var(--primary); }
.stat-accent  { border-top: 3px solid var(--accent); }
.stat-warning { border-top: 3px solid var(--warning); }
.stat-danger  { border-top: 3px solid var(--danger); }

/* ── Section Header ───────────────────────────────────────── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin: 16px 0 8px;
}
.section-title { font-size: 13px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .8px; }
.section-link  { font-size: 12px; color: var(--primary); font-weight: 600; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn-app {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 11px 20px; border-radius: 50px; border: none;
  font-size: 14px; font-weight: 700; cursor: pointer; transition: all .15s;
}
.btn-primary-app { background: var(--primary); color: #fff; }
.btn-primary-app:hover { background: var(--primary-dark); }
.btn-accent-app  { background: var(--accent); color: #fff; }
.btn-ghost       { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-danger-app  { background: var(--danger); color: #fff; }
.btn-sm-app      { padding: 7px 14px; font-size: 13px; }

/* FAB (Floating Action Button) */
.fab {
  position: fixed; bottom: calc(var(--bottomnav-h) + 16px); right: 18px;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; box-shadow: 0 4px 16px rgba(79,70,229,.35);
  z-index: 800; cursor: pointer; border: none;
  transition: transform .15s, box-shadow .15s;
}
.fab:hover { transform: scale(1.07); box-shadow: 0 6px 20px rgba(79,70,229,.45); }

/* ── Forms ────────────────────────────────────────────────── */
.form-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-card); padding: 18px 16px; margin-bottom: 14px; }
.form-label { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 5px; }
.form-control, .form-select {
  border-radius: var(--radius-sm); border: 1.5px solid var(--border);
  padding: 10px 13px; font-size: 14px; color: var(--text);
  background: var(--bg); transition: border-color .15s;
  width: 100%;
}
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.12); outline: none; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* Checkbox / Radio pills */
.day-pill-group { display: flex; flex-wrap: wrap; gap: 7px; }
.day-pill input[type=checkbox] { display: none; }
.day-pill label {
  display: inline-block; padding: 6px 13px;
  border-radius: 50px; border: 1.5px solid var(--border);
  font-size: 13px; font-weight: 600; cursor: pointer; transition: all .15s;
  background: var(--surface); color: var(--text-muted);
}
.day-pill input:checked + label { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── Progress / Lesson ────────────────────────────────────── */
.progress-bar-app { background: var(--border); border-radius: 99px; height: 7px; overflow: hidden; }
.progress-bar-inner { height: 100%; background: var(--accent); border-radius: 99px; transition: width .4s; }

/* ── Attendance ───────────────────────────────────────────── */
.att-btn-group { display: flex; gap: 6px; }
.att-btn { flex: 1; text-align: center; border-radius: 8px; padding: 8px 0; font-size: 12px; font-weight: 700; cursor: pointer; border: 1.5px solid var(--border); background: var(--surface); color: var(--text-muted); transition: all .15s; }
.att-btn.active-present { background: var(--accent-light); color: var(--accent); border-color: var(--accent); }
.att-btn.active-absent  { background: var(--danger-light); color: var(--danger); border-color: var(--danger); }
.att-btn.active-late    { background: var(--warning-light); color: var(--warning); border-color: var(--warning); }

/* ── Map ──────────────────────────────────────────────────── */
#locationMap { height: 220px; border-radius: var(--radius-sm); border: 1.5px solid var(--border); }

/* ── Badges ───────────────────────────────────────────────── */
.badge { font-size: 11px; font-weight: 700; border-radius: 50px; padding: 3px 9px; }

/* ── Lists ────────────────────────────────────────────────── */
.item-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; background: var(--surface);
  border-bottom: 1px solid var(--border); cursor: pointer;
  transition: background .1s;
}
.item-row:last-child { border-bottom: none; }
.item-row:hover { background: var(--primary-light); }
.item-row-icon { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.item-row-body { flex: 1; min-width: 0; }
.item-row-title { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-row-sub   { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-row-end   { flex-shrink: 0; text-align: right; }

/* ── Empty State ──────────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state i { font-size: 52px; display: block; margin-bottom: 12px; opacity: .4; }
.empty-state p { font-size: 14px; }

/* ── Toast / Alert ────────────────────────────────────────── */
.toast-container { position: fixed; bottom: calc(var(--bottomnav-h) + 12px); left: 0; right: 0; display: flex; justify-content: center; z-index: 2000; pointer-events: none; }
.app-toast {
  background: #1E1B4B; color: #fff; border-radius: 50px;
  padding: 10px 22px; font-size: 14px; font-weight: 600;
  box-shadow: 0 4px 20px rgba(0,0,0,.25); pointer-events: all;
  animation: toastIn .25s ease;
}
@keyframes toastIn { from { opacity:0; transform: translateY(10px); } to { opacity:1; transform: translateY(0); } }

/* ── Reminder Banner ──────────────────────────────────────── */
.reminder-banner {
  background: var(--warning-light); border: 1.5px solid var(--warning);
  border-radius: var(--radius-sm); padding: 10px 14px;
  margin-bottom: 10px; display: flex; align-items: flex-start; gap: 10px;
}
.reminder-banner i { font-size: 18px; color: var(--warning); flex-shrink: 0; margin-top: 1px; }
.reminder-banner-body { flex: 1; min-width: 0; }
.reminder-banner-title { font-size: 13px; font-weight: 700; }
.reminder-banner-sub   { font-size: 12px; color: var(--text-muted); }

/* ── Page Sections ────────────────────────────────────────── */
.page-section { margin-bottom: 20px; }

/* ── Login Page ───────────────────────────────────────────── */
.login-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--primary); padding: 24px; }
.login-card { background: var(--surface); border-radius: 20px; padding: 30px 24px; width: 100%; max-width: 380px; box-shadow: 0 8px 40px rgba(0,0,0,.18); }
.login-logo { text-align: center; color: #fff; margin-bottom: 24px; }
.login-logo i { font-size: 52px; }
.login-logo h1 { font-size: 24px; font-weight: 800; margin: 8px 0 0; }
.login-logo p  { font-size: 13px; opacity: .8; }

/* ── Payment ──────────────────────────────────────────────── */
.due-amount { font-size: 28px; font-weight: 800; color: var(--danger); }
.paid-amount{ font-size: 22px; font-weight: 800; color: var(--accent); }

/* ── Report ───────────────────────────────────────────────── */
.report-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.report-table th { background: var(--primary-light); color: var(--primary); padding: 9px 10px; text-align: left; font-weight: 700; }
.report-table td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.report-table tr:last-child td { border-bottom: none; }

/* ── Scrollable Tabs ──────────────────────────────────────── */
.tab-scroll { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; -ms-overflow-style: none; }
.tab-scroll::-webkit-scrollbar { display: none; }
.tab-pill { flex-shrink: 0; padding: 7px 16px; border-radius: 50px; border: 1.5px solid var(--border); background: var(--surface); font-size: 13px; font-weight: 600; color: var(--text-muted); cursor: pointer; transition: all .15s; }
.tab-pill.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── Responsive ───────────────────────────────────────────── */
@media (min-width: 600px) {
  .app-content { max-width: 520px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
  .app-bottomnav, .app-topbar { max-width: 520px; left: 50%; transform: translateX(-50%); border-radius: 0; }
}
@media (min-width: 900px) {
  body { background: #E8EAF6; }
  .app-content { max-width: 540px; }
  .app-bottomnav, .app-topbar { max-width: 540px; }
}
