/* ============================================
   SYNEX TUTOR — style.css
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #4361ee;
    --primary-light: #6366f1;
    --primary-dark: #3730a3;
    --primary-glow: rgba(67, 97, 238, 0.15);
    --success: #2dc653;
    --success-light: #d1fae5;
    --warning: #f4a261;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-hover: #f8f9fc;
    --border: #e5e7eb;
    --text: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --secondary: #f1f5f9;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1);
    --radius: 12px;
    --radius-sm: 8px;
    --sidebar-width: 260px;
    --sidebar-collapsed: 68px;
    --transition: 0.25s cubic-bezier(.4, 0, .2, 1);
}

body.dark-mode {
    --bg: #0f172a;
    --surface: #1e293b;
    --surface-hover: #334155;
    --border: #334155;
    --text: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --secondary: #1e293b;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    cursor: pointer;
    border: none;
    font-family: inherit;
}

input,
select,
textarea {
    font-family: inherit;
}

/* ============================================
   AUTH OVERLAY — Figma Minimal Login Design
   ============================================ */
.auth-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: #ffffff;
    display: flex;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s cubic-bezier(.4, 0, .2, 1);
    overflow: hidden;
}

.auth-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* ---- Left Panel: Welcome + Form ---- */
.login-left {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    padding: 60px 80px;
}

.login-form-wrap {
    width: 100%;
    max-width: 420px;
    animation: formSlideIn 0.9s cubic-bezier(.16, 1, .3, 1) forwards;
    opacity: 0;
}

@keyframes formSlideIn {
    from {
        transform: translateX(-40px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.login-welcome-title {
    font-family: 'Poppins', sans-serif;
    font-weight: 800;
    font-size: clamp(42px, 6vw, 64px);
    color: #1c1c1c;
    margin-bottom: 36px;
    line-height: 1;
    letter-spacing: -1px;
}

/* ---- Inputs ---- */
.login-input-group {
    position: relative;
    margin-bottom: 16px;
    opacity: 0;
    animation: inputFadeUp 0.7s cubic-bezier(.16, 1, .3, 1) forwards;
}

.anim-stagger-1 {
    animation-delay: 0.3s;
}

.anim-stagger-2 {
    animation-delay: 0.45s;
}

.anim-stagger-3 {
    animation-delay: 0.6s;
}

@keyframes inputFadeUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.login-input-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(28, 28, 28, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s;
    z-index: 2;
}

.login-input-group:focus-within .login-input-icon {
    color: #1c1c1c;
}

.login-input {
    width: 100%;
    padding: 18px 20px 18px 54px;
    font-family: 'Poppins', sans-serif;
    font-size: 16px;
    font-weight: 400;
    color: #1c1c1c;
    background: #f2f2f2;
    border: 2px solid transparent;
    border-radius: 50px;
    outline: none;
    transition: all 0.35s cubic-bezier(.4, 0, .2, 1);
}

.login-input::placeholder {
    color: rgba(28, 28, 28, 0.3);
    font-weight: 400;
}

.login-input:focus {
    background: #fff;
    border-color: #1c1c1c;
    box-shadow: 0 0 0 4px rgba(28, 28, 28, 0.06);
}

/* Password toggle eye */
.login-eye-btn {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(28, 28, 28, 0.3);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s;
    z-index: 2;
}

.login-eye-btn:hover {
    color: #1c1c1c;
}

/* ---- Login Button ---- */
.login-btn {
    width: 100%;
    max-width: 280px;
    padding: 18px 28px;
    margin-top: 20px;
    font-family: 'Poppins', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    background: #1c1c1c;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
    transition: all 0.35s cubic-bezier(.4, 0, .2, 1);
    opacity: 0;
    animation: inputFadeUp 0.7s cubic-bezier(.16, 1, .3, 1) forwards;
}

.login-btn:hover {
    background: #333;
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(28, 28, 28, 0.25);
}

.login-btn:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 4px 16px rgba(28, 28, 28, 0.15);
}

/* Ripple effect */
.login-btn::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.2) 0%, transparent 60%);
    transform: scale(0);
    transition: transform 0.5s;
    border-radius: inherit;
}

.login-btn:active::after {
    transform: scale(2.5);
    transition: transform 0s;
}

/* ---- Right Panel: Hero Image ---- */
.login-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    padding: 40px;
}

.login-hero-image {
    width: 100%;
    max-width: 520px;
    aspect-ratio: 1 / 1;
    border-radius: 36px;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.12);
    animation: imageSlideIn 1s cubic-bezier(.16, 1, .3, 1) 0.2s forwards;
    opacity: 0;
}

