/* ============================================================
   RBC Student Portal — Main Stylesheet
   Revelation Bible College and Seminary

   Colour System:
   Dark Navy:   #0B1628
   Gold:        #D4A843
   White:       #ffffff
   Light Grey:  #f4f5f7
   Dark Text:   #111111
   Danger:      #E8456A
   Success:     #28B07E
   ============================================================ */

/* ---- CSS Variables ---- */
:root,
[data-theme="royal-navy"] {
    --navy: #0B1628;
    --navy-light: #142036;
    --navy-lighter: #1a2a45;
    --gold: #D4A843;
    --gold-light: #e4c06a;
    --gold-dark: #b8912e;
    --white: #ffffff;
    --light-grey: #f4f5f7;
    --grey: #e1e4e8;
    --grey-mid: #999;
    --dark-text: #111111;
    --danger: #E8456A;
    --danger-dark: #d13458;
    --success: #28B07E;
    --info: #0B1628;
    --warning: #D4A843;
    --auth-bg: linear-gradient(160deg, #071C30 0%, #0A2540 40%, #0d2f50 70%, #071C30 100%);
    --auth-glow: rgba(212, 175, 55, 0.06);
    --sidebar-width: 270px;
    --header-height: 60px;
    --radius: 8px;
    --radius-sm: 6px;
    --shadow: 0 2px 8px rgba(11, 22, 40, 0.08);
    --shadow-md: 0 4px 16px rgba(11, 22, 40, 0.12);
    --shadow-lg: 0 8px 32px rgba(11, 22, 40, 0.16);
    --transition: all 0.2s ease;
}

/* Theme 2: Emerald Seminary */
[data-theme="emerald-seminary"] {
    --navy: #1a3c34;
    --navy-light: #224a40;
    --navy-lighter: #2a5a4e;
    --gold: #C9A84C;
    --gold-light: #dbbe6a;
    --gold-dark: #a88a30;
    --white: #ffffff;
    --light-grey: #f3f6f4;
    --grey: #dce5e0;
    --grey-mid: #8a9a92;
    --dark-text: #1a2e28;
    --danger: #D95555;
    --danger-dark: #c04040;
    --success: #3DAA7D;
    --info: #1a3c34;
    --warning: #C9A84C;
    --auth-bg: linear-gradient(160deg, #0f2b24 0%, #1a3c34 40%, #1e4a3f 70%, #0f2b24 100%);
    --auth-glow: rgba(201, 168, 76, 0.06);
}

/* Theme 3: Burgundy Classic */
[data-theme="burgundy-classic"] {
    --navy: #3B1A2A;
    --navy-light: #4d2438;
    --navy-lighter: #5e2e44;
    --gold: #D4A05A;
    --gold-light: #e2b978;
    --gold-dark: #b88640;
    --white: #ffffff;
    --light-grey: #f7f4f5;
    --grey: #e8e0e3;
    --grey-mid: #9a8a90;
    --dark-text: #2a1520;
    --danger: #D44545;
    --danger-dark: #b83535;
    --success: #4AA87A;
    --info: #3B1A2A;
    --warning: #D4A05A;
    --auth-bg: linear-gradient(160deg, #2a1020 0%, #3B1A2A 40%, #4a2238 70%, #2a1020 100%);
    --auth-glow: rgba(212, 160, 90, 0.06);
}

/* Theme 4: Slate & Silver */
[data-theme="slate-silver"] {
    --navy: #1E2A3A;
    --navy-light: #283848;
    --navy-lighter: #324558;
    --gold: #90A4AE;
    --gold-light: #B0BEC5;
    --gold-dark: #607D8B;
    --white: #ffffff;
    --light-grey: #f5f6f8;
    --grey: #dfe3e8;
    --grey-mid: #8a9aaa;
    --dark-text: #1a2030;
    --danger: #E05555;
    --danger-dark: #c84040;
    --success: #4CAF7A;
    --info: #1E2A3A;
    --warning: #90A4AE;
    --auth-bg: linear-gradient(160deg, #141e2a 0%, #1E2A3A 40%, #263545 70%, #141e2a 100%);
    --auth-glow: rgba(144, 164, 174, 0.06);
}

/* ---- Reset ---- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--light-grey);
    color: var(--dark-text);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}

a { color: var(--gold-dark); text-decoration: none; }
a:hover { color: var(--gold); }

img { max-width: 100%; height: auto; }

/* ---- Typography ---- */
h1 { font-size: 1.75rem; font-weight: 700; color: var(--navy); }
h2 { font-size: 1.5rem; font-weight: 700; color: var(--navy); }
h3 { font-size: 1.25rem; font-weight: 600; color: var(--navy); }
h4 { font-size: 1.1rem; font-weight: 600; color: var(--navy); }

/* ============================================================
   AUTH CONTAINER — Login / Register
   ============================================================ */
#auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--auth-bg);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

#auth-container::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--auth-glow) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

#auth-container::after {
    content: '';
    position: absolute;
    bottom: -40%;
    left: -20%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--auth-glow) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.auth-wrapper {
    width: 100%;
    max-width: 460px;
    position: relative;
    z-index: 1;
}

.auth-logo {
    text-align: center;
    margin-bottom: 0;
    padding: 36px 28px 20px;
}

.auth-logo-img {
    max-width: 80px;
    height: auto;
    margin: 0 auto 14px;
    display: block;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
}

.auth-logo h1 {
    color: var(--white);
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.auth-logo p {
    color: #D4AF37;
    font-size: 0.82rem;
    margin-top: 4px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-style: normal;
    font-weight: 400;
}

.auth-logo-divider {
    width: 80%;
    margin: 0 auto;
    border: none;
    border-top: 1px solid rgba(255,255,255,0.12);
}

.auth-card {
    background: linear-gradient(160deg, rgba(11,22,40,0.95), rgba(20,35,60,0.92));
    border-radius: 18px;
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.45);
    overflow: hidden;
    border: 1px solid rgba(212, 175, 55, 0.15);
    backdrop-filter: blur(10px);
}

.auth-card-header {
    padding: 24px 32px 8px;
    border-bottom: none;
    background: none;
    text-align: center;
}

.auth-card-header h2 {
    color: var(--white);
    font-size: 1.5rem;
    font-weight: 700;
    font-style: italic;
}

.auth-card-header p {
    color: rgba(255,255,255,0.5);
    font-size: 0.85rem;
    margin-top: 4px;
}

.auth-card-body {
    padding: 20px 32px 12px;
}

.auth-card-body .form-label {
    color: rgba(255,255,255,0.7);
    font-size: 0.82rem;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 500;
}

.auth-card-body .form-control {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    color: var(--white);
    border-radius: 10px;
    padding: 12px 16px;
}

.auth-card-body .form-control::placeholder {
    color: rgba(255,255,255,0.35);
}

.auth-card-body .form-control:focus {
    border-color: var(--gold);
    background: rgba(255,255,255,0.12);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15);
}

.auth-card-body .form-control option {
    background: var(--navy);
    color: var(--white);
}

.auth-card-body .btn-primary {
    border-radius: 10px;
    font-size: 0.95rem;
}

.auth-footer {
    text-align: center;
    padding: 12px 32px 28px;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.5);
}

.auth-footer a {
    color: #D4AF37;
    font-weight: 600;
}

.auth-footer a:hover {
    color: #e4c06a;
}

#forgot-password-link {
    color: rgba(255,255,255,0.5) !important;
}

