/* ============================================
   Floak — Full Stylesheet
   Light theme matching the reference UI
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --blue: #2979FF;
    --blue-light: #E3F0FF;
    --blue-dark: #1565C0;
    --bg: #EDF2F8;
    --card: #FFFFFF;
    --input-bg: #F0F4FA;
    --input-border: #DCE3ED;
    --text: #1A1A2E;
    --text-secondary: #6B7A90;
    --text-muted: #9BAABD;
    --success: #2ECC71;
    --error: #E74C3C;
    --warning: #F39C12;
    --shadow: 0 12px 40px -8px rgba(0,0,0,0.06);
    --radius: 20px;
    --radius-sm: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
}

html {
    min-height: 100%;
    background: var(--bg);
}

/* Dark theme */
body.dark {
    --bg: #0F1923;
    --card: #1A2636;
    --input-bg: #233040;
    --input-border: #2E3E50;
    --text: #E8EDF2;
    --text-secondary: #8899AA;
    --text-muted: #5C6E80;
    --shadow: 0 12px 40px -8px rgba(0,0,0,0.4);
}

body {
    font-family: 'Poppins', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    padding-left: var(--safe-left);
    padding-right: var(--safe-right);
    transition: background 0.3s, color 0.3s;
    animation: fadeIn 0.5s ease;
    -webkit-tap-highlight-color: transparent;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== AUTH PAGE ===== */
.auth-body {
    display: flex;
    flex-direction: column;
}

.auth-bg {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 40vh;
    background: linear-gradient(135deg, var(--blue), #64B5F6);
    border-radius: 0 0 40px 40px;
    z-index: 0;
}

body.dark .auth-bg {
    background: linear-gradient(135deg, #1A2636, #233040);
}

.auth-container {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 80px 20px 40px;
    min-height: 100vh;
}

.auth-card {
    background: var(--card);
    border-radius: 24px;
    padding: 36px 28px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow);
}

.auth-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.brand-title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 26px;
    font-weight: 800;
    color: var(--text);
    line-height: 1.15;
}

.brand-logo {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    flex: 0 0 32px;
    object-fit: cover;
    display: block;
}

.brand-title .blue {
    color: var(--blue);
}

.theme-toggle {
    width: 40px;
    height: 40px;
    border: 1px solid var(--input-border);
    border-radius: 50%;
    background: var(--input-bg);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.theme-toggle:hover {
    border-color: var(--blue);
    color: var(--blue);
}

/* Badge */
.auth-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--blue);
    color: #fff;
    border-radius: 30px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-bottom: 24px;
    text-align: center;
    line-height: 1.4;
}

.auth-badge svg {
    flex-shrink: 0;
    stroke: #fff;
}

.blue-badge {
    background: var(--blue-light);
    color: var(--blue);
}

body.dark .blue-badge {
    background: rgba(41, 121, 255, 0.15);
}

.blue-badge svg {
    stroke: var(--blue);
}

/* Form Fields */
.field {
    margin-bottom: 16px;
}

.field label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
    margin-left: 4px;
}

.input-box {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    pointer-events: none;
    z-index: 1;
}

.input-box input,
.input-box select {
    width: 100%;
    padding: 14px 14px 14px 44px;
    background: var(--input-bg);
    border: 1.5px solid var(--input-border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: 'Poppins', sans-serif;
    font-size: 15px;
    font-weight: 500;
    outline: none;
    transition: border-color 0.2s;
}

.input-box input:focus,
.input-box select:focus {
    border-color: var(--blue);
}

.input-box input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

.input-box select {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.input-box select option {
    background: var(--card);
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Buttons */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: var(--radius);
    font-family: 'Poppins', sans-serif;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:hover { opacity: 0.92; }
.btn:active { transform: scale(0.98); }

.btn-primary {
    background: var(--blue);
    color: #fff;
}

.btn-secondary {
    background: var(--blue-light);
    color: var(--blue);
    border: 1.5px solid transparent;
}

.btn-secondary:hover {
    border-color: var(--blue);
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-danger {
    background: var(--error);
    color: #fff;
}

.btn-ghost {
    background: var(--input-bg);
    color: var(--text-secondary);
    border: 1.5px solid var(--input-border);
}

.btn-ghost:hover {
    border-color: var(--blue);
    color: var(--blue);
}

.btn-sm {
    width: auto;
    padding: 8px 16px;
    font-size: 12px;
    border-radius: var(--radius-sm);
}

.btn.loading {
    pointer-events: none;
    opacity: 0.6;
}

.auth-note {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 16px;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 20px 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--input-border);
}

.auth-divider span {
    font-size: 12px;
    color: var(--text-muted);
}

/* ===== TOAST ===== */
.toast-box {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background: var(--card);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    font-size: 13px;
    color: var(--text);
    min-width: 260px;
    max-width: 380px;
    animation: slideIn 0.3s ease;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--error); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.info { border-left: 3px solid var(--blue); }

.toast svg { flex-shrink: 0; }
.toast.success svg { color: var(--success); }
.toast.error svg { color: var(--error); }
.toast.warning svg { color: var(--warning); }
.toast.info svg { color: var(--blue); }

.toast.hide { animation: slideOut 0.3s ease forwards; }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* ===== POPUP ===== */
.popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0,0,0,0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.popup-card {
    background: var(--card);
    border-radius: 20px;
    padding: 32px 28px;
    max-width: 380px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow);
    animation: popIn 0.3s ease;
}

.popup-icon-wrap {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #E8F5E9;
    color: var(--success);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
}

body.dark .popup-icon-wrap {
    background: rgba(46,204,113,0.15);
}

.popup-card h2 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 6px;
}

.popup-card p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 20px;
}

@keyframes popIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* ===== NAVBAR ===== */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: calc(16px + var(--safe-top)) max(32px, var(--safe-right)) 16px max(32px, var(--safe-left));
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

@media (max-width: 768px) {
    .navbar {
        padding: var(--safe-top) max(16px, var(--safe-right)) 0 max(16px, var(--safe-left));
        min-height: calc(64px + var(--safe-top));
        background: var(--card);
        border-bottom: 1px solid var(--input-border);
        border-radius: 0 0 24px 24px; /* Native app rounded bottom */
        box-shadow: 0 4px 20px rgba(0,0,0,0.06);
        justify-content: space-between;
    }
    
    body.dark .navbar {
        background: var(--card);
        border-bottom: 1px solid var(--input-border);
        box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    }

    .nav-user, .nav-brand, .btn-logout span {
        display: none !important;
    }

    .nav-brand-mobile {
        display: flex !important;
        align-items: center;
        gap: 8px;
        margin-right: auto;
    }
    
    .nav-brand-mobile span, .nav-brand span {
        display: none !important;
    }

    .nav-brand-mobile img {
        width: 32px !important;
        height: 32px !important;
        border-radius: 8px;
        box-shadow: 0 4px 10px rgba(41, 121, 255, 0.2);
    }

    .nav-right {
        display: flex !important;
        align-items: center;
        gap: 10px;
    }

    .btn-logout {
        width: 40px !important;
        height: 40px !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        border-radius: 12px !important;
        background: var(--input-bg) !important;
        border: 1px solid var(--input-border) !important;
        color: var(--text-secondary) !important;
    }

    .btn-logout svg {
        width: 20px !important;
        height: 20px !important;
    }

    /* Style for the "View as Student" / Preview button specifically */
    .nav-right .btn-logout[onclick*="home.html"] {
        color: var(--blue) !important;
        background: var(--blue-light) !important;
        border-color: transparent !important;
    }

    .nav-right-mobile {
        display: none !important;
    }
}