@keyframes imageSlideIn {
    from {
        transform: translateX(50px) scale(0.95);
        opacity: 0;
    }

    to {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

.login-hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.6s cubic-bezier(.4, 0, .2, 1);
}

.login-hero-image:hover img {
    transform: scale(1.03);
}

/* ---- Auth Responsive ---- */
@media (max-width: 960px) {
    .auth-overlay {
        flex-direction: column;
    }

    .login-left {
        flex: none;
        padding: 40px 30px 20px;
    }

    .login-welcome-title {
        font-size: 42px;
        margin-bottom: 24px;
    }

    .login-right {
        flex: none;
        padding: 20px 30px 40px;
        order: -1;
    }

    .login-hero-image {
        max-width: 280px;
        border-radius: 28px;
    }

    @keyframes formSlideIn {
        from {
            transform: translateY(30px);
            opacity: 0;
        }

        to {
            transform: translateY(0);
            opacity: 1;
        }
    }

    @keyframes imageSlideIn {
        from {
            transform: translateY(-30px) scale(0.95);
            opacity: 0;
        }

        to {
            transform: translateY(0) scale(1);
            opacity: 1;
        }
    }
}

@media (max-width: 480px) {
    .login-left {
        padding: 24px 20px 16px;
    }

    .login-welcome-title {
        font-size: 36px;
    }

    .login-right {
        padding: 16px 20px;
    }

    .login-hero-image {
        max-width: 200px;
        border-radius: 24px;
    }

    .login-input {
        padding: 16px 18px 16px 48px;
        font-size: 15px;
        border-radius: 40px;
    }

    .login-btn {
        padding: 16px 24px;
        font-size: 16px;
        max-width: 100%;
    }
}


/* ============================================
   FORMS
   ============================================ */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    transition: border-color .2s, box-shadow .2s;
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    transition: all .2s;
    border: 1.5px solid transparent;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(67, 97, 238, .3);
}

.btn-secondary {
    background: var(--secondary);
    color: var(--text);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: var(--surface-hover);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary-glow);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 15px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-icon-only {
    padding: 6px 10px;
}

.btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.checkbox-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.checkbox-label,
.subject-checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    transition: background .2s;
}

.checkbox-label:hover,
.subject-checkbox-label:hover {
    background: var(--primary-glow);
}

/* ============================================
   APP LAYOUT
   ============================================ */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: width var(--transition);
    overflow: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar.collapsed .link-name,
.sidebar.collapsed .logo-name,
.sidebar.collapsed .sidebar-profile-name {
    display: none;
}

.sidebar.collapsed .sidebar-avatar {
    width: 36px;
    height: 36px;
    font-size: 12px;
}

.sidebar-top {
    padding: 18px 16px 12px;
    border-bottom: 1px solid var(--border);
}

.hamburger-btn {
    background: none;
    font-size: 22px;
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: .2s;
}

.hamburger-btn:hover {
    background: var(--secondary);
    color: var(--primary);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
}

.logo-container .icon {
    font-size: 28px;
    color: var(--primary);
}

.logo-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

.sidebar-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
}

.sidebar-avatar {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #4361ee, #6366f1);
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
    font-size: 15px;
    overflow: hidden;
    flex-shrink: 0;
}

.sidebar-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sidebar-profile-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-list {
    list-style: none;
    flex: 1;
    overflow-y: auto;
    padding: 12px 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: all .2s;
    margin-bottom: 2px;
}

.nav-link .icon {
    font-size: 20px;
    min-width: 22px;
    text-align: center;
}

.nav-link:hover {
    background: var(--primary-glow);
    color: var(--primary);
}

.nav-link.active {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(67, 97, 238, .25);
}

.nav-link.active .icon {
    color: #fff;
}

.sidebar-bottom {
    padding: 12px 8px;
    border-top: 1px solid var(--border);
}

.logout-btn {
    color: var(--danger) !important;
}

.logout-btn:hover {
    background: var(--danger-light) !important;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left var(--transition);
    display: flex;
    flex-direction: column;
}

.sidebar.collapsed~.main-content {
    margin-left: var(--sidebar-collapsed);
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 28px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-title h1 {
    font-size: 20px;
    font-weight: 700;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.header-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--secondary);
    border-radius: var(--radius-sm);
    padding: 7px 14px;
}

.header-search i {
    color: var(--text-muted);
    font-size: 18px;
}

.header-search input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    color: var(--text);
    width: 140px;
}

.header-icon-btn {
    position: relative;
    background: var(--secondary);
    border: none;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--text-muted);
    transition: .2s;
}

.header-icon-btn:hover {
    background: var(--primary-glow);
    color: var(--primary);
}

.time-display {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-name-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.header-avatar {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ============================================
   NOTIFICATION DROPDOWN
   ============================================ */
.notif-wrapper {
    position: relative;
}

.notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.notif-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 360px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    display: none;
    z-index: 1000;
    max-height: 420px;
    overflow: hidden;
}

.notif-dropdown.active {
    display: block;
    animation: fadeIn .15s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.notif-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.notif-dropdown-header h4 {
    font-size: 15px;
    font-weight: 700;
}

.notif-dropdown-body {
    max-height: 340px;
    overflow-y: auto;
    padding: 4px 0;
}

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    transition: background .15s;
    cursor: pointer;
}

.notif-item:hover {
    background: var(--secondary);
}

.notif-item.unread {
    background: var(--primary-glow);
}

.notif-icon {
    font-size: 20px;
    color: var(--primary);
    margin-top: 2px;
}

.notif-content p {
    font-size: 13px;
    color: var(--text);
    line-height: 1.4;
}

.notif-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.notif-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 32px;
    font-size: 13px;
}

/* ============================================
   VIEWS
   ============================================ */
.views-container {
    padding: 24px 28px;
    flex: 1;
}

.view {
    display: none;
    animation: viewFade .3s;
}

.view.active {
    display: block;
}

