:root {
    /* Base Colors - Cartoon Theme */
    --bg-color: #fff9f5; /* Warm light peach background */
    --text-color: #4a3b32; /* Dark Brown (Hair) */
    --primary-color: #3b5b66; /* Teal (Uniform) */
    --secondary-color: #fdd835; /* Gold (Stars) */
    
    /* Layout */
    --header-bg: #3b5b66;
    --header-text: #ffffff;
    --sidebar-bg: #ffffff;
    --sidebar-border: #e6dace;
    
    /* Components */
    --card-bg: #ffffff;
    --card-border: #e6dace;
    --card-shadow: rgba(74, 59, 50, 0.1);
    
    /* Inputs */
    --input-bg: #ffffff;
    --input-border: #d7ccc8;
    --input-focus: #3b5b66;
    
    /* Menu Items (Adjusted for theme) */
    --menu-home: #5c9ead;
    --menu-notice: #ffa726;
    --menu-read: #66bb6a;
    --menu-makeup: #ef5350;
    --menu-history: #ab47bc;
    --menu-rank: #fdd835;
    --menu-profile: #4db6ac;
    
    --header-height: 70px;
    --sidebar-width: 260px;
}

[data-theme="night"] {
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --primary-color: #90caf9; 
    
    --header-bg: #1f1f1f;
    --header-text: #e0e0e0;
    --sidebar-bg: #1f1f1f;
    --sidebar-border: #333333;
    
    --card-bg: #1e1e1e;
    --card-border: #333333;
    --card-shadow: rgba(0,0,0,0.5);
    
    --input-bg: #2c2c2c;
    --input-border: #555555;
    --input-focus: #90caf9;

    --menu-home: #64b5f6;
    --menu-notice: #ffb74d;
    --menu-read: #81c784;
    --menu-makeup: #e57373;
    --menu-history: #ba68c8;
    --menu-rank: #fff176;
    --menu-profile: #4db6ac;
}

[data-theme="future"] {
    /* Softer, readable Space Theme */
    --bg-color: #0f172a; /* Deep Slate Blue */
    --text-color: #e2e8f0; /* Soft White */
    --primary-color: #38bdf8; /* Sky Blue */
    
    --header-bg: #1e293b; /* Dark Slate */
    --header-text: #f1f5f9;
    --sidebar-bg: #1e293b;
    --sidebar-border: #334155; /* Muted Blue-Grey */
    
    --card-bg: #1e293b;
    --card-border: #334155;
    --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    
    --input-bg: #0f172a;
    --input-border: #475569;
    --input-focus: #38bdf8;

    /* Menu Colors - Softened for dark background */
    --menu-home: #60a5fa;
    --menu-notice: #fbbf24;
    --menu-read: #4ade80;
    --menu-makeup: #f87171;
    --menu-history: #c084fc;
    --menu-rank: #facc15;
    --menu-profile: #2dd4bf;
}

body {
    margin: 0;
    font-family: 'Comic Sans MS', 'Chalkboard SE', 'Microsoft JhengHei', sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
}

/* Header */
.student-header {
    background: var(--header-bg);
    color: var(--header-text);
    padding: 0 20px;
    height: var(--header-height);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: background 0.3s, color 0.3s;
}

.site-title {
    font-size: 24px;
    font-weight: bold;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--header-text);
    font-size: 24px;
    cursor: pointer;
}

/* PC Info in Header */
.header-info {
    display: flex;
    gap: 15px;
    font-size: 14px;
}

.header-info div {
    background: rgba(255,255,255,0.2);
    padding: 5px 10px;
    border-radius: 15px;
}

/* Layout */
.student-wrapper {
    display: flex;
    flex: 1;
}

/* Sidebar */
.student-sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 2px solid var(--sidebar-border);
    padding: 20px;
    box-sizing: border-box;
    transition: transform 0.3s ease, background 0.3s, border-color 0.3s;
}

.student-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.student-menu li {
    margin-bottom: 10px;
}