/* Symbolic Buttons for Mobile */
@media (max-width: 600px) {
    .navbar .btn-logout span, 
    .navbar .btn-logout b,
    .navbar .btn-logout i {
        display: none;
    }
    .navbar .btn-logout {
        padding: 8px;
        min-width: 40px;
        justify-content: center;
    }
}

body.dark .navbar {
    background: rgba(26, 38, 54, 0.85);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
}

.nav-logo {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    flex: 0 0 28px;
    object-fit: cover;
    display: block;
}

.nav-brand .blue { color: var(--blue); }

.nav-brand svg {
    color: var(--blue);
}

.nav-tag {
    padding: 3px 10px;
    background: var(--blue-light);
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    color: var(--blue);
    margin-left: 6px;
    text-transform: uppercase;
}

body.dark .nav-tag {
    background: rgba(41,121,255,0.15);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.avatar-circle {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--blue);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: transparent;
    border: 1px solid var(--input-border);
    border-radius: var(--radius-sm);
    font-family: 'Poppins', sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: var(--error);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: rgba(231,76,60,0.08);
    border-color: var(--error);
}

.btn-logout svg {
    width: 14px;
    height: 14px;
}

.btn-account {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: var(--blue-light);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-family: 'Poppins', sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: var(--blue);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-account:hover {
    border-color: var(--blue);
    transform: translateY(-1px);
}

.btn-account svg {
    width: 15px;
    height: 15px;
}

.navbar #accountSidebarBtn {
    display: none !important;
}

.navbar .nav-user .avatar-circle {
    cursor: pointer;
}

@media (max-width: 768px) {
    .btn-account {
        width: 40px !important;
        height: 40px !important;
        padding: 0 !important;
        justify-content: center;
        border-radius: 12px !important;
    }

    .btn-account span {
        display: none !important;
    }

    .btn-account svg {
        width: 20px !important;
        height: 20px !important;
    }
}

/* Subject page navbar */
.subject-nav-left {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 12px;
}

.subject-back-btn {
    width: 38px;
    height: 38px;
    border: 1px solid var(--input-border);
    border-radius: 12px;
    background: var(--input-bg);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

.subject-back-btn:hover {
    color: var(--blue);
    border-color: var(--blue);
    background: var(--blue-light);
}

.subject-brand-logo {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    flex-shrink: 0;
}

.subject-brand .nav-tag {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .subject-navbar .subject-nav-left {
        flex: 1;
        gap: 10px;
    }

    .subject-navbar .subject-brand {
        display: none !important;
    }

    .subject-navbar .subject-brand-mobile {
        display: flex !important;
        align-items: center;
        gap: 8px;
        min-width: 0;
        margin-right: 0;
        font-size: 15px;
        font-weight: 700;
        color: var(--text);
    }

    .subject-navbar .subject-brand-mobile span {
        display: inline !important;
        white-space: nowrap;
    }

    .subject-navbar .subject-brand-mobile img {
        width: 32px !important;
        height: 32px !important;
        border-radius: 8px;
        box-shadow: 0 4px 10px rgba(41, 121, 255, 0.2);
    }

    .subject-back-btn {
        width: 40px;
        height: 40px;
    }
}

/* ===== MAIN CONTENT ===== */
.main-content {
    max-width: 960px;
    margin: 0 auto;
    padding: 20px 16px;
}

/* Section Card */
.section-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 30px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(0,0,0,0.02);
}

.welcome-card {
    background: linear-gradient(135deg, var(--blue-light), var(--card));
    border-radius: var(--radius);
    padding: 30px 40px;
    margin-bottom: 24px;
    border: 1px solid var(--input-border);
}

body.dark .welcome-card {
    background: linear-gradient(135deg, rgba(41,121,255,0.1), var(--card));
}

.section-card h2, .welcome-card h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 6px;
}

.section-card .section-desc, .welcome-card .section-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 14px;
}

/* Stats Row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.stat-box {
    background: var(--card);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
}

.stat-icon.blue { background: var(--blue-light); color: var(--blue); }
.stat-icon.green { background: #E8F5E9; color: var(--success); }
.stat-icon.orange { background: #FFF3E0; color: var(--warning); }

body.dark .stat-icon.blue { background: rgba(41,121,255,0.15); }
body.dark .stat-icon.green { background: rgba(46,204,113,0.15); }
body.dark .stat-icon.orange { background: rgba(243,156,18,0.15); }

.stat-num {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
}

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0;
    background: var(--input-bg);
    border-radius: var(--radius-sm);
    padding: 4px;
    margin-bottom: 16px;
}

.tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    background: transparent;
    border: none;
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn svg { width: 16px; height: 16px; }

.tab-btn.active {
    background: var(--blue);
    color: #fff;
    font-weight: 600;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* User Row */
.user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--card);
    border: 1.5px solid var(--input-border);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.015);
}

.user-row:hover {
    border-color: var(--blue-light);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(41,121,255,0.06);
}

body.dark .user-row:hover {
    border-color: rgba(41,121,255,0.3);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.user-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 1px;
}

.user-actions {
    display: flex;
    gap: 6px;
}

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

.empty-state svg {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
    opacity: 0.4;
    margin-bottom: 10px;
}

.empty-state h3 {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.empty-state p {
    font-size: 12px;
}

/* ===== SEARCH ===== */
.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--card);
    border: 1.5px solid var(--input-border);
    border-radius: 30px;
    margin-bottom: 14px;
    box-shadow: var(--shadow);
}

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

.search-bar input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text);
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    outline: none;
}

.search-bar input::placeholder { color: var(--text-muted); }

/* Filter Pills */
.filter-pills {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.pill {
    padding: 6px 16px;
    border: 1.5px solid var(--input-border);
    border-radius: 20px;
    background: var(--card);
    color: var(--text-muted);
    font-family: 'Poppins', sans-serif;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.pill:hover {
    border-color: var(--blue);
    color: var(--blue);
}

.pill.active {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
}

/* Material Cards */
.material-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}

.mat-card {
    background: var(--card);
    border: 1.5px solid var(--input-border);
    border-radius: var(--radius);
    padding: 24px;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 6px 16px rgba(0,0,0,0.02);
}

.mat-card:hover {
    border-color: var(--blue);
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(41,121,255,0.12);
}

.mat-card-head {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 8px;
}

.fav-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    margin-top: -4px;
    margin-right: -4px;
}

.fav-btn:hover {
    background: var(--blue-light);
    color: var(--blue);
}

.fav-btn.active {
    color: #FF4081;
}

body.dark .fav-btn.active {
    color: #FF4081;
}

.mat-icon-box {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--blue-light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--blue);
}

