/* ============================================================================
   Shree Lalita Music School - Theme
   Indian Classical Music: Deep Maroon / Gold / Ivory White
   Mobile-first, no CSS framework dependency.
   ============================================================================ */

:root {
    --maroon: #6d0f1e;
    --maroon-dark: #4a0a15;
    --maroon-light: #8c1f31;
    --gold: #c9a227;
    --gold-light: #e8d9a0;
    --ivory: #faf6ec;
    --ivory-dark: #f0e9d8;
    --white: #ffffff;
    --text: #2b1810;
    --text-muted: #6b5c4f;
    --success: #2e7d32;
    --danger: #c62828;
    --warning: #b8860b;
    --info: #1565c0;
    --radius: 10px;
    --shadow: 0 2px 8px rgba(109, 15, 30, 0.12);
    --sidebar-width: 240px;
    --topbar-height: 60px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--ivory);
    color: var(--text);
    font-family: 'Segoe UI', Tahoma, Verdana, sans-serif;
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
}

a { color: var(--maroon); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { color: var(--maroon-dark); margin: 0 0 .5rem; }

img { max-width: 100%; }

/* ---------------------------------------------------------------------- */
/* Public / login layout                                                   */
/* ---------------------------------------------------------------------- */
.public-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: radial-gradient(circle at top, var(--ivory-dark), var(--ivory));
}

.login-card {
    background: var(--white);
    border-top: 6px solid var(--gold);
    border-radius: var(--radius);
    box-shadow: 0 8px 30px rgba(109, 15, 30, 0.18);
    padding: 2.5rem 2rem;
    max-width: 420px;
    width: 100%;
    text-align: center;
}

.login-card img.logo { width: 120px; margin-bottom: 1rem; }
.login-card h1 { font-size: 1.4rem; }
.login-card p.tagline { color: var(--text-muted); margin-bottom: 1.75rem; }

.btn-google {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    width: 100%;
    padding: .8rem 1rem;
    background: var(--white);
    border: 1px solid #d8d0c0;
    border-radius: 8px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: box-shadow .15s ease;
}
.btn-google:hover { box-shadow: var(--shadow); text-decoration: none; }

.alert-box {
    text-align: left;
    padding: .75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1.25rem;
    font-size: .92rem;
}
.alert-box.error { background: #fdecea; color: var(--danger); border: 1px solid #f5c2c0; }
.alert-box.success { background: #eaf4ea; color: var(--success); border: 1px solid #c3e0c3; }
.alert-box.info { background: #e8f1fb; color: var(--info); border: 1px solid #c3d9f5; }
.alert-box.warning { background: #fdf3dc; color: var(--warning); border: 1px solid #f0dfa8; }

/* ---------------------------------------------------------------------- */
/* App shell                                                               */
/* ---------------------------------------------------------------------- */
.app-topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--topbar-height);
    background: linear-gradient(135deg, var(--maroon), var(--maroon-dark));
    color: var(--white);
    display: flex;
    align-items: center;
    padding: 0 1rem;
    z-index: 100;
    box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.app-topbar .brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; color: var(--gold-light); flex: 1; }
.app-topbar .brand:hover { text-decoration: none; opacity: .9; }
.app-topbar .brand img { height: 34px; width: 34px; border-radius: 50%; background: var(--white); }
.app-topbar .brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hamburger {
    background: none; border: none; color: var(--white); font-size: 1.5rem;
    cursor: pointer; padding: .25rem .5rem; margin-right: .5rem;
}
.topbar-user { display: flex; align-items: center; gap: .5rem; }
.topbar-user img { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--gold); }
.topbar-user .logout-link { color: var(--gold-light); font-size: .85rem; }

.app-sidebar {
    position: fixed;
    top: var(--topbar-height);
    bottom: 0;
    left: calc(-1 * var(--sidebar-width));
    width: var(--sidebar-width);
    background: var(--white);
    border-right: 1px solid var(--ivory-dark);
    overflow-y: auto;
    transition: left .2s ease;
    z-index: 90;
}
.app-sidebar.open { left: 0; box-shadow: 4px 0 16px rgba(0,0,0,.15); }
.app-sidebar nav a {
    display: flex; align-items: center; gap: .6rem;
    padding: .85rem 1.25rem; color: var(--text); font-weight: 500;
    border-left: 3px solid transparent;
}
.app-sidebar nav a:hover { background: var(--ivory); text-decoration: none; }
.app-sidebar nav a.active { border-left-color: var(--gold); color: var(--maroon); background: var(--ivory); }
.app-sidebar .section-label {
    padding: 1rem 1.25rem .35rem; font-size: .72rem; text-transform: uppercase;
    letter-spacing: .05em; color: var(--text-muted);
}

.sidebar-backdrop {
    display: none;
    position: fixed; inset: 0; top: var(--topbar-height);
    background: rgba(0,0,0,.35); z-index: 80;
}
.sidebar-backdrop.open { display: block; }

.app-main {
    margin-top: var(--topbar-height);
    padding: 1.25rem;
    min-height: calc(100vh - var(--topbar-height));
}

@media (min-width: 900px) {
    .hamburger { display: none; }
    .app-sidebar { left: 0; }
    .app-main { margin-left: var(--sidebar-width); }
    .sidebar-backdrop { display: none !important; }
}

/* ---------------------------------------------------------------------- */
/* Page header / breadcrumbs                                              */
/* ---------------------------------------------------------------------- */
.page-header {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: .75rem; margin-bottom: 1.25rem;
}
.page-header h1 { font-size: 1.3rem; margin: 0; }

@media (max-width: 899.98px) {
    .page-header { flex-direction: column; align-items: flex-start; }
    .page-header .btn-primary { width: 80%; min-width: 200px; justify-content: center; align-self: center; }
}

/* ---------------------------------------------------------------------- */
/* Stat cards (dashboards)                                                 */
/* ---------------------------------------------------------------------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: .9rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem 1.1rem;
    border-top: 4px solid var(--gold);
}
.stat-card .value { font-size: 1.6rem; font-weight: 700; color: var(--maroon-dark); }
.stat-card .label { font-size: .82rem; color: var(--text-muted); margin-top: .2rem; }

/* ---------------------------------------------------------------------- */
/* Dashboard quick actions (mobile only - mirrors sidebar nav as buttons) */
/* ---------------------------------------------------------------------- */
.quick-actions-top,
.quick-actions-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .7rem;
    margin-bottom: 1rem;
}
.quick-actions-nav { margin-bottom: 1.5rem; }
.quick-actions-top .btn,
.quick-actions-nav .btn {
    justify-content: center;
    text-align: center;
    padding: .9rem .6rem;
    white-space: normal;
}
.back-home-btn {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    margin-bottom: 1rem;
    padding: .45rem .8rem;
    border: 1px solid var(--maroon);
    border-radius: 7px;
    color: var(--maroon);
    font-weight: 600;
    font-size: .85rem;
}
.back-home-btn:hover { background: var(--ivory); text-decoration: none; }