#forgot-password-link:hover {
    color: #D4AF37 !important;
}

.auth-bottom-text {
    text-align: center;
    margin-top: 20px;
    color: rgba(255,255,255,0.35);
    font-size: 0.78rem;
}

.auth-bottom-text a {
    color: rgba(255,255,255,0.45);
    text-decoration: none;
}

.auth-bottom-text a:hover {
    color: #D4AF37;
}

.auth-card .form-hint {
    color: rgba(255,255,255,0.4);
}

.auth-card .form-required::after {
    color: #E8456A;
}

/* ============================================================
   APP LAYOUT
   ============================================================ */
#app-container {
    display: flex;
    min-height: 100vh;
}

/* ---- Sidebar ---- */
#sidebar {
    width: var(--sidebar-width);
    background: var(--navy);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.sidebar-user {
    padding: 24px 16px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.sidebar-user-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--navy);
    border: 3px solid var(--gold);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    font-size: 2rem;
    font-weight: 700;
    color: var(--white);
    box-shadow: 0 2px 12px rgba(0,0,0,0.25);
}
.sidebar-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.sidebar-user-info {
    text-align: center;
    min-width: 0;
    width: 100%;
}

.sidebar-user-name {
    color: var(--white);
    font-size: 0.92rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.sidebar-user-role {
    color: var(--gold);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 3px;
}

/* ---- Sidebar Nav ---- */
#sidebar-nav {
    flex: 1;
    padding: 8px 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.nav-group-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 16px 20px 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255,255,255,0.45);
}