body.dark .mat-icon-box {
    background: rgba(41,121,255,0.15);
}

.mat-icon-box svg {
    width: 20px;
    height: 20px;
}

.mat-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
}

.mat-subject {
    display: inline-block;
    margin-top: 3px;
    padding: 2px 8px;
    background: var(--blue-light);
    border-radius: 10px;
    font-size: 9px;
    color: var(--blue);
    text-transform: uppercase;
    font-weight: 700;
}

body.dark .mat-subject {
    background: rgba(41,121,255,0.15);
}

.mat-desc {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mat-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 10px;
    color: var(--text-muted);
    padding-top: 8px;
    border-top: 1px solid var(--input-border);
}

.mat-footer span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.mat-footer svg {
    width: 12px;
    height: 12px;
}

/* Material Modal */
.mat-modal-card {
    background: var(--card);
    border-radius: 20px;
    padding: 28px;
    max-width: 460px;
    width: 90%;
    box-shadow: var(--shadow);
    animation: popIn 0.3s ease;
    position: relative;
}

.mat-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.mat-modal-close:hover {
    color: var(--error);
    border-color: var(--error);
}

.mat-modal-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
}

.mat-modal-head h2 {
    font-size: 16px;
    font-weight: 700;
}

.mat-modal-body p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 14px;
}

.mat-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}

.mat-tag {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    background: var(--input-bg);
    border-radius: 20px;
    font-size: 11px;
    color: var(--text-secondary);
}

.mat-tag svg {
    width: 12px;
    height: 12px;
}

.mat-modal-btns {
    display: flex;
    gap: 8px;
}

.mat-modal-btns .btn { flex: 1; }

/* Account Sidebar */
.account-sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.38);
    z-index: 1300;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.account-sidebar-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.account-sidebar {
    position: absolute;
    top: 0;
    right: 0;
    width: min(390px, 100%);
    height: 100%;
    background: var(--card);
    border-left: 1px solid var(--input-border);
    box-shadow: -18px 0 50px rgba(0, 0, 0, 0.18);
    padding: 22px;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.28s ease;
}

.account-sidebar-overlay.active .account-sidebar {
    transform: translateX(0);
}

body.account-sidebar-open {
    overflow: hidden;
}

.account-sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.account-kicker {
    font-size: 11px;
    font-weight: 700;
    color: var(--blue);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 2px;
}

.account-sidebar-head h2,
.account-profile h3,
.account-section h3 {
    margin: 0;
}

.account-sidebar-head h2 {
    font-size: 19px;
    font-weight: 800;
}

.sidebar-close {
    width: 36px;
    height: 36px;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    background: var(--input-bg);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.account-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    background: var(--input-bg);
    margin-bottom: 16px;
}

.account-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--blue);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}

.account-profile h3 {
    font-size: 16px;
    font-weight: 800;
    color: var(--text);
    line-height: 1.2;
}

.account-profile span {
    display: inline-flex;
    margin-top: 4px;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--blue-light);
    color: var(--blue);
    font-size: 11px;
    font-weight: 700;
}

.account-section {
    margin-bottom: 16px;
}

.account-section h3 {
    font-size: 13px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 10px;
}

.account-data-list {
    border: 1px solid var(--input-border);
    border-radius: 8px;
    overflow: hidden;
}

.account-data-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 12px;
    border-bottom: 1px solid var(--input-border);
    background: var(--card);
}

.account-data-row:last-child {
    border-bottom: 0;
}

.account-data-row span {
    font-size: 12px;
    color: var(--text-muted);
}

.account-data-row strong {
    font-size: 12px;
    color: var(--text);
    text-align: right;
    word-break: break-word;
}

.usage-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.usage-tile {
    padding: 14px;
    border-radius: 8px;
    border: 1px solid var(--input-border);
    background: var(--input-bg);
}

.usage-tile span {
    display: block;
    font-size: 22px;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
}

.usage-tile small {
    display: block;
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
}

.upgrade-panel {
    border-radius: 8px;
    padding: 16px;
    background: linear-gradient(135deg, var(--blue), #2ecc71);
    color: #fff;
}

.upgrade-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.upgrade-panel-head span {
    font-size: 12px;
    font-weight: 700;
    opacity: 0.9;
}

.upgrade-panel-head strong {
    font-size: 18px;
}

.upgrade-panel ul {
    list-style: none;
    margin: 0 0 14px;
    padding: 0;
}

.upgrade-panel li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 12px;
    line-height: 1.4;
    margin-bottom: 8px;
}

.upgrade-panel li svg {
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
    margin-top: 1px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.upgrade-panel .btn {
    width: 100%;
    background: #fff;
    color: var(--blue);
    border: 0;
}

@media (max-width: 480px) {
    .account-sidebar {
        width: 100%;
        padding: 18px;
    }
}

/* ===== UPLOAD SECTION (Admin) ===== */
.upload-area {
    border: 2px dashed var(--input-border);
    border-radius: var(--radius);
    padding: 28px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 14px;
}

.upload-area:hover {
    border-color: var(--blue);
    background: var(--blue-light);
}

body.dark .upload-area:hover {
    background: rgba(41,121,255,0.08);
}

.upload-area svg {
    width: 36px;
    height: 36px;
    color: var(--blue);
    margin-bottom: 8px;
}

.upload-area h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.upload-area p {
    font-size: 11px;
    color: var(--text-muted);
}

/* Upload Form */
.upload-form {
    display: none;
    margin-top: 14px;
}

.upload-form.show { display: block; }

/* Material Admin Row */
.mat-admin-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--input-bg);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}

.mat-admin-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.mat-admin-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mat-admin-meta {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 1px;
}

/* Premium Icon Tiles */
.btn-icon-tile {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-icon-tile:hover {
    transform: translateY(-2px);
    filter: brightness(0.95);
}

.btn-icon-tile:active {
    transform: scale(0.92);
}

.btn-icon-tile svg {
    flex-shrink: 0;
}

/* ===== RESPONSIVE REFINEMENTS ===== */
@media (max-width: 768px) {
    .auth-card { 
        padding: 24px 16px; 
        border-radius: 20px;
    }
    .field-row { grid-template-columns: 1fr; gap: 0; }
    .navbar { padding: 10px 16px; }
    .main-content { padding: 12px 10px; }
    
    .material-grid { 
        grid-template-columns: 1fr; 
        gap: 16px;
    }
    
    .mat-card {
        padding: 20px;
    }

    .user-row { 
        flex-direction: column; 
        align-items: flex-start; 
        gap: 12px; 
        padding: 14px;
    }
    .user-actions { 
        width: 100%; 
        display: flex;
        gap: 8px;
    }
    .user-actions .btn-sm { 
        flex: 1; 
        text-align: center; 
        justify-content: center;
    }
    
    .mat-modal-card {
        width: 100%;
        height: auto;
        max-height: 90vh;
        overflow-y: auto;
        padding: 24px 20px;
        margin-top: auto; /* Slide from bottom feel */
        border-radius: 24px 24px 0 0;
        animation: slideUp 0.3s ease;
    }
    
    .mat-modal-btns { 
        flex-direction: column; 
        gap: 10px;
    }
    
    .stats-row { 
        grid-template-columns: 1fr 1fr; 
        gap: 10px;
    }
}

@media (min-width: 601px) and (max-width: 1024px) {
    .material-grid { 
        grid-template-columns: repeat(2, 1fr); 
    }
}

@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@media (max-width: 480px) {
    .stat-box { padding: 12px 8px; }
    .stat-num { font-size: 20px; }
    .stat-label { font-size: 10px; }
    .nav-brand-mobile { font-size: 15px; }
}
/* ===== BOTTOM NAVIGATION (Android Style) ===== */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: var(--card);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.06);
    z-index: 1000;
    padding: 0 16px;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid var(--input-border);
}