@media (min-width: 900px) {
    .quick-actions-top, .quick-actions-nav, .back-home-btn { display: none; }
}

/* Mobile "Home" screen: dashboard shows only the quick-action buttons by
   default (?view absent). "Dashboard" (?view=stats) and "Upcoming Courses"
   (?view=upcoming) are separate sub-views, each with their own
   back-to-home link. Desktop is unaffected - it always shows the full
   dashboard regardless of view. */
@media (max-width: 899.98px) {
    .stat-grid, #upcoming-courses, .mobile-dashboard-extra { display: none; }
    body.mobile-view-stats .stat-grid { display: grid; }
    body.mobile-view-stats .mobile-dashboard-extra { display: block; }
    body.mobile-view-upcoming #upcoming-courses { display: block; }
}

/* ---------------------------------------------------------------------- */
/* Cards / panels                                                          */
/* ---------------------------------------------------------------------- */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.1rem 1.25rem;
    margin-bottom: 1.25rem;
}
.card h2, .card h3 { font-size: 1.05rem; border-bottom: 2px solid var(--ivory-dark); padding-bottom: .6rem; }

/* ---------------------------------------------------------------------- */
/* Buttons                                                                 */
/* ---------------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .55rem 1rem; border-radius: 7px; border: 1px solid transparent;
    font-size: .9rem; font-weight: 600; cursor: pointer; text-decoration: none;
    line-height: 1.2;
}
.btn:hover { text-decoration: none; opacity: .92; }
.btn-primary { background: var(--maroon); color: var(--white); }
.btn-gold { background: var(--gold); color: var(--maroon-dark); }
.btn-outline { background: transparent; border-color: var(--maroon); color: var(--maroon); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-success { background: var(--success); color: var(--white); }
.btn-sm { padding: .35rem .65rem; font-size: .8rem; }
.btn-whatsapp { background: #25D366; color: var(--white); }
.btn-block { width: 100%; justify-content: center; }

/* ---------------------------------------------------------------------- */
/* Forms                                                                   */
/* ---------------------------------------------------------------------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: .3rem; color: var(--maroon-dark); }
.form-group .hint { font-size: .75rem; color: var(--text-muted); margin-top: .25rem; }
input[type=text], input[type=email], input[type=tel], input[type=number],
input[type=date], input[type=password], select, textarea {
    width: 100%; padding: .6rem .7rem; border: 1px solid #d8d0c0; border-radius: 7px;
    font-size: .95rem; background: var(--white); color: var(--text); font-family: inherit;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,162,39,.25);
}
textarea { resize: vertical; min-height: 80px; }
.form-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; }

/* ---------------------------------------------------------------------- */
/* Tables                                                                  */
/* ---------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
thead th {
    background: var(--maroon); color: var(--gold-light); text-align: left;
    padding: .7rem .8rem; white-space: nowrap; font-weight: 600;
}
tbody td { padding: .65rem .8rem; border-bottom: 1px solid var(--ivory-dark); vertical-align: middle; }
tbody tr:hover { background: var(--ivory); }
.table-actions { display: flex; gap: .4rem; flex-wrap: wrap; }

/* ---------------------------------------------------------------------- */
/* Badges                                                                  */
/* ---------------------------------------------------------------------- */
.badge {
    display: inline-block; padding: .2rem .55rem; border-radius: 12px;
    font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .02em;
}
.badge-active, .badge-completed-good { background: #e3f2e3; color: var(--success); }
.badge-inactive, .badge-cancelled, .badge-withdrawn { background: #fdecea; color: var(--danger); }
.badge-upcoming, .badge-draft { background: #fdf3dc; color: var(--warning); }
.badge-completed { background: #e8f1fb; color: var(--info); }

/* ---------------------------------------------------------------------- */
/* Search / filters                                                       */
/* ---------------------------------------------------------------------- */
.search-bar { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.search-bar input[type=text] { flex: 1; min-width: 200px; }

/* Empty state */
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--text-muted); }

/* Utility */
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; }
.flex-between { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .6rem; }