.nav-group-label::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Section colours */
.nav-group-label[data-section="overview"]::before { background: #D4AF37; }
.nav-group-label[data-section="academic"]::before { background: #5B9BD5; }
.nav-group-label[data-section="transcripts"]::before { background: #28B07E; }
.nav-group-label[data-section="attendance"]::before { background: #E8456A; }
.nav-group-label[data-section="grades"]::before { background: #9B6FD4; }
.nav-group-label[data-section="communication"]::before { background: #F5A623; }
.nav-group-label[data-section="documents"]::before { background: #4ECDC4; }
.nav-group-label[data-section="system"]::before { background: #FF6B6B; }
.nav-group-label[data-section="account"]::before { background: rgba(255,255,255,0.3); }

/* Section label text colours */
.nav-group-label[data-section="overview"] { color: #D4AF37; }
.nav-group-label[data-section="academic"] { color: #5B9BD5; }
.nav-group-label[data-section="transcripts"] { color: #28B07E; }
.nav-group-label[data-section="attendance"] { color: #E8456A; }
.nav-group-label[data-section="grades"] { color: #9B6FD4; }
.nav-group-label[data-section="communication"] { color: #F5A623; }
.nav-group-label[data-section="documents"] { color: #4ECDC4; }
.nav-group-label[data-section="system"] { color: #FF6B6B; }

/* Section-coloured left border on active items */
.nav-item[data-group="overview"].active { border-left-color: #D4AF37; }
.nav-item[data-group="academic"].active { border-left-color: #5B9BD5; }
.nav-item[data-group="transcripts"].active { border-left-color: #28B07E; }
.nav-item[data-group="attendance"].active { border-left-color: #E8456A; }
.nav-item[data-group="grades"].active { border-left-color: #9B6FD4; }
.nav-item[data-group="communication"].active { border-left-color: #F5A623; }
.nav-item[data-group="documents"].active { border-left-color: #4ECDC4; }
.nav-item[data-group="system"].active { border-left-color: #FF6B6B; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px;
    color: rgba(255,255,255,0.9);
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition);
    border-left: 3px solid transparent;
    cursor: pointer;
    text-decoration: none;
}

.nav-item:hover {
    color: var(--white);
    background: rgba(255,255,255,0.05);
}

.nav-item.active {
    color: var(--gold);
    background: rgba(212, 168, 67, 0.1);
    border-left-color: var(--gold);
    font-weight: 600;
}

.nav-icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    opacity: 0.8;
}

.nav-item.active .nav-icon {
    opacity: 1;
    color: var(--gold);
}

.nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    line-height: 1;
}

.nav-item.nav-logout {
    color: rgba(255,255,255,0.5);
}

.nav-item.nav-logout:hover {
    color: var(--danger);
}

/* Sidebar overlay (mobile) */
#sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}

/* ---- Main Content ---- */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
    max-width: calc(100vw - var(--sidebar-width));
}

/* ---- Top Header ---- */
.top-header {
    height: var(--header-height);
    background: var(--white);
    border-bottom: 1px solid var(--grey);
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.cover-banner {
    width: 100%;
    height: 200px;
    overflow: hidden;
    position: relative;
    border-bottom: 3px solid var(--gold);
}

.cover-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 30%;
    display: block;
}

.top-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

#sidebar-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--navy);
    padding: 4px;
}

#page-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--navy);
    display: none;
}

.top-header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* ---- Content Area ---- */
.content-area {
    flex: 1;
    padding: 24px;
    overflow-x: hidden;
}

/* ---- Page Sections ---- */
.page-section {
    display: none;
}

.page-section:first-of-type {
    display: block;
}

.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 1.5rem;
    margin-bottom: 4px;
}

.page-subtitle {
    color: var(--gold-dark);
    font-size: 0.9rem;
    font-weight: 500;
}

/* ============================================================
   COMPONENTS
   ============================================================ */

/* ---- Cards ---- */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--grey);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 1rem;
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--grey);
    background: var(--light-grey);
}

/* ---- Stat Cards ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    width: 100%;
    box-sizing: border-box;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    border-top: 4px solid var(--gold);
    transition: var(--transition);
}

.stat-card.stat-primary   { border-top-color: var(--navy); background: linear-gradient(135deg, rgba(11,22,40,0.03), var(--white)); }
.stat-card.stat-success   { border-top-color: var(--success); background: linear-gradient(135deg, rgba(40,176,126,0.05), var(--white)); }
.stat-card.stat-gold      { border-top-color: var(--gold); background: linear-gradient(135deg, rgba(212,175,55,0.06), var(--white)); }
.stat-card.stat-danger    { border-top-color: var(--danger); background: linear-gradient(135deg, rgba(232,69,106,0.04), var(--white)); }
.stat-card.stat-info      { border-top-color: #5B9BD5; background: linear-gradient(135deg, rgba(91,155,213,0.05), var(--white)); }
.stat-card.stat-navy      { border-top-color: #1B2A4A; background: linear-gradient(135deg, rgba(27,42,74,0.06), var(--white)); }
.stat-card.stat-muted     { border-top-color: #aaa; background: linear-gradient(135deg, rgba(170,170,170,0.05), var(--white)); }

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--navy);
    line-height: 1;
}

.stat-card.stat-primary .stat-value { color: var(--navy); }
.stat-card.stat-success .stat-value { color: var(--success); }
.stat-card.stat-gold .stat-value    { color: var(--gold-dark); }
.stat-card.stat-danger .stat-value  { color: var(--danger); }
.stat-card.stat-info .stat-value    { color: #5B9BD5; }
.stat-card.stat-navy .stat-value    { color: #1B2A4A; }
.stat-card.stat-muted .stat-value   { color: #888; }

.stat-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--gold-dark);
    margin-top: 6px;
}

/* Dashboard section headings */
.dash-section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--navy);
    padding: 12px 18px;
    border-left: 4px solid var(--gold);
    background: linear-gradient(90deg, rgba(212,175,55,0.08), transparent);
    border-radius: 0 var(--radius) var(--radius) 0;
    margin-bottom: 12px;
}

/* Quick overview list */
.overview-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}
.overview-item:last-child { border-bottom: none; }
.overview-item:hover { background: rgba(212,175,55,0.04); }
.overview-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    border-radius: 14px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--white);
    background: var(--gold);
}
.overview-badge.badge-navy    { background: var(--navy); }
.overview-badge.badge-success { background: var(--success); }
.overview-badge.badge-info    { background: #5B9BD5; }
.overview-badge.badge-gold    { background: var(--gold-dark); }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    border: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1;
    white-space: nowrap;
}

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

.btn-primary {
    background: var(--gold);
    color: var(--navy);
    border-color: var(--gold);
}

.btn-primary:hover:not(:disabled) {
    background: var(--gold-light);
    border-color: var(--gold-light);
}

.btn-secondary {
    background: transparent;
    color: var(--navy);
    border-color: var(--navy);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--navy);
    color: var(--white);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
    border-color: var(--danger);
}

.btn-danger:hover:not(:disabled) {
    background: var(--danger-dark);
    border-color: var(--danger-dark);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.78rem;
}

.btn-icon {
    padding: 8px;
    border-radius: var(--radius-sm);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--navy);
    transition: var(--transition);
}

.btn-icon:hover {
    background: var(--light-grey);
}

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

.form-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--navy);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--grey);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--dark-text);
    background: var(--white);
    transition: var(--transition);
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(212, 168, 67, 0.15);
}

.form-control::placeholder {
    color: #aaa;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23999' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--grey-mid);
    margin-top: 4px;
}

.form-required::after {
    content: ' *';
    color: var(--danger);
}

/* ---- Tables ---- */
.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table thead th {
    background: var(--navy);
    color: var(--white);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px;
    text-align: left;
    white-space: nowrap;
}

table tbody td {
    padding: 11px 16px;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--grey);
    color: var(--dark-text);
}

table tbody tr:nth-child(even) {
    background: var(--light-grey);
}

table tbody tr:hover {
    background: rgba(212, 168, 67, 0.08);
}

/* ---- Badges ---- */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-gold {
    background: rgba(212, 168, 67, 0.15);
    color: var(--gold-dark);
}

.badge-success {
    background: rgba(40, 176, 126, 0.12);
    color: #1a8a5e;
}

.badge-danger {
    background: rgba(232, 69, 106, 0.12);
    color: var(--danger);
}

.badge-navy {
    background: rgba(11, 22, 40, 0.08);
    color: var(--navy);
}

.badge-warning {
    background: rgba(212, 168, 67, 0.15);
    color: var(--gold-dark);
}

/* ---- Modals ---- */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(11, 22, 40, 0.6);
    backdrop-filter: blur(4px);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.modal-overlay-show {
    display: flex;
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 300;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal .modal-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(11, 22, 40, 0.6);
    backdrop-filter: blur(4px);
    z-index: 300;
}

.modal .modal-content {
    position: relative;
    z-index: 310;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
}

.modal-sm .modal-content { max-width: 420px; }
.modal-lg .modal-content { max-width: 720px; }
.modal-xl .modal-content { max-width: 960px; }

.modal-header {
    background: var(--navy);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    color: var(--white);
    font-size: 1rem;
}

.modal-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    padding: 4px;
    font-size: 1.3rem;
    line-height: 1;
}