@media (max-width: 768px) {
    .bottom-nav {
        display: flex;
        padding-bottom: var(--safe-bottom);
        min-height: calc(64px + var(--safe-bottom));
    }
    body {
        padding-bottom: calc(70px + var(--safe-bottom));
    }
    .main-content {
        padding-top: 10px;
    }
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
    flex: 1;
}

.nav-item.active {
    color: var(--blue);
}

.nav-item svg {
    width: 22px;
    height: 22px;
}

/* Floating Action Button */
.fab {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 56px;
    height: 56px;
    background: var(--blue);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(41, 121, 255, 0.4);
    z-index: 900;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
}

.fab:active {
    transform: scale(0.9);
}

.fab svg {
    width: 24px;
    height: 24px;
}

@media (min-width: 769px) {
    .fab { display: none; }
}

/* Scroll Hide for Mobile */
@media (max-width: 768px) {
    ::-webkit-scrollbar {
        display: none;
    }
    body {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }
}

/* Skeleton Loader */
.skeleton {
    background: linear-gradient(90deg, var(--input-bg) 25%, var(--input-border) 50%, var(--input-bg) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 8px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-card {
    height: 140px;
    background: var(--card);
    border: 1.5px solid var(--input-border);
    border-radius: var(--radius);
    padding: 20px;
}

.skeleton-title { width: 60%; height: 20px; margin-bottom: 12px; }
.skeleton-text { width: 90%; height: 14px; margin-bottom: 8px; }
.skeleton-meta { width: 40%; height: 12px; }

/* ===== VIDEO MODAL ===== */
.video-overlay {
    background: rgba(0, 0, 0, 0.75) !important;
    padding: 16px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
}

body.video-open {
    overflow: hidden;
}

.video-modal-card {
    background: #000;
    border-radius: 16px;
    padding: 0;
    width: min(92vw, 900px);
    max-width: 900px;
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    animation: popIn 0.3s ease;
    position: relative;
}

.video-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
    min-height: 0;
    padding-bottom: 0;
    overflow: hidden;
    background: #000;
    flex: 0 0 auto;
}

.video-container iframe,
.video-container video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

.video-container video {
    object-fit: contain;
    background: #000;
}

.video-error {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 24px;
    text-align: center;
    color: #fff;
    background: #111;
}

.video-error p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

.video-info {
    padding: 16px 20px;
    background: var(--card);
    border-top: 1px solid var(--input-border);
}

.video-info h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
    line-height: 1.4;
}

/* Mobile Video Modal */
@media (max-width: 768px) {
    .video-overlay {
        align-items: center !important;
        justify-content: center !important;
        padding: 12px !important;
    }

    .video-modal-card {
        width: 100%;
        max-width: 520px;
        max-height: calc(100vh - 24px);
        max-height: calc(100dvh - 24px);
        border-radius: 14px;
    }

    .video-container {
        aspect-ratio: 16 / 9;
        height: auto;
        max-height: calc(100vh - 92px);
        max-height: calc(100dvh - 92px);
        padding-bottom: 0;
        background: #000;
    }

    .video-container iframe {
        border: none;
    }

    .video-info {
        padding: 10px 14px;
        max-height: 72px;
        overflow-y: auto;
        background: #000;
        flex-shrink: 0;
    }

    .video-info h3 {
        font-size: 13px;
    }

    .video-modal-card .mat-modal-close {
        top: 8px !important;
        right: 8px !important;
        background: rgba(0, 0, 0, 0.5) !important;
        color: #fff !important;
        border-radius: 50%;
        width: 36px !important;
        height: 36px !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        border: none;
        padding: 0;
        z-index: 100;
    }

    .video-modal-card .mat-modal-close:hover {
        background: rgba(0, 0, 0, 0.8) !important;
    }
}

@media (orientation: landscape) and (max-height: 560px) {
    .video-overlay {
        padding: 8px !important;
    }

    .video-modal-card {
        width: 100%;
        max-width: calc(100vw - 16px);
        max-height: calc(100vh - 16px);
        max-height: calc(100dvh - 16px);
        border-radius: 12px;
    }

    .video-container {
        aspect-ratio: auto;
        height: calc(100vh - 58px);
        height: calc(100dvh - 58px);
        max-height: none;
    }

    .video-info {
        padding: 8px 48px 8px 12px;
        background: #000;
    }
}

/* Extra small phones (below 480px) */
@media (max-width: 480px) {
    .video-container {
        max-height: calc(100vh - 84px);
        max-height: calc(100dvh - 84px);
    }

    .video-info {
        max-height: 64px;
    }
}

/* ===== QUIZ MODAL ===== */
.quiz-overlay {
    background: rgba(0, 0, 0, 0.75) !important;
    padding: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quiz-modal-card {
    background: var(--card);
    border-radius: 16px;
    padding: 0;
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    animation: popIn 0.3s ease;
    position: relative;
}

.quiz-header {
    padding: 24px;
    background: linear-gradient(135deg, var(--blue), var(--blue-light));
    color: #fff;
    border-bottom: 1px solid var(--input-border);
}

.quiz-header h2 {
    margin: 0 0 16px 0;
    font-size: 20px;
    font-weight: 700;
}

.quiz-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
}

.progress-bar {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #fff;
    width: 20%;
    transition: width 0.3s ease;
}

.quiz-body {
    flex: 1;
    padding: 28px;
    overflow-y: auto;
}

.question-display {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 24px;
    line-height: 1.6;
}

