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

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a2e;
    --bg-card-hover: #222240;
    --text-primary: #f0f0f5;
    --text-secondary: #8888a0;
    --text-muted: #555570;
    --accent: #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.15);
    --border: #2a2a40;
    --gradient-1: linear-gradient(135deg, #3b82f6, #06b6d4);
    --gradient-2: linear-gradient(135deg, #f59e0b, #ef4444);
    --gradient-3: linear-gradient(135deg, #06b6d4, #3b82f6);
    --gradient-4: linear-gradient(135deg, #10b981, #34d399);
    --shadow: 0 4px 20px rgba(0,0,0,0.3);
    --radius: 12px;
    --radius-sm: 8px;
}

body.light-theme {
    --bg-primary: #f5f5fa;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f0f0f8;
    --text-primary: #1a1a2e;
    --text-secondary: #555570;
    --text-muted: #8888a0;
    --border: #e0e0ec;
    --shadow: 0 4px 20px rgba(0,0,0,0.08);
}

body { font-family: 'Plus Jakarta Sans', sans-serif; background: var(--bg-primary); color: var(--text-primary); min-height: 100vh; }

.app-container { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: 300px; background: var(--bg-secondary); border-right: 1px solid var(--border);
    padding: 28px 24px; display: flex; flex-direction: column; position: fixed;
    top: 0; left: 0; height: 100vh; overflow-y: auto; z-index: 10;
}

.sidebar-header { margin-bottom: 32px; }

.logo-container { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; cursor: pointer; }
.logo-icon { width: 32px; height: 32px; color: var(--accent); }
.logo-text { font-family: 'Outfit', sans-serif; font-weight: 700; font-size: 20px; letter-spacing: -0.3px; }

.class-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 20px; margin-bottom: 20px;
}
.class-badge {
    display: inline-block; padding: 3px 10px; border-radius: 20px;
    background: var(--accent-glow); color: var(--accent); font-size: 11px;
    font-weight: 600; letter-spacing: 1px; margin-bottom: 12px;
}
.class-title { font-family: 'Outfit', sans-serif; font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.school-subtitle { font-size: 13px; color: var(--text-secondary); margin-bottom: 16px; }
.divider { height: 1px; background: var(--border); margin-bottom: 16px; }
.meta-row { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 8px; }
.meta-label { color: var(--text-muted); }
.meta-value { font-weight: 500; }

.stats-panel { margin-bottom: 20px; }
.stats-panel h3 { font-size: 13px; color: var(--text-secondary); margin-bottom: 12px; text-transform: uppercase; letter-spacing: 1px; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 16px; text-align: center;
}
.stat-num { display: block; font-family: 'Outfit', sans-serif; font-size: 24px; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 11px; color: var(--text-secondary); margin-top: 4px; display: block; }

.theme-toggle-container { margin-top: auto; padding-top: 20px; }
.theme-btn {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 16px;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm);
    color: var(--text-secondary); cursor: pointer; font-size: 13px; transition: all 0.2s;
}
.theme-btn:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.theme-btn-icon { width: 20px; height: 20px; }
.sun-icon, .moon-icon { display: none; width: 100%; height: 100%; }
.dark-theme .moon-icon { display: block; }
.light-theme .sun-icon { display: block; }

/* Main Content */
.main-content {
    margin-left: 300px; flex: 1; padding: 32px 40px;
}

.content-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 32px; flex-wrap: wrap; gap: 16px;
}
.header-left { }
.section-title { font-family: 'Outfit', sans-serif; font-size: 28px; font-weight: 700; }
.section-desc { color: var(--text-secondary); font-size: 14px; margin-top: 4px; }
.header-actions { display: flex; gap: 12px; align-items: center; }

.search-box {
    display: flex; align-items: center; gap: 10px;
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 8px 14px; width: 240px;
}
.search-icon { width: 18px; height: 18px; color: var(--text-muted); flex-shrink: 0; }
.search-box input {
    border: none; background: none; outline: none; color: var(--text-primary);
    font-family: inherit; font-size: 13px; width: 100%;
}
.search-box input::placeholder { color: var(--text-muted); }

/* Class Grid */
.class-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.class-grid-item {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 24px; cursor: pointer; transition: all 0.25s ease;
    text-decoration: none; color: inherit; display: block;
    position: relative; overflow: hidden;
}
.class-grid-item:hover {
    background: var(--bg-card-hover); transform: translateY(-2px);
    border-color: var(--accent); box-shadow: var(--shadow);
}

.class-grid-item .item-badge {
    display: inline-block; padding: 2px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 600; letter-spacing: 0.5px; margin-bottom: 12px;
}

.class-grid-item .item-name {
    font-family: 'Outfit', sans-serif; font-size: 22px; font-weight: 700;
    margin-bottom: 6px;
}

.class-grid-item .item-wali {
    font-size: 13px; color: var(--text-secondary); margin-bottom: 12px;
}

.class-grid-item .item-mapel {
    font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 6px;
}

.class-grid-item .item-now {
    font-size: 12px; display: flex; align-items: center; gap: 6px;
    margin-bottom: 8px; padding: 5px 8px; border-radius: 6px;
}
.now-active { background: rgba(16, 185, 129, 0.12); color: #10b981; }
.now-break { background: rgba(245, 158, 11, 0.12); color: #f59e0b; }
.now-activity { background: rgba(99, 102, 241, 0.12); color: #6366f1; }
.now-idle { color: var(--text-muted); padding-left: 0; }

.now-dot {
    width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
}
.now-active .now-dot { background: #10b981; box-shadow: 0 0 8px rgba(16, 185, 129, 0.6); }
.now-break .now-dot { background: #f59e0b; }
.now-activity .now-dot { background: #6366f1; }
.now-idle .now-dot { background: var(--text-muted); }
.now-subject { font-weight: 600; }
.now-time { margin-left: auto; opacity: 0.7; }

.class-grid-item .item-arrow {
    position: absolute; top: 24px; right: 24px;
    width: 24px; height: 24px; color: var(--text-muted);
    transition: transform 0.25s ease, color 0.25s ease;
}
.class-grid-item:hover .item-arrow { transform: translateX(4px); color: var(--accent); }

.class-grid-item .item-accent {
    position: absolute; top: 0; left: 0; width: 4px; height: 100%;
    border-radius: 0 4px 4px 0;
}

.badge-vii { background: rgba(6, 182, 212, 0.15); color: #06b6d4; }
.badge-viii { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.badge-ix { background: rgba(239, 68, 68, 0.15); color: #ef4444; }

.accent-vii { background: linear-gradient(180deg, #06b6d4, #3b82f6); }
.accent-viii { background: linear-gradient(180deg, #f59e0b, #ef4444); }
.accent-ix { background: linear-gradient(180deg, #ef4444, #ec4899); }

/* Mobile Header */
.mobile-header {
    display: none; position: fixed; top: 0; left: 0; right: 0; height: 56px;
    background: var(--bg-secondary); border-bottom: 1px solid var(--border);
    align-items: center; padding: 0 16px; z-index: 25; gap: 12px;
}
.menu-btn {
    background: none; border: none; color: var(--text-primary); cursor: pointer;
    padding: 8px; border-radius: 8px; display: flex; align-items: center;
}
.menu-btn:hover { background: var(--bg-card); }
.mobile-logo { font-family: 'Outfit', sans-serif; font-weight: 700; font-size: 18px; }

/* Sidebar Overlay */
.sidebar-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    z-index: 15; opacity: 0; transition: opacity 0.3s ease;
}
.sidebar-overlay.active { opacity: 1; }

/* Mobile & Tablet */
@media (max-width: 900px) {
    .mobile-header { display: flex; }

    .sidebar {
        position: fixed; top: 0; left: 0; height: 100vh; z-index: 20;
        transform: translateX(-100%); transition: transform 0.3s ease;
        width: 280px;
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.active { display: block; }

    .main-content { margin-left: 0; padding: 72px 16px 24px; }

    .content-header {
        flex-direction: column; gap: 12px; margin-bottom: 20px;
    }
    .section-title { font-size: 22px; }
    .header-actions { width: 100%; }
    .search-box { width: 100%; }

    .class-grid { grid-template-columns: 1fr; gap: 12px; }

    .class-grid-item { padding: 18px; }
    .class-grid-item .item-name { font-size: 18px; }
    .class-grid-item .item-wali { font-size: 12px; margin-bottom: 8px; }
    .class-grid-item .item-arrow { top: 18px; right: 18px; width: 20px; height: 20px; }
    .class-grid-item .item-now { font-size: 11px; padding: 4px 8px; }
    .class-grid-item .item-mapel { font-size: 11px; }
    .class-grid-item .item-badge { font-size: 10px; margin-bottom: 8px; }
}

.sidebar-actions { margin-bottom: 10px; }

/* Info Badge & Tooltip */
.info-badge {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: auto;
    color: var(--text-muted);
    cursor: help;
    flex-shrink: 0;
}

.info-badge:hover {
    color: var(--accent);
}

.tooltip-text {
    visibility: hidden;
    opacity: 0;
    position: fixed;
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 400;
    max-width: 260px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    z-index: 100;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.tooltip-text::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 10px;
    border: 6px solid transparent;
    border-top-color: var(--border);
}

.theme-btn .info-badge svg {
    width: 18px;
    height: 18px;
}

#autoscroll-toggle .theme-btn-text {
    flex: 1;
}

#autoscroll-toggle.active {
    color: var(--accent);
    border-color: var(--accent);
}

#autoscroll-toggle.active .theme-btn-icon svg {
    stroke: var(--accent);
}

.hidden { display: none !important; }

@media (max-width: 480px) {
    .main-content { padding: 68px 12px 20px; }
    .class-grid-item { padding: 14px; }
    .class-grid-item .item-name { font-size: 16px; }
    .class-grid-item .item-arrow { top: 14px; right: 14px; }
    .section-title { font-size: 20px; }
    .section-desc { font-size: 13px; }
}