@keyframes viewFade {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.view-header h2 {
    font-size: 20px;
    font-weight: 700;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ============================================
   STAT CARDS
   ============================================ */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 18px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform .2s, box-shadow .2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: var(--primary-glow);
    color: var(--primary);
    flex-shrink: 0;
}

.stat-icon.income {
    background: var(--success-light);
    color: var(--success);
}

.stat-icon.teacher-icon {
    background: var(--warning-light);
    color: var(--warning);
}

.stat-icon.danger {
    background: var(--danger-light);
    color: var(--danger);
}

.stat-details h3 {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
    margin-top: 4px;
}

/* ============================================
   TABLE CARD
   ============================================ */
.table-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.card-header h2,
.card-header h3 {
    font-size: 16px;
    font-weight: 700;
}

.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: var(--secondary);
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
    font-weight: 600;
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-secondary);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background: var(--surface-hover);
}

.status-badge {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.status-badge.paid {
    background: var(--success-light);
    color: var(--success);
}

.status-badge.unpaid {
    background: var(--danger-light);
    color: var(--danger);
}

/* ============================================
   TEACHER DASHBOARD
   ============================================ */
.teacher-dash-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.teacher-dash-title {
    font-size: 20px;
    font-weight: 700;
}

.time-filter-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.time-filter-select {
    padding: 8px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    outline: none;
    cursor: pointer;
}

.teacher-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.t-stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: transform .2s;
}

.t-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.t-stat-icon-wrap {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
}