.options-display {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.quiz-option {
    padding: 14px 16px;
    border: 2px solid var(--input-border);
    border-radius: 10px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    text-align: left;
}

.quiz-option:hover {
    border-color: var(--blue);
    background: rgba(41, 121, 255, 0.08);
}

.quiz-option.selected {
    border-color: var(--blue);
    background: rgba(41, 121, 255, 0.15);
    color: var(--blue);
}

.quiz-option.correct {
    border-color: #2ecc71;
    background: rgba(46, 204, 113, 0.15);
    color: #2ecc71;
}

.quiz-option.incorrect {
    border-color: #e74c3c;
    background: rgba(231, 76, 60, 0.15);
    color: #e74c3c;
}

.quiz-footer {
    padding: 16px 24px;
    background: var(--bg);
    border-top: 1px solid var(--input-border);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.btn-success {
    background: #2ecc71;
    color: #fff;
}

.btn-success:hover {
    background: #27ae60;
}

/* Mobile Quiz Modal */
@media (max-width: 768px) {
    .quiz-overlay {
        align-items: flex-end !important;
        justify-content: center !important;
        padding: 0 !important;
    }

    .quiz-modal-card {
        width: 100%;
        max-width: 100%;
        max-height: 100vh;
        border-radius: 12px 12px 0 0;
        animation: slideUp 0.3s ease;
    }

    .quiz-header {
        padding: 16px;
    }

    .quiz-header h2 {
        font-size: 16px;
        margin-bottom: 12px;
    }

    .quiz-body {
        padding: 20px;
        max-height: calc(100vh - 140px);
    }

    .question-display {
        font-size: 15px;
        margin-bottom: 20px;
    }

    .options-display {
        gap: 10px;
    }

    .quiz-option {
        padding: 12px 14px;
        font-size: 14px;
    }

    .quiz-footer {
        padding: 12px 16px;
        flex-wrap: wrap;
    }

    .btn {
        flex: 1;
        min-width: 100px;
    }
}

/* Extra small phones */
@media (max-width: 480px) {
    .quiz-header h2 {
        font-size: 14px;
    }

    .question-display {
        font-size: 14px;
    }

    .quiz-option {
        font-size: 13px;
        padding: 10px 12px;
    }

    .btn {
        padding: 8px 12px;
        font-size: 13px;
    }
}

/* Desktop Quiz Modal */
@media (min-width: 769px) {
    .video-modal-card {
        width: 85%;
        max-width: 900px;
    }

    .video-container {
        min-height: 500px;
    }
}

/* Micro-animations */
.btn:active, .nav-item:active, .mat-card:active, .btn-icon-tile:active {
    transform: scale(0.96);
}

.subject-section {
    animation: slideUp 0.4s ease forwards;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Smooth Image Loading */
img {
    transition: opacity 0.3s ease;
}

/* ===== PREMIUM AUTH REFRESH ===== */
.auth-body {
    min-height: 100vh;
    overflow-x: hidden;
    background:
        radial-gradient(120% 90% at 50% -20%, rgba(255, 255, 255, 0.9) 0%, rgba(248, 251, 255, 0) 48%),
        linear-gradient(135deg, #f8fbff 0%, #eef5ff 46%, #f7faf8 100%);
}

.auth-bg {
    inset: 0;
    height: auto;
    border-radius: 0;
    background:
        linear-gradient(115deg, rgba(41, 121, 255, 0.2) 0%, rgba(41, 121, 255, 0.08) 31%, rgba(255, 255, 255, 0) 58%),
        linear-gradient(245deg, rgba(46, 204, 113, 0.14) 0%, rgba(46, 204, 113, 0.04) 30%, rgba(255, 255, 255, 0) 54%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.78) 0%, rgba(237, 242, 248, 0.9) 100%);
    opacity: 1;
    overflow: hidden;
}

.auth-bg::before,
.auth-bg::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.auth-bg::before {
    background:
        linear-gradient(120deg, transparent 0 19%, rgba(255, 255, 255, 0.74) 19.1% 31%, transparent 31.1% 100%),
        linear-gradient(120deg, transparent 0 56%, rgba(41, 121, 255, 0.09) 56.1% 69%, transparent 69.1% 100%),
        linear-gradient(120deg, transparent 0 76%, rgba(243, 156, 18, 0.08) 76.1% 86%, transparent 86.1% 100%);
    transform: skewY(-7deg) translateY(-12vh);
    transform-origin: top left;
}

.auth-bg::after {
    background-image:
        linear-gradient(rgba(26, 26, 46, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(26, 26, 46, 0.045) 1px, transparent 1px);
    background-size: 54px 54px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.54), transparent 68%);
    -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.54), transparent 68%);
}

body.dark .auth-bg {
    background:
        linear-gradient(115deg, rgba(41, 121, 255, 0.22) 0%, rgba(41, 121, 255, 0.08) 34%, rgba(16, 25, 35, 0) 58%),
        linear-gradient(245deg, rgba(46, 204, 113, 0.12) 0%, rgba(46, 204, 113, 0.04) 31%, rgba(16, 25, 35, 0) 55%),
        linear-gradient(180deg, rgba(18, 31, 44, 0.96) 0%, rgba(15, 25, 35, 0.98) 100%);
}

body.dark.auth-body {
    background:
        radial-gradient(120% 90% at 50% -20%, rgba(41, 121, 255, 0.16) 0%, rgba(15, 25, 35, 0) 50%),
        linear-gradient(135deg, #101923 0%, #0f1923 48%, #111d1c 100%);
}

body.dark .auth-bg::before {
    background:
        linear-gradient(120deg, transparent 0 19%, rgba(255, 255, 255, 0.06) 19.1% 31%, transparent 31.1% 100%),
        linear-gradient(120deg, transparent 0 56%, rgba(41, 121, 255, 0.12) 56.1% 69%, transparent 69.1% 100%),
        linear-gradient(120deg, transparent 0 76%, rgba(243, 156, 18, 0.07) 76.1% 86%, transparent 86.1% 100%);
}

body.dark .auth-bg::after {
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
}

.auth-container {
    align-items: center;
    justify-content: center;
    gap: 42px;
    padding: 40px 20px;
}

.auth-showcase {
    width: min(500px, 100%);
    color: var(--text);
    text-shadow: none;
}

.auth-mark {
    width: 62px;
    height: 62px;
    border-radius: 18px;
    padding: 8px;
    margin-bottom: 24px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.86);
    box-shadow: 0 18px 42px rgba(8, 25, 42, 0.14);
    backdrop-filter: blur(18px);
}

.auth-mark img {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    display: block;
}

.auth-showcase h1 {
    font-size: clamp(34px, 6vw, 58px);
    line-height: 1.03;
    letter-spacing: 0;
    margin-bottom: 18px;
}

.auth-showcase p {
    max-width: 460px;
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.8;
}

.auth-highlights {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
}

.auth-highlights span {
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.64);
    border: 1px solid rgba(255, 255, 255, 0.84);
    box-shadow: 0 12px 30px rgba(8, 25, 42, 0.08);
    font-size: 12px;
    font-weight: 700;
}

.auth-card {
    background: rgba(255, 255, 255, 0.76);
    border: 1px solid rgba(255, 255, 255, 0.72);
    box-shadow: 0 24px 70px rgba(8, 25, 42, 0.24);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
}

body.dark .auth-card {
    background: rgba(26, 38, 54, 0.72);
    border-color: rgba(255, 255, 255, 0.1);
}

.auth-badge {
    border-radius: 14px;
    background: linear-gradient(135deg, var(--blue), var(--success));
    letter-spacing: 0;
}

.input-box input,
.input-box select {
    border-radius: 14px;
}

.btn {
    border-radius: 14px;
}

.role-choice {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 4px;
    margin-bottom: 16px;
    border-radius: 14px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
}

.role-choice label {
    cursor: pointer;
}

.role-choice input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.role-choice span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
}

.role-choice input:checked + span {
    background: var(--blue);
    color: #fff;
    box-shadow: 0 8px 20px rgba(41, 121, 255, 0.22);
}