.modal-close:hover {
    color: var(--white);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--grey);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

/* ---- Searchable Select ---- */
.searchable-select {
    position: relative;
}
.searchable-select-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border: 1px solid var(--grey);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-height: 220px;
    overflow-y: auto;
    z-index: 200;
    margin-top: 2px;
}
.searchable-select-option {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}
.searchable-select-option:hover {
    background: rgba(212,168,67,0.1);
}
.searchable-select-option.disabled {
    color: #999;
    cursor: default;
}
.searchable-select-option.disabled:hover {
    background: none;
}

/* ---- Verse of the Day Toast ---- */
.verse-toast {
    position: fixed;
    top: 80px;
    right: 20px;
    width: 340px;
    background: var(--navy);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 18px 20px;
    z-index: 500;
    border-left: 4px solid var(--gold);
    animation: verseSlideIn 0.5s ease-out;
    font-size: 0.88rem;
}
.verse-toast-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}
.verse-toast-hide {
    animation: verseSlideOut 0.4s ease-in forwards;
}
@keyframes verseSlideIn {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes verseSlideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(120%); opacity: 0; }
}

/* ---- Toasts ---- */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    min-width: 280px;
    max-width: 420px;
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.3s ease;
    font-size: 0.85rem;
    font-weight: 500;
}