.blue-bg {
    background: linear-gradient(135deg, #4361ee, #6366f1);
}

.purple-bg {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
}

.orange-bg {
    background: linear-gradient(135deg, #f97316, #f4a261);
}

.green-bg {
    background: linear-gradient(135deg, #22c55e, #16a34a);
}

.t-stat-info {
    display: flex;
    flex-direction: column;
}

.t-stat-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.t-stat-value {
    font-size: 24px;
    font-weight: 700;
    margin-top: 2px;
}

.t-stat-subtitle {
    font-size: 12px;
    color: var(--text-muted);
}

.t-stat-progress {
    height: 6px;
    background: var(--secondary);
    border-radius: 6px;
    overflow: hidden;
}

.t-stat-bar {
    height: 100%;
    border-radius: 6px;
    transition: width .8s ease;
}

.blue-bar {
    background: linear-gradient(90deg, #4361ee, #6366f1);
}

.purple-bar {
    background: linear-gradient(90deg, #7c3aed, #a855f7);
}

.orange-bar {
    background: linear-gradient(90deg, #f97316, #f4a261);
}

.green-bar {
    background: linear-gradient(90deg, #22c55e, #16a34a);
}

.teacher-charts-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 18px;
    margin-bottom: 24px;
}

.chart-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.chart-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.chart-card-header h3 {
    font-size: 15px;
    font-weight: 700;
}

.chart-container {
    height: 260px;
}

.chart-legend {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.blue-dot {
    background: #4361ee;
}

.green-dot {
    background: #2dc653;
}

.donut-container {
    position: relative;
    height: 180px;
    display: flex;
    justify-content: center;
}

.donut-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.donut-total {
    font-size: 14px;
    font-weight: 700;
    display: block;
}

.donut-label {
    font-size: 10px;
    color: var(--text-muted);
}

.revenue-rows {
    margin-top: 16px;
}

.rev-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.rev-row:last-child {
    border-bottom: none;
}

.rev-label {
    color: var(--text-muted);
}

.rev-value {
    font-weight: 600;
}

.rev-change {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
}

.rev-change.positive {
    background: var(--success-light);
    color: var(--success);
}

.rev-change.negative {
    background: var(--danger-light);
    color: var(--danger);
}

.teacher-bottom-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.bottom-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.bottom-card-header {
    margin-bottom: 16px;
}

.bottom-card-header h3 {
    font-size: 15px;
    font-weight: 700;
}

.bottom-card-footer {
    margin-top: 16px;
    text-align: center;
}

.view-all-link {
    font-size: 13px;
    color: var(--primary);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.view-all-link:hover {
    text-decoration: underline;
}

.leaderboard-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.leaderboard-row:last-child {
    border-bottom: none;
}

.leaderboard-rank {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
    min-width: 24px;
    text-align: center;
}

.leaderboard-info {
    flex: 1;
}

.leaderboard-name {
    font-size: 13px;
    font-weight: 600;
}

.leaderboard-count {
    font-size: 11px;
    color: var(--text-muted);
}

.leaderboard-bar-wrap {
    width: 60px;
    height: 6px;
    background: var(--secondary);
    border-radius: 6px;
    overflow: hidden;
}

.leaderboard-bar {
    height: 100%;
    border-radius: 6px;
}

.lb-bar-green {
    background: var(--success);
}

.lb-bar-orange {
    background: var(--warning);
}

.lb-bar-red {
    background: var(--danger);
}

.schedule-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.schedule-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--secondary);
    border-radius: var(--radius-sm);
}

.schedule-subject {
    font-size: 13px;
    font-weight: 600;
}

.schedule-time {
    font-size: 12px;
    color: var(--text-muted);
}

.schedule-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 28px;
    font-size: 13px;
}

/* ============================================
   ATTENDANCE SCHEDULE LIST
   ============================================ */
.attendance-schedule-list {
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.attendance-schedule-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--secondary);
    border-radius: var(--radius);
    border-left: 4px solid var(--text-muted);
    transition: .2s;
}

.attendance-schedule-item.schedule-open {
    border-left-color: var(--success);
    background: rgba(45, 198, 83, .06);
}

.attendance-schedule-item.schedule-locked {
    border-left-color: var(--danger);
    opacity: .7;
}

.schedule-item-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.schedule-item-info strong {
    font-size: 14px;
}

.schedule-item-status {
    display: flex;
    align-items: center;
    gap: 6px;
}

.attendance-toggle {
    display: flex;
    gap: 6px;
}

.att-btn {
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--secondary);
    color: var(--text-muted);
    border: 1.5px solid var(--border);
    transition: .2s;
}

.att-btn.present.active {
    background: var(--success-light);
    color: var(--success);
    border-color: var(--success);
}

.att-btn.absent.active {
    background: var(--danger-light);
    color: var(--danger);
    border-color: var(--danger);
}

/* ============================================
   CHAT UI (WhatsApp-style)
   ============================================ */
.chat-container {
    display: flex;
    height: calc(100vh - 170px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
}

.chat-sidebar {
    width: 300px;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    background: var(--surface);
}

.chat-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.chat-sidebar-header h3 {
    font-size: 16px;
    font-weight: 700;
}

.chat-group-list {
    flex: 1;
    overflow-y: auto;
}

.chat-group-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
    transition: background .15s;
    border-bottom: 1px solid var(--border);
}

.chat-group-item:hover {
    background: var(--secondary);
}

.chat-group-item.active {
    background: var(--primary-glow);
    border-left: 3px solid var(--primary);
}

.chat-group-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4361ee, #6366f1);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    flex-shrink: 0;
}

.chat-group-info {
    flex: 1;
    min-width: 0;
}

.chat-group-title {
    font-size: 14px;
    font-weight: 600;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-group-last {
    font-size: 12px;
    color: var(--text-muted);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.chat-main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.chat-main-title h3 {
    font-size: 16px;
    font-weight: 700;
}

.chat-member-count {
    font-size: 12px;
    color: var(--text-muted);
}

.chat-main-actions {
    display: flex;
    gap: 8px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--bg);
}

.chat-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    gap: 12px;
}

.chat-message {
    max-width: 70%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
}

.chat-msg-mine {
    align-self: flex-end;
    background: var(--primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-msg-other {
    align-self: flex-start;
    background: var(--surface);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

.chat-msg-sender {
    font-size: 11px;
    font-weight: 700;
    color: var(--primary);
    display: block;
    margin-bottom: 2px;
}

.chat-msg-mine .chat-msg-sender {
    color: rgba(255, 255, 255, .85);
}

.chat-msg-text {
    display: block;
}

.chat-msg-time {
    font-size: 10px;
    display: block;
    text-align: right;
    margin-top: 4px;
    opacity: .65;
}

.chat-msg-image {
    max-width: 240px;
    max-height: 200px;
    border-radius: 8px;
    margin: 4px 0;
    display: block;
}

.chat-msg-file {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, .06);
    border-radius: 8px;
    font-size: 12px;
    margin: 4px 0;
}

.chat-pin-btn {
    border: none;
    background: var(--secondary);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    color: var(--primary);
    cursor: pointer;
    margin-top: 4px;
}

.chat-pin-btn:hover {
    background: var(--primary-glow);
}

.chat-input-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.chat-attach-btn {
    cursor: pointer;
    font-size: 22px;
    color: var(--text-muted);
    padding: 4px;
    transition: .2s;
    display: flex;
    align-items: center;
}

.chat-attach-btn:hover {
    color: var(--primary);
}

.chat-input {
    flex: 1;
    padding: 10px 16px;
    border: 1.5px solid var(--border);
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    background: var(--secondary);
    color: var(--text);
}

.chat-input:focus {
    border-color: var(--primary);
    background: var(--surface);
}

.chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: .2s;
}

.chat-send-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

/* ============================================
   STUDY MATERIALS
   ============================================ */
.materials-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.material-group {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.material-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 20px;
    cursor: pointer;
    user-select: none;
    transition: background .15s;
}

.material-group-header:hover {
    background: var(--secondary);
}

.material-group-header i {
    transition: transform .2s;
    color: var(--text-muted);
}

.material-group.expanded .material-group-header i {
    transform: rotate(90deg);
}

.material-count {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: auto;
}

.material-group-body {
    display: none;
    border-top: 1px solid var(--border);
}

.material-group.expanded .material-group-body {
    display: block;
}

.material-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    transition: background .15s;
}

.material-item:last-child {
    border-bottom: none;
}

.material-item:hover {
    background: var(--surface-hover);
}

.material-item-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--primary);
    background: var(--primary-glow);
    flex-shrink: 0;
}

.material-item-info {
    flex: 1;
    min-width: 0;
}

.material-item-title {
    font-size: 14px;
    font-weight: 600;
    display: block;
}

.material-item-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
    display: block;
}

.material-note-content {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 6px;
    line-height: 1.4;
    max-height: 60px;
    overflow: hidden;
}

.material-item-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* ============================================
   SUBJECT SELECTOR TREE
   ============================================ */
.subject-selector-tree {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
}

.subject-group {
    margin-bottom: 4px;
}

.subject-group-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background .15s;
    user-select: none;
}

.subject-group-header:hover {
    background: var(--secondary);
}

.subject-group-header i {
    transition: transform .2s;
    color: var(--text-muted);
    font-size: 16px;
}

.subject-group.expanded>.subject-group-header i {
    transform: rotate(90deg);
}

.subject-group-header strong {
    font-size: 13px;
}

.subject-group-body {
    display: none;
    padding-left: 20px;
    margin-top: 4px;
}