@media (max-width: 900px) {
    .auth-container {
        display: block;
        padding: 24px 16px;
    }

    .auth-showcase {
        max-width: 420px;
        margin: 0 auto 22px;
    }

    .auth-showcase h1 {
        font-size: 30px;
    }

    .auth-showcase p {
        font-size: 13px;
    }

    .auth-mark,
    .auth-highlights {
        display: none;
    }

    .auth-card {
        margin: 0 auto;
    }
}

@media (max-width: 600px) {
    body.auth-body {
        display: block;
        padding-bottom: 0;
        min-height: 100vh;
        min-height: 100dvh;
    }

    .auth-body .auth-bg {
        background:
            linear-gradient(145deg, rgba(41, 121, 255, 0.18) 0%, rgba(41, 121, 255, 0.06) 38%, rgba(255, 255, 255, 0) 62%),
            linear-gradient(245deg, rgba(46, 204, 113, 0.1) 0%, rgba(46, 204, 113, 0.03) 36%, rgba(255, 255, 255, 0) 62%),
            linear-gradient(180deg, rgba(255, 255, 255, 0.86) 0%, rgba(237, 242, 248, 0.94) 100%);
    }

    .auth-body .auth-bg::before {
        background:
            linear-gradient(125deg, transparent 0 12%, rgba(255, 255, 255, 0.72) 12.1% 34%, transparent 34.1% 100%),
            linear-gradient(125deg, transparent 0 67%, rgba(41, 121, 255, 0.08) 67.1% 84%, transparent 84.1% 100%);
        transform: skewY(-10deg) translateY(-8vh);
    }

    .auth-body .auth-bg::after {
        background-size: 38px 38px;
        mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.34), transparent 58%);
        -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.34), transparent 58%);
    }

    body.dark.auth-body .auth-bg {
        background:
            linear-gradient(145deg, rgba(41, 121, 255, 0.2) 0%, rgba(41, 121, 255, 0.06) 38%, rgba(15, 25, 35, 0) 62%),
            linear-gradient(245deg, rgba(46, 204, 113, 0.1) 0%, rgba(46, 204, 113, 0.03) 36%, rgba(15, 25, 35, 0) 62%),
            linear-gradient(180deg, rgba(18, 31, 44, 0.96) 0%, rgba(15, 25, 35, 0.98) 100%);
    }

    .auth-container {
        width: 100%;
        min-height: 100vh;
        min-height: 100dvh;
        padding: 14px 12px 18px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .auth-showcase {
        display: none;
    }

    .auth-card {
        width: min(100%, 390px);
        max-width: 390px;
        padding: 20px 14px;
        border-radius: 18px;
        max-height: calc(100dvh - 28px);
        overflow-y: auto;
        box-shadow: 0 18px 46px rgba(8, 25, 42, 0.22);
    }

    .auth-top {
        margin-bottom: 14px;
    }

    .brand-title {
        font-size: 21px;
        line-height: 1.2;
        display: flex;
        align-items: center;
        min-width: 0;
    }

    .brand-title img {
        width: 28px !important;
        height: 28px !important;
        flex: 0 0 28px;
    }

    .theme-toggle {
        width: 36px;
        height: 36px;
        flex: 0 0 36px;
    }

    .auth-badge {
        margin-bottom: 16px;
        padding: 9px 10px;
        font-size: 9px;
        line-height: 1.35;
        border-radius: 12px;
    }

    .field {
        margin-bottom: 12px;
    }

    .field label {
        font-size: 11px;
        margin-bottom: 5px;
    }

    .field-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .input-box input,
    .input-box select {
        min-height: 46px;
        padding-top: 12px;
        padding-bottom: 12px;
        font-size: 14px;
        border-radius: 13px;
    }

    .btn {
        min-height: 46px;
        padding: 12px;
        font-size: 14px;
        border-radius: 13px;
    }

    .role-choice {
        margin-bottom: 12px;
    }

    .role-choice span {
        min-height: 36px;
        font-size: 12px;
    }

    .auth-note {
        margin-top: 12px;
        font-size: 11px;
    }

    .auth-divider {
        margin: 14px 0;
    }

    .toast-box {
        left: 12px;
        right: 12px;
        top: 12px;
    }

    .toast {
        min-width: 0;
        max-width: none;
        width: 100%;
    }
}

@media (max-width: 360px) {
    .auth-container {
        padding: 10px 8px 14px;
    }

    .auth-card {
        padding: 18px 12px;
        max-height: calc(100dvh - 20px);
    }

    .brand-title {
        font-size: 19px;
    }
}
/* ===== STACK GRID ===== */
.stack-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
}

.stack-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stack-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stack-value {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    position: relative;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    margin-left: auto;
    transition: all 0.3s;
}

.status-dot.online {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.status-dot.offline {
    background: var(--error);
    box-shadow: 0 0 8px var(--error);
}

.stack-value img {
    filter: grayscale(0.5);
    transition: filter 0.3s;
}

.stack-item:hover .stack-value img {
    filter: grayscale(0);
}

/* Premium Enhancements */
.section-card, .welcome-card, .stat-box, .mat-card, .user-row {
    transition: var(--transition);
}

.mat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 35px rgba(41, 121, 255, 0.1);
}

.stat-box:hover {
    transform: scale(1.02);
}

/* Glassmorphism for floating elements */
.fab {
    background: var(--blue);
    color: #fff;
    box-shadow: 0 8px 25px rgba(41, 121, 255, 0.4);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--input-border);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Premium Welcome Card */
.welcome-card {
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.welcome-card * {
    position: relative;
    z-index: 2;
}

.welcome-card::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(41, 121, 255, 0.08) 0%, transparent 70%);
    animation: rotateBg 15s linear infinite;
    z-index: 0;
    pointer-events: none;
}

@keyframes rotateBg {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.premium-badge {
    position: absolute;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #fff !important;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    box-shadow: 0 4px 10px rgba(255, 215, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 3;
}

.nav-user-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.2;
}