.toast.toast-show {
    transform: translateX(0);
    opacity: 1;
}

.toast.toast-hide {
    transform: translateX(120%);
    opacity: 0;
}

.toast-success {
    background: var(--success);
    color: var(--white);
}

.toast-error {
    background: var(--danger);
    color: var(--white);
}

.toast-info {
    background: var(--navy);
    color: var(--white);
}

.toast-warning {
    background: var(--gold);
    color: var(--navy);
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast-close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 1.2rem;
    opacity: 0.7;
    padding: 0 2px;
}

.toast-close:hover {
    opacity: 1;
}

/* ---- Search Bar ---- */
.search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--light-grey);
    border: 1.5px solid var(--grey);
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    transition: var(--transition);
}

.search-bar:focus-within {
    border-color: var(--gold);
    background: var(--white);
}

.search-bar input {
    flex: 1;
    border: none;
    background: none;
    outline: none;
    font-size: 0.85rem;
    color: var(--dark-text);
}

.search-bar svg {
    color: var(--grey-mid);
    flex-shrink: 0;
}

/* ---- Filter Bar ---- */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.filter-bar select {
    padding: 8px 32px 8px 12px;
    border: 1.5px solid var(--grey);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    background: var(--white);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23999' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

/* ---- Tabs ---- */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--grey);
    gap: 0;
    margin-bottom: 20px;
}