/* Menu Buttons Style */
.student-menu li a {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 12px 20px;
    color: var(--text-color);
    text-decoration: none;
    font-size: 16px;
    border-radius: 15px;
    background: var(--card-bg);
    border: 2px solid transparent;
    box-shadow: 0 2px 5px var(--card-shadow);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    font-weight: bold;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.student-menu li a i {
    margin-right: 12px;
    font-size: 1.2em;
    width: 25px;
    text-align: center;
    transition: color 0.3s;
}

/* Hover & Active Effects */
.student-menu li a:hover, .student-menu li a.active {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 5px 15px var(--card-shadow);
    color: white; /* Keep white for hover text on colored bg */
}

/* Specific Theme Overrides for Menu Text Color on Hover */
[data-theme="future"] .student-menu li a:hover, 
[data-theme="future"] .student-menu li a.active {
    color: #000;
}


.student-menu li a:active {
    transform: translateY(-1px) scale(0.98);
    box-shadow: 0 2px 5px var(--card-shadow);
}

/* Distinct Colors for Each Menu Item using Variables */
/* Home */
.menu-home { border-color: var(--menu-home) !important; color: var(--menu-home) !important; }
.menu-home i { color: var(--menu-home); }
.menu-home:hover, .menu-home.active { background: var(--menu-home) !important; color: white !important; }
.menu-home:hover i, .menu-home.active i { color: white; }

/* Notice */
.menu-notice { border-color: var(--menu-notice) !important; color: var(--menu-notice) !important; }
.menu-notice i { color: var(--menu-notice); }
.menu-notice:hover, .menu-notice.active { background: var(--menu-notice) !important; color: white !important; }
.menu-notice:hover i, .menu-notice.active i { color: white; }

/* Read */
.menu-read { border-color: var(--menu-read) !important; color: var(--menu-read) !important; }
.menu-read i { color: var(--menu-read); }
.menu-read:hover, .menu-read.active { background: var(--menu-read) !important; color: white !important; }
.menu-read:hover i, .menu-read.active i { color: white; }

/* Makeup */
.menu-makeup { border-color: var(--menu-makeup) !important; color: var(--menu-makeup) !important; }
.menu-makeup i { color: var(--menu-makeup); }
.menu-makeup:hover, .menu-makeup.active { background: var(--menu-makeup) !important; color: white !important; }
.menu-makeup:hover i, .menu-makeup.active i { color: white; }

/* History */
.menu-history { border-color: var(--menu-history) !important; color: var(--menu-history) !important; }
.menu-history i { color: var(--menu-history); }
.menu-history:hover, .menu-history.active { background: var(--menu-history) !important; color: white !important; }
.menu-history:hover i, .menu-history.active i { color: white; }

/* Rank */
.menu-rank { border-color: var(--menu-rank) !important; color: var(--menu-rank) !important; }
.menu-rank i { color: var(--menu-rank); }
.menu-rank:hover, .menu-rank.active { background: var(--menu-rank) !important; color: white !important; }
.menu-rank:hover i, .menu-rank.active i { color: white; }

/* Profile */
.menu-profile { border-color: var(--menu-profile) !important; color: var(--menu-profile) !important; }
.menu-profile i { color: var(--menu-profile); }
.menu-profile:hover, .menu-profile.active { background: var(--menu-profile) !important; color: white !important; }
.menu-profile:hover i, .menu-profile.active i { color: white; }

/* Removed Future Theme Text Color Override - Now using white text on soft colors */


/* Mobile Info in Sidebar */
.sidebar-info {
    display: none;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 2px dashed var(--sidebar-border);
}

.sidebar-info div {
    margin-bottom: 5px;
    font-size: 14px;
    color: var(--text-color);
    opacity: 0.8;
}

/* Content */
.student-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.content-card {
    background: var(--card-bg);
    border: 3px solid var(--card-border);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 5px 15px var(--card-shadow);
    margin-bottom: 25px;
    transition: background 0.3s, border-color 0.3s;
}

.content-card h2 {
    color: var(--primary-color);
    border-bottom: 2px solid var(--sidebar-border);
    padding-bottom: 10px;
    margin-top: 0;
}

/* Forms */
form {
    border: 2px solid var(--input-border);
    padding: 20px;
    border-radius: 15px;
    background: var(--card-bg);
    margin-bottom: 20px;
}

input[type="text"], input[type="password"], input[type="number"], select, textarea {
    border: 2px solid var(--input-border); 
    border-radius: 8px;
    padding: 10px;
    font-size: 16px;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.3s;
    background: var(--input-bg);
    color: var(--text-color);
}

input:focus, select:focus, textarea:focus {
    border-color: var(--input-focus);
    outline: none;
    box-shadow: 0 0 5px rgba(74, 180, 245, 0.5); /* Maybe variable-ize shadow too? */
}

[data-theme="future"] input:focus, [data-theme="future"] select:focus, [data-theme="future"] textarea:focus {
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}

/* Theme Switcher */
.theme-switch-wrapper {
    display: flex;
    align-items: center;
    margin-left: 15px;
}

.theme-switch-select {
    padding: 5px 10px;
    border-radius: 15px;
    border: none;
    background: rgba(255,255,255,0.2);
    color: var(--header-text);
    font-size: 14px;
    cursor: pointer;
    outline: none;
}
.theme-switch-select option {
    background: var(--bg-color);
    color: var(--text-color);
}

/* Login Page Refactor */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: var(--bg-color);
    padding: 20px;
    background-image: url('/uploads/back.png');
    background-size: 300px;
    background-repeat: no-repeat;
    background-position: bottom left;
    background-blend-mode: soft-light;
}