.nav-user-copy small {
    max-width: 180px;
    overflow: hidden;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-upload-trigger {
    border: 0;
    cursor: pointer;
    padding: 0;
}

.profile-edit-btn {
    width: 100%;
    margin: 12px 0 4px;
}

.avatar-circle.has-image,
.account-avatar.has-image {
    overflow: hidden;
    padding: 0;
}

.avatar-circle.has-image img,
.account-avatar.has-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ===== FORM UI POLISH ===== */
.modern-upload-area {
    display: grid;
    place-items: center;
    gap: 10px;
    min-height: 172px;
    margin-bottom: 20px;
    padding: 34px 20px;
    border: 1.5px dashed rgba(41, 121, 255, 0.55);
    border-radius: 18px;
    background:
        linear-gradient(135deg, rgba(41, 121, 255, 0.1), rgba(46, 204, 113, 0.06)),
        var(--card);
    color: var(--blue);
    cursor: pointer;
    text-align: center;
}

.modern-upload-area:hover {
    border-color: var(--blue);
    transform: translateY(-1px);
    box-shadow: 0 14px 34px rgba(41, 121, 255, 0.12);
}

.modern-upload-area svg {
    width: 42px !important;
    height: 42px !important;
    margin-bottom: 2px !important;
}

.modern-upload-area h3 {
    font-size: 15px;
    font-weight: 700;
}

.modern-upload-form {
    margin-bottom: 20px;
    padding: 22px;
    border: 1px solid var(--input-border);
    border-radius: 18px;
    background: var(--card);
}

.material-upload-form,
.edit-profile-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.form-grid,
.profile-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.profile-image-field {
    grid-column: 1 / -1;
}

.material-upload-form .field,
.edit-profile-form .field {
    margin-bottom: 0;
}

.material-upload-form .field label,
.edit-profile-form .field label,
.quiz-builder-head label,
.question-card-head label {
    margin: 0 0 7px;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

input.input-box,
select.input-box,
textarea.input-box {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    border: 1.5px solid var(--input-border);
    border-radius: 14px;
    background: var(--input-bg);
    color: var(--text);
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 500;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

select.input-box {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
        linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
    background-position:
        calc(100% - 18px) 20px,
        calc(100% - 13px) 20px;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    padding-right: 36px;
}

input.input-box:focus,
select.input-box:focus,
textarea.input-box:focus {
    border-color: var(--blue);
    background: var(--card);
    box-shadow: 0 0 0 4px rgba(41, 121, 255, 0.1);
}

.file-input {
    min-height: 54px;
    padding: 10px;
}

.file-input::file-selector-button {
    margin-right: 12px;
    padding: 10px 14px;
    border: 0;
    border-radius: 11px;
    background: var(--blue);
    color: #fff;
    font-family: 'Poppins', sans-serif;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.quiz-builder {
    padding: 16px;
    border: 1px solid var(--input-border);
    border-radius: 16px;
    background: var(--input-bg);
}

.quiz-builder-head,
.question-card-head,
.form-actions,
.mat-modal-btns {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: space-between;
}

.questions-container {
    display: grid;
    gap: 12px;
    max-height: 420px;
    overflow-y: auto;
    padding-right: 4px;
}

.question-input-group {
    display: grid;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--input-border);
    border-radius: 16px;
    background: var(--card);
}

.options-grid,
.answer-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.btn-inline {
    width: auto;
    min-height: 36px;
    padding: 8px 12px;
    border-radius: 11px;
    font-size: 12px;
    flex: 0 0 auto;
}

.form-actions .btn,
.mat-modal-btns .btn {
    width: auto;
    min-width: 120px;
}

.edit-profile-form {
    margin-top: 10px;
}

@media (max-width: 700px) {
    .form-grid,
    .profile-form-grid,
    .options-grid,
    .answer-grid {
        grid-template-columns: 1fr;
    }

    .modern-upload-form {
        padding: 16px;
    }

    .quiz-builder-head,
    .form-actions,
    .mat-modal-btns {
        align-items: stretch;
        flex-direction: column;
    }

    .form-actions .btn,
    .mat-modal-btns .btn,
    .btn-inline {
        width: 100%;
    }
}

/* ===== RESPONSIVE PROFILE UI ===== */
.account-profile {
    align-items: center;
    min-width: 0;
}

.account-profile > div:last-child,
.nav-user-copy {
    min-width: 0;
}

.account-profile h3,
.account-profile span,
.nav-user-copy span,
.nav-user-copy small,
#userName,
#welcomeMeta {
    overflow-wrap: anywhere;
}

.account-profile h3,
.nav-user-copy span,
#userName {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-avatar {
    width: 74px;
    height: 74px;
    flex: 0 0 74px;
    border-radius: 50%;
}

.avatar-circle {
    flex: 0 0 34px;
}

#editProfileModal {
    align-items: center;
    padding: 18px;
}

#editProfileModal .mat-modal-card {
    width: min(100%, 640px);
    max-height: min(760px, calc(100dvh - 36px));
    overflow-y: auto;
}

#editProfileModal .mat-modal-head {
    padding-right: 34px;
}

#editProfileModal .mat-modal-head h2 {
    overflow-wrap: anywhere;
}

#editProfileModal .profile-form-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
}

#editProfileModal input.input-box,
#editProfileModal select.input-box,
#editProfileModal .file-input {
    min-width: 0;
}

.account-data-row {
    gap: 12px;
}

.account-data-row strong {
    min-width: 0;
    overflow-wrap: anywhere;
    text-align: right;
}

@media (min-width: 901px) {
    #editProfileModal .mat-modal-card {
        padding: 26px;
    }

    #editProfileModal input.input-box,
    #editProfileModal select.input-box {
        min-height: 50px;
    }
}

@media (max-width: 900px) {
    #editProfileModal .mat-modal-card {
        width: min(100%, 560px);
    }

    .account-avatar {
        width: 66px;
        height: 66px;
        flex-basis: 66px;
    }
}

@media (max-width: 700px) {
    #editProfileModal {
        align-items: flex-end;
        padding: 10px;
    }

    #editProfileModal .mat-modal-card {
        width: 100%;
        max-height: calc(100dvh - 20px);
        border-radius: 18px;
        padding: 18px;
    }

    #editProfileModal .profile-form-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    #editProfileModal input.input-box,
    #editProfileModal select.input-box,
    #editProfileModal .file-input {
        min-height: 46px;
        font-size: 14px;
    }

    .file-input::file-selector-button {
        margin-right: 8px;
        padding: 9px 11px;
    }

    .account-profile {
        gap: 12px;
    }

    .account-avatar {
        width: 58px;
        height: 58px;
        flex-basis: 58px;
    }

    .account-data-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }

    .account-data-row strong {
        width: 100%;
        text-align: left;
    }
}

@media (max-width: 420px) {
    #editProfileModal {
        padding: 0;
    }

    #editProfileModal .mat-modal-card {
        max-height: 100dvh;
        border-radius: 18px 18px 0 0;
    }

    .profile-edit-btn {
        min-height: 44px;
    }

    .account-avatar {
        width: 52px;
        height: 52px;
        flex-basis: 52px;
    }

    .file-input {
        white-space: normal;
    }
}

/* Compact nav uses the profile picture as the account entry. */
@media (max-width: 768px) {
    .navbar .nav-right .nav-user {
        display: flex !important;
        align-items: center;
        flex: 0 0 auto;
        gap: 0;
        margin-left: 0 !important;
    }

    .navbar .nav-right .nav-user > span,
    .navbar .nav-right .nav-user .nav-user-copy {
        display: none !important;
    }

    .navbar .nav-user .avatar-circle {
        display: flex !important;
        width: 40px;
        height: 40px;
        flex: 0 0 40px;
        cursor: pointer;
        font-size: 14px;
    }
}

/* ===== SOFT MOTION LAYER ===== */
@keyframes softFadeUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes softScaleIn {
    from {
        opacity: 0;
        transform: scale(0.985) translateY(8px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes softFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-3px);
    }
}

.navbar,
.bottom-nav {
    animation: softFadeUp 0.42s ease both;
}

.auth-card,
.welcome-card,
.section-card,
.account-sidebar,
.mat-modal-card,
.video-modal-card {
    animation: softScaleIn 0.46s ease both;
}