.subject-group.expanded>.subject-group-body {
    display: block;
}

.subject-checkbox-label {
    font-size: 13px;
    padding: 5px 8px;
    margin-bottom: 2px;
    border-radius: 4px;
}

.subject-checkbox-label input {
    margin-right: 6px;
}

.depth-0>.subject-group-header strong {
    font-size: 14px;
    color: var(--primary);
}

.depth-1>.subject-group-header strong {
    font-size: 13px;
}

.depth-2>.subject-group-header strong {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ============================================
   SETTINGS
   ============================================ */
.settings-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.settings-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}

.settings-card h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
}

.settings-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 0;
}

.settings-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    min-width: 120px;
}

.settings-label i {
    font-size: 20px;
    color: var(--text-muted);
}

.theme-toggle-group {
    display: flex;
    gap: 8px;
}

.theme-btn {
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--secondary);
    color: var(--text-muted);
    border: 1.5px solid var(--border);
    transition: .2s;
}

.theme-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.theme-btn:hover:not(.active) {
    background: var(--surface-hover);
    color: var(--text);
}

.photo-upload-row {
    flex-wrap: wrap;
}

.photo-preview {
    width: 72px;
    height: 72px;
    border-radius: 16px;
    background: var(--secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-size: 28px;
    color: var(--text-muted);
}

.photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-upload-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.photo-hint {
    font-size: 11px;
    color: var(--text-muted);
}

/* Settings Panel (overlay) */
.settings-panel-overlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(0, 0, 0, .3);
    display: none;
    justify-content: flex-end;
}

.settings-panel-overlay.active {
    display: flex;
}

.settings-panel {
    width: 360px;
    background: var(--surface);
    height: 100%;
    box-shadow: var(--shadow-lg);
    padding: 24px;
    animation: slideInRight .25s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

.settings-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.settings-panel-header h3 {
    font-size: 18px;
    font-weight: 700;
}

.close-btn {
    background: var(--secondary);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--text-muted);
    transition: .2s;
}

.close-btn:hover {
    background: var(--danger-light);
    color: var(--danger);
}

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, .5);
    display: none;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--surface);
    border-radius: var(--radius);
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    display: none;
    animation: modalIn .2s;
}

.modal.active {
    display: block;
}

@keyframes modalIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 17px;
    font-weight: 700;
}

.modal-body {
    padding: 24px;
}

/* ============================================
   RESPONSIVE
   ============================================ */

/* ---- Mobile menu button: hidden on desktop ---- */
.mobile-menu-btn {
    display: none;
}

/* ---- Mobile & Tablet Sidebar Drawer (below 1024px) ---- */
@media (max-width: 1023px) {

    /* Sidebar: hidden off-screen drawer */
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 260px;
        z-index: 200;
        transform: translateX(-260px);
        transition: transform 0.3s ease;
        box-shadow: none;
    }

    .sidebar.collapsed {
        width: 260px;
    }

    .sidebar.collapsed .link-name,
    .sidebar.collapsed .logo-name,
    .sidebar.collapsed .sidebar-profile-name {
        display: block;
    }

    .sidebar.collapsed .sidebar-avatar {
        width: 44px;
        height: 44px;
        font-size: 15px;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: 8px 0 32px rgba(0, 0, 0, 0.2);
    }

    .sidebar.mobile-open .link-name,
    .sidebar.mobile-open .logo-name,
    .sidebar.mobile-open .sidebar-profile-name {
        display: block;
    }

    .sidebar.mobile-open .sidebar-avatar {
        width: 44px;
        height: 44px;
        font-size: 15px;
    }

    /* Remove sidebar margin from main content */
    .main-content {
        margin-left: 0 !important;
    }

    /* Dark overlay behind the drawer */
    .mobile-sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 199;
        animation: fadeIn 0.2s;
    }

    .mobile-sidebar-overlay.active {
        display: block;
    }

    /* Hamburger button in header */
    .mobile-menu-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 38px;
        height: 38px;
        background: var(--secondary);
        border-radius: var(--radius-sm);
        font-size: 22px;
        color: var(--text-muted);
        border: none;
        cursor: pointer;
        transition: 0.2s;
        flex-shrink: 0;
    }

    .mobile-menu-btn:hover {
        background: var(--primary-glow);
        color: var(--primary);
    }

    /* Header title: add flex for hamburger alignment */
    .header-title {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    /* Hide the desktop sidebar hamburger on mobile */
    .hamburger-btn {
        display: none;
    }
}

/* ---- Tablets & Small Laptops ---- */
/* ==== CLASS ENTRY CARDS (Reference Design) ==== */
.class-entry-cards {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding-top: 8px;
    max-width: 860px;
}

.class-entry-card {
    background: var(--white);
    border-radius: 16px;
    border: 1.5px solid var(--border);
    box-shadow: 0 2px 16px rgba(26, 95, 168, 0.06);
    padding: 24px 26px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: box-shadow 0.25s, transform 0.22s, border-color 0.22s;
    cursor: default;
    position: relative;
    overflow: hidden;
    animation: ceCardFadeUp 0.35s ease both;
}

@keyframes ceCardFadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