.tab {
    padding: 10px 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--grey-mid);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
}

.tab:hover {
    color: var(--navy);
}

.tab.active {
    color: var(--gold-dark);
    border-bottom-color: var(--gold);
}

/* ---- Progress Bar ---- */
.progress-bar {
    width: 100%;
    height: 10px;
    background: var(--grey);
    border-radius: 5px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.4s ease;
    background: var(--gold);
}

.progress-fill.progress-complete {
    background: var(--success);
}

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--grey-mid);
}

.empty-state h3 {
    color: var(--navy);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 0.9rem;
    margin-bottom: 16px;
}

/* ---- Utility ---- */
.text-gold { color: var(--gold-dark); }
.text-navy { color: var(--navy); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-muted { color: var(--grey-mid); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.hidden { display: none !important; }

/* ---- Theme Switcher ---- */
.theme-switcher {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.theme-card {
    width: 140px;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid var(--grey);
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.theme-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}

.theme-card.active {
    border-color: var(--gold);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.theme-card-preview {
    height: 70px;
    display: flex;
}

.theme-card-sidebar {
    width: 35%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px;
}

.theme-card-sidebar span {
    display: block;
    width: 80%;
    height: 3px;
    border-radius: 2px;
    opacity: 0.5;
}

.theme-card-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 8px;
    gap: 4px;
}

.theme-card-stat {
    width: 100%;
    height: 8px;
    border-radius: 3px;
    opacity: 0.3;
}

.theme-card-bar {
    width: 60%;
    height: 6px;
    border-radius: 3px;
}

.theme-card-label {
    text-align: center;
    padding: 8px 6px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: var(--dark-text);
    background: var(--white);
}

.theme-card.active .theme-card-label {
    color: var(--gold-dark);
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
    @page {
        margin: 10mm;
    }

    body {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Hide everything except printable content */
    #sidebar,
    .top-header,
    #sidebar-overlay,
    .toast-container,
    .no-print,
    .btn,
    .cover-banner,
    .verse-toast {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
    }

    .content-area {
        padding: 0 !important;
    }

    /* When printing certificate or transcript, hide everything else */
    body.printing-doc #sidebar,
    body.printing-doc .sidebar-overlay,
    body.printing-doc .top-header,
    body.printing-doc .cover-banner,
    body.printing-doc .page-header,
    body.printing-doc .stats-grid,
    body.printing-doc .toast-container,
    body.printing-doc .verse-toast {
        display: none !important;
    }

    body.printing-doc .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }

    body.printing-doc .content-area {
        padding: 0 !important;
    }

    body.printing-doc .page-section {
        padding: 0 !important;
        margin: 0 !important;
    }

    /* Hide all non-printable content within the page section */
    body.printing-doc .page-section > *:not(#cert-preview):not(#transcript-preview-area):not(#id-card-preview) {
        display: none !important;
    }

    /* Inside cert/transcript preview, hide buttons and forms */
    body.printing-doc #cert-preview > *:not(#certificate-printable),
    body.printing-doc #transcript-preview-area > *:not(#transcript-printable),
    body.printing-doc #id-card-preview > *:not(#id-card-printable) {
        display: none !important;
    }

    body.printing-doc .searchable-select,
    body.printing-doc .form-row,
    body.printing-doc .form-group,
    body.printing-doc form,
    body.printing-doc .card-header,
    body.printing-doc .card:not(#certificate-printable):not(#transcript-printable):not(#id-card-printable) {
        display: none !important;
    }

    body.printing-doc #certificate-printable,
    body.printing-doc #transcript-printable,
    body.printing-doc #id-card-printable {
        box-shadow: none !important;
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 !important;
    }

}

/* ============================================================
   RESPONSIVE
   ============================================================ */
/* =============================================================
   MOBILE RESPONSIVE — 768px (Tablets & Phones)
   ============================================================= */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 260px;
    }

    /* ── Sidebar ──────────────────────────────────────────── */
    #sidebar {
        transform: translateX(-100%);
        z-index: 1000;
    }
    #sidebar.sidebar-open {
        transform: translateX(0);
    }
    #sidebar-overlay {
        z-index: 999;
    }
    .sidebar-user-avatar {
        width: 70px;
        height: 70px;
        font-size: 1.5rem;
    }
    .sidebar-user {
        padding: 18px 14px 14px;
    }

    /* ── Main Content ─────────────────────────────────────── */
    .main-content {
        margin-left: 0;
        max-width: 100vw;
    }

    /* ── Top Header ───────────────────────────────────────── */
    #sidebar-toggle {
        display: block;
    }
    #page-title {
        display: block;
        font-size: 0.95rem;
    }
    .top-header {
        display: flex;
        padding: 0 12px;
        height: 50px;
    }

    /* ── Cover Banner ─────────────────────────────────────── */
    .cover-banner {
        height: 100px !important;
    }
    .cover-banner img {
        height: 100px !important;
    }

    /* ── Content Area ─────────────────────────────────────── */
    .content-area {
        padding: 12px;
        overflow-x: hidden;
    }

    /* ── Page Headers ─────────────────────────────────────── */
    .page-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
    }
    .page-header h1 {
        font-size: 1.15rem;
    }
    .page-subtitle {
        font-size: 0.8rem;
    }
    /* Page header inline button groups */
    .page-header [style*="display:flex"][style*="gap:10px"],
    .page-header [style*="display:flex"][style*="gap:8px"] {
        flex-wrap: wrap !important;
        width: 100% !important;
    }
    .page-header [style*="display:flex"] .btn {
        flex: 1 1 auto;
        min-width: 0;
        justify-content: center;
        font-size: 0.75rem;
        padding: 7px 10px;
    }

    /* ── Stat Cards ───────────────────────────────────────── */
    .stats-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
    }
    .stat-card {
        padding: 14px 12px;
    }
    .stat-value {
        font-size: 1.25rem;
    }
    .stat-label {
        font-size: 0.65rem;
    }
    /* Override inline grid-template-columns for stat grids */
    [style*="grid-template-columns:repeat(4"],
    [style*="grid-template-columns:repeat(5"],
    [style*="grid-template-columns:repeat(6"],
    [style*="grid-template-columns: repeat(4"],
    [style*="grid-template-columns: repeat(5"],
    [style*="grid-template-columns: repeat(6"] {
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
    }

    /* ── Data Tables ──────────────────────────────────────── */
    .data-table {
        font-size: 0.78rem;
    }
    .data-table th,
    .data-table td {
        padding: 8px 10px;
        white-space: nowrap;
    }
    /* Wrap tables in scrollable container */
    .table-wrapper,
    .card-body:has(.data-table) {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* ── Forms ────────────────────────────────────────────── */
    .form-row {
        grid-template-columns: 1fr;
    }
    /* Override inline 2-column form grids */
    [style*="grid-template-columns:1fr 1fr"][style*="gap:16px"],
    [style*="grid-template-columns:1fr 1fr"][style*="gap:14px"],
    [style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    /* ── Cards ────────────────────────────────────────────── */
    .card {
        border-radius: 6px;
    }
    .card-header {
        padding: 12px 14px;
        flex-wrap: wrap;
        gap: 8px;
    }
    .card-header h3 {
        font-size: 0.9rem;
    }
    .card-body {
        padding: 14px;
    }

    /* ── Modals ───────────────────────────────────────────── */
    .modal {
        padding: 8px;
    }
    .modal .modal-content,
    .modal-content {
        max-width: 100% !important;
        margin: 8px !important;
        border-radius: 8px;
        max-height: calc(100vh - 40px);
    }
    .modal-body {
        padding: 16px !important;
    }
    .modal-footer {
        flex-wrap: wrap;
        gap: 8px;
        padding: 12px 16px;
    }
    .modal-footer .btn {
        flex: 1;
        justify-content: center;
        min-width: 0;
    }
    .modal-header {
        padding: 14px 16px;
    }
    .modal-header h3 {
        font-size: 0.9rem;
    }

    /* ── Buttons ──────────────────────────────────────────── */
    .btn {
        font-size: 0.8rem;
        padding: 8px 12px;
    }
    .btn-sm {
        font-size: 0.7rem;
        padding: 5px 8px;
    }
    .btn svg {
        width: 14px;
        height: 14px;
    }

    /* ── Toasts ───────────────────────────────────────────── */
    .toast-container {
        right: 8px;
        bottom: 8px;
        left: 8px;
    }
    .toast {
        min-width: auto;
        max-width: 100%;
        font-size: 0.8rem;
        padding: 10px 12px;
    }

    /* ── Filter Bar ───────────────────────────────────────── */
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .filter-bar select {
        width: 100%;
    }

    /* ── Tabs ─────────────────────────────────────────────── */
    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .tab {
        padding: 8px 14px;
        font-size: 0.78rem;
        white-space: nowrap;
    }

    /* ── Profile / Detail flex layouts ────────────────────── */
    .page-section [style*="display:flex"][style*="gap:30px"],
    .page-section [style*="display:flex"][style*="gap:24px"] {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center;
    }

    /* ── Inline 2-col and 3-col grids ────────────────────── */
    [style*="display:grid"][style*="gap:20px"],
    [style*="display:grid"][style*="gap:24px"] {
        grid-template-columns: 1fr !important;
    }

    /* ── Searchable select ────────────────────────────────── */
    .searchable-select {
        width: 100%;
    }

    /* ── Verse of the Day Toast ───────────────────────────── */
    .verse-toast {
        right: 10px !important;
        left: 10px !important;
        width: auto !important;
        max-width: none !important;
        top: 60px;
        font-size: 0.82rem;
    }

    /* ── Auth Container ───────────────────────────────────── */
    #auth-container {
        padding: 16px;
    }
    .auth-wrapper {
        max-width: 100%;
        margin: 0;
    }
    .auth-card {
        border-radius: 14px;
    }
    .auth-card-body {
        padding: 16px 20px 12px;
    }
    .auth-card-header {
        padding: 20px 20px 8px;
    }
    .auth-card-header h2 {
        font-size: 1.25rem;
    }
    .auth-logo h1 {
        font-size: 1.2rem;
    }
    .auth-logo {
        padding: 28px 20px 16px;
    }
    .auth-footer {
        padding: 10px 20px 24px;
    }

    /* ── Dashboard section ────────────────────────────────── */
    .dash-section-title {
        font-size: 0.9rem;
        padding: 10px 14px;
    }

    /* ── Theme Switcher ───────────────────────────────────── */
    .theme-switcher {
        gap: 10px;
        justify-content: center;
    }
    .theme-card {
        width: 110px;
    }
    .theme-card-preview {
        height: 55px;
    }

    /* ── Search bar ───────────────────────────────────────── */
    .search-bar {
        width: 100%;
    }

    /* ── Overview items ───────────────────────────────────── */
    .overview-item {
        padding: 10px 14px;
        font-size: 0.85rem;
    }
}