.stat-box,
.mat-card,
.user-row,
.subject-card,
.admin-card,
.material-card {
    animation: softFadeUp 0.42s ease both;
}

.stat-box:nth-child(2),
.mat-card:nth-child(2),
.user-row:nth-child(2),
.subject-card:nth-child(2),
.admin-card:nth-child(2),
.material-card:nth-child(2) {
    animation-delay: 0.04s;
}

.stat-box:nth-child(3),
.mat-card:nth-child(3),
.user-row:nth-child(3),
.subject-card:nth-child(3),
.admin-card:nth-child(3),
.material-card:nth-child(3) {
    animation-delay: 0.08s;
}

.stat-box:nth-child(4),
.mat-card:nth-child(4),
.user-row:nth-child(4),
.subject-card:nth-child(4),
.admin-card:nth-child(4),
.material-card:nth-child(4) {
    animation-delay: 0.12s;
}

.btn,
.btn-logout,
.btn-account,
.btn-icon-tile,
.nav-item,
.fab,
.fav-btn {
    transition:
        transform 0.22s ease,
        box-shadow 0.22s ease,
        background-color 0.22s ease,
        border-color 0.22s ease,
        color 0.22s ease,
        opacity 0.22s ease;
}

.btn:hover,
.btn-logout:hover,
.btn-account:hover,
.btn-icon-tile:hover,
.nav-item:hover,
.fab:hover,
.fav-btn:hover {
    transform: translateY(-1px);
}

.btn:active,
.btn-logout:active,
.btn-account:active,
.btn-icon-tile:active,
.nav-item:active,
.fab:active,
.fav-btn:active {
    transform: translateY(0) scale(0.98);
}

.logo-wrap,
.blue-badge,
.mat-icon-box,
.stat-icon,
.avatar-circle {
    animation: softFloat 4.5s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.001ms !important;
    }
}

/* ===== CAPACITOR ANDROID APP POLISH ===== */
:root {
    --app-viewport-height: 100dvh;
    --android-nav-height: 72px;
}

html.native-android-app {
    height: var(--app-viewport-height);
    overflow: hidden;
    overscroll-behavior: none;
}

body.native-android-app {
    height: var(--app-viewport-height);
    min-height: var(--app-viewport-height);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    -webkit-font-smoothing: antialiased;
    -webkit-touch-callout: none;
    touch-action: manipulation;
}

.native-android-app .navbar {
    top: 0;
    min-height: calc(60px + var(--safe-top));
    padding: var(--safe-top) max(14px, var(--safe-right)) 0 max(14px, var(--safe-left));
    border-radius: 0;
    box-shadow: 0 6px 18px rgba(8, 25, 42, 0.08);
}

.native-android-app .main-content {
    width: 100%;
    max-width: 720px;
    padding: 14px max(12px, var(--safe-right)) calc(var(--android-nav-height) + var(--safe-bottom) + 18px) max(12px, var(--safe-left));
}

.native-android-app .bottom-nav {
    display: flex;
    min-height: calc(var(--android-nav-height) + var(--safe-bottom));
    padding: 6px max(8px, var(--safe-right)) calc(6px + var(--safe-bottom)) max(8px, var(--safe-left));
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -10px 28px rgba(8, 25, 42, 0.12);
}

.native-android-app .nav-item {
    min-height: 56px;
    border-radius: 16px;
    justify-content: center;
}

.native-android-app .nav-item.active {
    background: var(--blue-light);
}

.native-android-app.dark .nav-item.active,
body.dark.native-android-app .nav-item.active {
    background: rgba(41, 121, 255, 0.14);
}

.native-android-app .fab {
    right: max(16px, var(--safe-right));
    bottom: calc(var(--android-nav-height) + var(--safe-bottom) + 18px);
    width: 48px;
    height: 48px;
    box-shadow: 0 10px 26px rgba(41, 121, 255, 0.32);
}

.native-android-app .welcome-card,
.native-android-app .section-card,
.native-android-app .stat-box,
.native-android-app .mat-card,
.native-android-app .user-row {
    border-radius: 16px;
    box-shadow: 0 8px 26px rgba(8, 25, 42, 0.06);
}

.native-android-app .material-grid {
    grid-template-columns: 1fr;
    gap: 12px;
}

.native-android-app .mat-card {
    padding: 16px;
}

.native-android-app .btn,
.native-android-app .btn-logout,
.native-android-app .btn-account,
.native-android-app .btn-icon-tile,
.native-android-app button,
.native-android-app .tab-btn,
.native-android-app .subject-back-btn {
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
}

.native-android-app input,
.native-android-app select,
.native-android-app textarea,
.native-android-app .input-box,
.native-android-app input.input-box,
.native-android-app select.input-box,
.native-android-app textarea.input-box {
    font-size: 16px;
}

.native-android-app .popup-overlay,
.native-android-app .video-overlay,
.native-android-app .quiz-overlay {
    padding: calc(10px + var(--safe-top)) max(10px, var(--safe-right)) calc(10px + var(--safe-bottom)) max(10px, var(--safe-left));
}

.native-android-app .mat-modal-card,
.native-android-app #editProfileModal .mat-modal-card {
    width: 100%;
    max-height: calc(var(--app-viewport-height) - var(--safe-top) - var(--safe-bottom) - 20px);
    border-radius: 18px;
    padding: 18px;
}

.native-android-app .account-sidebar {
    width: min(92vw, 380px);
    height: var(--app-viewport-height);
    padding: calc(18px + var(--safe-top)) 18px calc(18px + var(--safe-bottom));
}

body.native-android-app.auth-body {
    min-height: var(--app-viewport-height);
    padding-bottom: 0;
}

.native-android-app .auth-container {
    min-height: var(--app-viewport-height);
    padding: calc(12px + var(--safe-top)) 12px calc(16px + var(--safe-bottom));
}

.native-android-app .auth-card {
    width: min(100%, 400px);
    max-height: calc(var(--app-viewport-height) - var(--safe-top) - var(--safe-bottom) - 24px);
    overflow-y: auto;
    border-radius: 20px;
}

.native-android-app .toast-container {
    top: calc(14px + var(--safe-top));
    right: max(12px, var(--safe-right));
    left: max(12px, var(--safe-left));
}

.native-android-app .toast {
    width: 100%;
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
}

@media (hover: none) and (pointer: coarse) {
    .native-android-app .btn:hover,
    .native-android-app .btn-logout:hover,
    .native-android-app .btn-account:hover,
    .native-android-app .btn-icon-tile:hover,
    .native-android-app .nav-item:hover,
    .native-android-app .fab:hover,
    .native-android-app .fav-btn:hover,
    .native-android-app .mat-card:hover {
        transform: none;
    }

    .native-android-app .mat-card:hover {
        border-color: var(--input-border);
        box-shadow: 0 8px 26px rgba(8, 25, 42, 0.06);
    }
}

@media (max-width: 380px) {
    .native-android-app .main-content {
        padding-left: max(10px, var(--safe-left));
        padding-right: max(10px, var(--safe-right));
    }

    .native-android-app .nav-item span {
        font-size: 10px;
    }
}