.class-entry-card::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 5px;
    background: linear-gradient(180deg, var(--primary, #4361ee) 0%, #ffd166 100%);
    border-radius: 16px 0 0 16px;
    opacity: 0;
    transition: opacity 0.25s;
}

.class-entry-card:hover {
    box-shadow: 0 8px 30px rgba(26, 95, 168, 0.12);
    transform: translateY(-2px);
    border-color: #b8cef0;
}

.class-entry-card:hover::before { opacity: 1; }

.class-entry-card.ended {
    opacity: 0.6;
}

/* ---- Card inner layout ---- */
.class-entry-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.class-entry-card-info { flex: 1; }

.class-entry-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.45;
    margin-bottom: 5px;
}

.class-entry-card-meta {
    font-size: 0.83rem;
    color: var(--text-muted);
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.class-entry-card-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.class-entry-card-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 6px;
    line-height: 1.5;
}

/* Type badge (top-right of card) */
.class-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 14px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.class-type-badge.live {
    background: #fff4e0;
    color: #d97706;
    border: 1.5px solid #fde9b8;
}

.class-type-badge.physical {
    background: #e8f0fa;
    color: #1a5fa8;
    border: 1.5px solid #c5d8f0;
}

/* Card bottom: action buttons */
.class-entry-card-bottom {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Pill badge buttons (matches reference .badge-video / .btn-pdf style) */
.ce-pill-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 50px;
    padding: 8px 20px;
    font-size: 0.83rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-family: inherit;
    text-decoration: none;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}

.ce-pill-icon {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--primary, #4361ee);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 11px;
    flex-shrink: 0;
}

.ce-pill-icon-sq {
    border-radius: 6px !important;
    background: #e53935 !important;
    font-size: 10px !important;
}

/* Blue: Join Live / Add Live Link */
.ce-pill-btn.ce-pill-blue {
    background: #e8f0fa;
    border: 1.5px solid #b8d0ef;
    color: #1a5fa8;
}
.ce-pill-btn.ce-pill-blue:hover {
    background: #cfe0f5;
    transform: scale(1.03);
}

/* Red: Delete */
.ce-pill-btn.ce-pill-red {
    background: #fdecea;
    border: 1.5px solid #f5bcba;
    color: #e53935;
}
.ce-pill-btn.ce-pill-red:hover {
    background: #fad4d3;
    transform: scale(1.03);
}
.ce-pill-btn.ce-pill-red .ce-pill-icon {
    background: #e53935;
}

/* Amber/Orange: Edit */
.ce-pill-btn.ce-pill-orange {
    background: #fff8ed;
    border: 1.5px solid #fde68a;
    color: #b45309;
}
.ce-pill-btn.ce-pill-orange:hover {
    background: #fef3c7;
    transform: scale(1.03);
}
.ce-pill-btn.ce-pill-orange .ce-pill-icon {
    background: #f59e0b;
}

/* Grey: Pending / Ended */
.ce-pill-btn.ce-pill-grey {
    background: var(--secondary);
    border: 1.5px solid var(--border);
    color: var(--text-muted);
    cursor: default;
}
.ce-pill-btn.ce-pill-grey .ce-pill-icon {
    background: #aaa;
}

/* Dark mode */
body.dark-mode .class-entry-card {
    background: var(--white);
    border-color: var(--border);
}

body.dark-mode .class-type-badge.live {
    background: rgba(217, 119, 6, 0.12);
    color: #f0a45d;
    border-color: rgba(217, 119, 6, 0.2);
}

body.dark-mode .class-type-badge.physical {
    background: rgba(26, 95, 168, 0.12);
    color: #5dade2;
    border-color: rgba(26, 95, 168, 0.2);
}

body.dark-mode .ce-pill-btn.ce-pill-blue {
    background: rgba(26, 95, 168, 0.15);
    border-color: rgba(26, 95, 168, 0.25);
    color: #5dade2;
}

body.dark-mode .ce-pill-btn.ce-pill-red {
    background: rgba(229, 57, 53, 0.12);
    border-color: rgba(229, 57, 53, 0.2);
    color: #e57373;
}

/* Responsive */
@media (max-width: 600px) {
    .class-entry-card {
        padding: 16px 14px 14px;
        border-radius: 12px;
    }
    .class-entry-title { font-size: 0.93rem; }
    .ce-pill-btn { padding: 7px 14px; font-size: 0.78rem; }
    .class-type-badge { font-size: 10px; padding: 4px 10px; }
}

@media (max-width: 1024px) {
    .teacher-charts-row {
        grid-template-columns: 1fr;
    }

    .teacher-bottom-row {
        grid-template-columns: 1fr;
    }
}