.login-wrapper {
    display: flex;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px var(--card-shadow);
    overflow: hidden;
    max-width: 900px;
    width: 100%;
    border: 4px solid var(--primary-color);
}

.login-left-panel {
    background: var(--primary-color);
    padding: 40px 30px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 20px;
    border-right: none;
    color: white;
    min-width: 250px;
}

.side-btn {
    width: 120px;
    height: 120px;
    border: none;
    border-radius: 15px;
    color: white;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.2;
}

.side-btn:hover { transform: scale(1.05); }

.btn-red { background: #ff7043; border: 2px solid white; }
.btn-orange { background: #ffa726; border: 2px solid white; }
.btn-yellow { background: #fdd835; color: #4a3b32; border: 2px solid white; }
.btn-green { background: #66bb6a; border: 2px solid white; }

.login-box {
    flex: 1;
    padding: 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-box h1 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 40px;
}

.login-btn {
    width: 100%;
    padding: 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    cursor: pointer;
    margin-top: 10px;
}

/* Article Page Styles */
.article-title {
    text-align: center;
    color: var(--text-color);
    margin-bottom: 5px;
}

.article-meta {
    display: flex;
    justify-content: space-between;
    color: var(--text-color);
    margin-bottom: 20px;
    border-bottom: 1px solid var(--sidebar-border);
    padding-bottom: 10px;
    opacity: 0.8;
}

.article-content {
    font-size: 18px;
    line-height: 1.8;
    color: var(--text-color);
    margin-bottom: 30px;
}

.audio-section {
    background: rgba(0,0,0,0.05);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 30px;
}

[data-theme="night"] .audio-section,
[data-theme="future"] .audio-section {
    background: rgba(255,255,255,0.05);
}

.section-title {
    margin-top: 0;
    color: var(--text-color);
}

.audio-player {
    width: 100%;
    margin-bottom: 10px;
}

.audio-playlist {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.audio-btn {
    background: var(--sidebar-border);
    color: var(--text-color);
    padding: 5px 10px;
    font-size: 12px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.3s;
}

.audio-btn:hover {
    filter: brightness(0.9);
}

.questions-section {
    margin-bottom: 30px;
}

.question-item {
    margin-bottom: 20px;
    background: var(--card-bg);
    border: 1px solid var(--sidebar-border);
    padding: 15px;
    border-radius: 8px;
}

.question-text {
    font-weight: bold;
    margin-top: 0;
    color: var(--text-color);
}

.option-label {
    display: block;
    margin-bottom: 5px;
    cursor: pointer;
    color: var(--text-color);
}

.submit-btn {
    background: #28a745;
    color: white;
    width: 100%;
    padding: 15px;
    font-size: 18px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s;
}

.submit-btn:hover {
    background: #218838;
}

/* Mobile Responsive */
@media (orientation: portrait) {
    .menu-toggle { display: block; }
    
    .header-info { display: none; } 
    
    .student-sidebar {
        position: fixed;
        left: 0;
        top: var(--header-height);
        height: calc(100vh - var(--header-height));
        width: 80%;
        max-width: 300px;
        transform: translateX(-100%); 
        opacity: 0; 
        z-index: 999;
        box-shadow: 2px 0 5px var(--card-shadow);
        transition: transform 0.3s ease, opacity 0.3s ease, background 0.3s; 
    }
    
    .student-sidebar.active {
        transform: translateX(0); 
        opacity: 1; 
    }
    
    .sidebar-info { display: block; } 
    
    .student-content { padding: 15px; }
    
    /* Login Mobile */
    .login-container {
        align-items: flex-start; 
        padding-top: 50px;
        flex-direction: column;
    }
    
    .login-wrapper {
        flex-direction: column;
        max-width: 400px;
        background: transparent;
        box-shadow: none;
    }
    
    .login-left-panel {
        display: none; 
    }
    
    .login-box {
        background: white;
        border-radius: 20px;
        box-shadow: 0 5px 15px rgba(0,0,0,0.1);
        padding: 30px;
    }
    
    .login-box h1 { margin-bottom: 20px; }
}