/* =============================================================
   MOBILE RESPONSIVE — 480px (Small Phones)
   ============================================================= */
@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr !important;
    }

    [style*="grid-template-columns:repeat(4"],
    [style*="grid-template-columns:repeat(5"],
    [style*="grid-template-columns: repeat(4"],
    [style*="grid-template-columns: repeat(5"] {
        grid-template-columns: 1fr !important;
    }

    .content-area {
        padding: 8px;
    }

    .card-body {
        padding: 12px;
    }

    .auth-wrapper {
        max-width: 100%;
        margin: 0;
    }
    .auth-card-body {
        padding: 14px 16px 10px;
    }
    .auth-card-header {
        padding: 16px 16px 6px;
    }

    .page-header h1 {
        font-size: 1rem;
    }

    .stat-value {
        font-size: 1.1rem;
    }

    .stat-label {
        font-size: 0.6rem;
    }

    .btn {
        font-size: 0.75rem;
        padding: 7px 10px;
    }

    .page-header [style*="display:flex"] .btn {
        font-size: 0.7rem;
        padding: 6px 8px;
    }

    /* Certificate/transcript on mobile */
    #certificate-printable,
    #transcript-printable {
        transform: scale(0.5);
        transform-origin: top center;
    }

    /* Cover banner very small on tiny phones */
    .cover-banner {
        height: 80px !important;
    }
    .cover-banner img {
        height: 80px !important;
    }
}