/* ---- Tablets ---- */
@media (max-width: 768px) {

    /* Header */
    .top-header {
        padding: 10px 14px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .header-title h1 {
        font-size: 16px;
    }

    .header-search {
        display: none;
    }

    .header-right {
        gap: 8px;
    }

    .time-display {
        display: none;
    }

    .user-name-text {
        display: none;
    }

    .header-avatar {
        width: 32px;
        height: 32px;
    }

    .header-icon-btn {
        width: 34px;
        height: 34px;
        font-size: 18px;
    }

    /* Views */
    .views-container {
        padding: 14px;
    }

    .view-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .view-header h2 {
        font-size: 18px;
    }

    .header-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .header-actions .form-control {
        min-width: 0 !important;
        flex: 1;
    }

    .header-actions .btn {
        flex: 1 1 auto;
        justify-content: center;
    }

    /* Dashboard */
    .dashboard-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .stat-card {
        padding: 14px;
        gap: 12px;
    }

    .stat-icon {
        width: 44px;
        height: 44px;
        font-size: 20px;
        border-radius: 12px;
    }

    .stat-value {
        font-size: 18px;
    }

    .stat-details h3 {
        font-size: 12px;
    }

    /* Teacher stats */
    .teacher-stats-row {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .t-stat-card {
        padding: 16px;
    }

    .t-stat-value {
        font-size: 20px;
    }

    /* Tables */
    .data-table th,
    .data-table td {
        padding: 10px 12px;
        font-size: 12px;
    }

    .table-card {
        border-radius: 10px;
    }

    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }

    /* Chat */
    .chat-container {
        height: calc(100vh - 130px);
    }

    .chat-sidebar {
        width: 72px;
    }

    .chat-group-info {
        display: none;
    }

    .chat-group-avatar {
        width: 38px;
        height: 38px;
        font-size: 15px;
    }

    .chat-group-item {
        padding: 12px;
        justify-content: center;
    }

    .chat-messages {
        padding: 14px;
    }

    .chat-message {
        max-width: 85%;
        font-size: 13px;
        padding: 8px 12px;
    }

    .chat-main-header {
        padding: 10px 14px;
    }

    .chat-input-bar {
        padding: 10px 12px;
    }

    /* Modals */
    .modal {
        max-width: calc(100% - 24px);
        margin: 12px;
        border-radius: 16px;
    }

    .modal-header {
        padding: 14px 18px;
    }

    .modal-header h3 {
        font-size: 15px;
    }

    .modal-body {
        padding: 18px;
    }

    /* Settings Panel */
    .settings-panel {
        width: 100%;
        max-width: 320px;
        padding: 20px;
    }

    /* Notification Dropdown */
    .notif-dropdown {
        width: calc(100vw - 24px);
        right: -60px;
    }

    /* Attendance schedule */
    .attendance-schedule-item {
        flex-wrap: wrap;
        gap: 10px;
        padding: 14px 16px;
    }

    .attendance-schedule-item .btn {
        width: 100%;
        justify-content: center;
    }

    /* Materials */
    .material-group-header {
        padding: 14px 16px;
    }

    .material-item {
        flex-wrap: wrap;
        gap: 10px;
    }

    .material-item-actions {
        width: 100%;
    }
}

/* ---- Mobile Phones ---- */
@media (max-width: 480px) {

    /* Header */
    .top-header {
        padding: 8px 12px;
        gap: 6px;
    }

    .header-title h1 {
        font-size: 15px;
    }

    /* Views */
    .views-container {
        padding: 10px;
    }

    .view-header {
        gap: 10px;
    }

    .view-header h2 {
        font-size: 16px;
    }

    .header-actions {
        gap: 8px;
    }

    .header-actions .btn {
        font-size: 12px;
        padding: 7px 12px;
    }

    .header-actions select.form-control {
        font-size: 13px;
    }

    /* Dashboard: single column */
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
        border-radius: 10px;
    }

    .stat-value {
        font-size: 16px;
    }

    /* Teacher stats: single column */
    .teacher-stats-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .t-stat-card {
        padding: 14px;
    }

    .t-stat-value {
        font-size: 18px;
    }

    /* Teacher dashboard */
    .teacher-dash-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .teacher-dash-title {
        font-size: 18px;
    }

    .time-filter-select {
        width: 100%;
    }

    /* Charts */
    .chart-container {
        height: 200px;
    }

    .chart-card {
        padding: 14px;
    }

    .chart-card-header {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }

    .donut-container {
        height: 150px;
    }

    /* Revenue rows */
    .rev-row {
        flex-wrap: wrap;
        gap: 4px;
        padding: 8px 0;
    }

    .rev-change {
        margin-left: auto;
    }

    /* Tables: full horizontal scroll, compact */
    .data-table th,
    .data-table td {
        padding: 8px 10px;
        font-size: 11px;
        white-space: nowrap;
    }

    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }

    .data-table .btn-sm {
        padding: 5px 8px;
        font-size: 10px;
        white-space: nowrap;
    }

    .status-badge {
        font-size: 10px;
        padding: 3px 8px;
    }

    /* Buttons */
    .btn {
        padding: 8px 14px;
        font-size: 13px;
    }

    .btn-lg {
        padding: 10px 18px;
        font-size: 14px;
    }

    /* Make touch targets at least 44px */
    .nav-link {
        padding: 12px 14px;
        min-height: 44px;
    }

    .att-btn {
        min-height: 40px;
    }

    /* Forms */
    .form-group {
        margin-bottom: 14px;
    }

    .form-group label {
        font-size: 12px;
    }

    .form-control {
        padding: 9px 12px;
        font-size: 13px;
    }

    /* Chat: full-width stacked layout */
    .chat-container {
        height: calc(100vh - 120px);
        flex-direction: column;
    }

    .chat-sidebar {
        width: 100%;
        height: auto;
        max-height: 100px;
        border-right: none;
        border-bottom: 1px solid var(--border);
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
    }

    .chat-sidebar-header {
        display: none;
    }

    .chat-group-list {
        display: flex;
        flex-direction: row;
        gap: 4px;
        padding: 8px;
    }

    .chat-group-item {
        padding: 8px 10px;
        border-bottom: none;
        border-radius: var(--radius-sm);
        min-width: fit-content;
    }

    .chat-group-avatar {
        width: 34px;
        height: 34px;
        font-size: 14px;
    }

    .chat-group-info {
        display: block;
    }

    .chat-group-title {
        font-size: 11px;
        max-width: 80px;
    }

    .chat-group-last {
        display: none;
    }

    .chat-main {
        min-height: 0;
        flex: 1;
    }

    .chat-messages {
        padding: 10px;
        gap: 6px;
    }

    .chat-message {
        max-width: 90%;
        font-size: 13px;
        border-radius: 14px;
    }

    .chat-input {
        padding: 8px 14px;
        font-size: 13px;
    }

    .chat-send-btn {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    .chat-input-bar {
        padding: 8px 10px;
        gap: 6px;
    }

    .chat-main-header {
        padding: 10px 12px;
    }

    .chat-main-title h3 {
        font-size: 14px;
    }

    /* Modals: bottom sheet style */
    .modal-overlay {
        align-items: flex-end;
    }

    .modal {
        max-width: 100%;
        max-height: 92vh;
        margin: 0;
        border-radius: 20px 20px 0 0;
        animation: modalSlideUp .25s ease;
    }

    @keyframes modalSlideUp {
        from {
            transform: translateY(100%);
            opacity: 0;
        }

        to {
            transform: translateY(0);
            opacity: 1;
        }
    }

    .modal-header {
        padding: 14px 16px;
    }

    .modal-header h3 {
        font-size: 15px;
    }

    .modal-body {
        padding: 16px;
    }

    /* Settings */
    .settings-container {
        gap: 14px;
    }

    .settings-card {
        padding: 16px;
    }

    .settings-card h3 {
        font-size: 14px;
        margin-bottom: 12px;
    }

    .settings-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .settings-label {
        min-width: auto;
    }

    .theme-toggle-group {
        width: 100%;
    }

    .theme-btn {
        flex: 1;
        justify-content: center;
    }

    /* Settings Panel */
    .settings-panel {
        width: 100%;
        max-width: 100%;
    }

    /* Notification Dropdown */
    .notif-dropdown {
        width: calc(100vw - 16px);
        right: -40px;
        max-height: 360px;
    }

    .notif-item {
        padding: 10px 14px;
    }

    /* Attendance */
    .attendance-schedule-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 14px 16px;
    }

    .attendance-schedule-item .btn {
        width: 100%;
        justify-content: center;
        min-height: 44px;
        font-size: 13px;
    }

    .attendance-toggle {
        width: 100%;
    }

    .att-btn {
        flex: 1;
        justify-content: center;
        min-height: 40px;
    }

    /* Materials */
    .material-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 12px 16px;
    }

    .material-item-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .material-group-header {
        padding: 14px 16px;
    }

    /* Subject selector */
    .subject-selector-tree {
        max-height: 300px;
    }

    .subject-group-header {
        padding: 8px 10px;
    }

    /* Checkbox grid */
    .checkbox-grid {
        gap: 6px;
    }

    .checkbox-label,
    .subject-checkbox-label {
        font-size: 12px;
        padding: 5px 10px;
    }

    /* Leaderboard */
    .leaderboard-row {
        gap: 8px;
        padding: 8px 0;
    }

    .leaderboard-name {
        font-size: 12px;
    }

    .leaderboard-bar-wrap {
        width: 40px;
    }

    /* Schedule */
    .schedule-item {
        padding: 10px 12px;
        flex-wrap: wrap;
        gap: 4px;
    }

    .schedule-subject {
        font-size: 12px;
    }

    .schedule-time {
        font-size: 11px;
    }

    /* Photo upload */
    .photo-preview {
        width: 60px;
        height: 60px;
        border-radius: 14px;
    }

    /* Student dashboard: stack payment summary */
    #student-dashboard .dashboard-grid {
        grid-template-columns: 1fr;
    }

    /* Bulk import modal: full width on mobile */
    #bulk-import-modal {
        max-width: 100%;
    }

    #bulk-import-modal .modal-body>div:first-child div[style] {
        flex-direction: column !important;
    }

    #bulk-import-modal .btn {
        width: 100%;
        justify-content: center;
    }

    #bulk-import-modal .form-control {
        width: 100% !important;
        min-width: 0 !important;
    }
}

/* ---- Very Small Phones (320px) ---- */
@media (max-width: 360px) {
    .views-container {
        padding: 8px;
    }

    .stat-card {
        padding: 10px;
    }

    .stat-icon {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    .stat-value {
        font-size: 15px;
    }

    .login-left {
        padding: 20px 16px 10px;
    }

    .login-welcome-title {
        font-size: 30px;
    }

    .login-hero-image {
        max-width: 160px;
        border-radius: 20px;
    }

    .login-input {
        padding: 14px 16px 14px 44px;
        font-size: 14px;
    }

    .login-btn {
        padding: 14px 20px;
        font-size: 15px;
    }

    .data-table th,
    .data-table td {
        padding: 6px 8px;
        font-size: 10px;
    }

    .btn {
        padding: 6px 10px;
        font-size: 12px;
    }

    .btn-sm {
        padding: 4px 8px;
        font-size: 10px;
    }

    .view-header h2 {
        font-size: 15px;
    }

    .chat-message {
        max-width: 95%;
    }
}

/* ---- Safe area for notched phones ---- */
@supports (padding: env(safe-area-inset-bottom)) {
    .chat-input-bar {
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
    }

    .modal {
        padding-bottom: env(safe-area-inset-bottom);
    }

    .sidebar {
        padding-bottom: env(safe-area-inset-bottom);
    }
}