* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    transition: background 0.3s ease;
}
body.light {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) fixed;
}
body.dark {
    /* Updated to a sleek modern navy blue gradient */
    background: linear-gradient(135deg, #0a192f 0%, #172a45 100%) fixed;
}

/* Header Layout Setup */
.header {
    position: relative;
    display: flex;
    justify-content: center; /* Centers the brand container */
    align-items: center;
    padding: 20px 40px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(16px);
    border-radius: 0 0 20px 20px;
}
.brand-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}
.title {
    font-size: 28px;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}
.tagline {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.9);
    margin-top: 5px;
    font-weight: 500;
}
.dark-toggle {
    position: absolute; /* Pinned to right corner */
    top: 25px;
    right: 40px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.3s ease;
    backdrop-filter: blur(16px);
}
.dark-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.nav-tabs {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(16px);
}
.nav-tab {
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.8);
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    backdrop-filter: blur(16px);
}
.nav-tab.active, .nav-tab:hover {
    background: rgba(255, 255, 255, 0.3);
    color: white;
    transform: translateY(-2px);
}

/* Tabs Display Logic */
.content {
    flex: 1; /* Takes up all available space, pushing footer down naturally */
    width: 100%;
    max-width: 1000px; /* Limits width on ultra-wide screens */
    margin: 0 auto;
    padding: 40px;
    display: none; 
    flex-direction: column;
}
.content.active {
    display: block; 
}

.glass-card {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(16px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 30px;
    margin-bottom: 20px;
    color: white;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}
h2 {
    margin-bottom: 20px;
    color: rgba(255,255,255,0.9);
}
.form-group {
    margin-bottom: 20px;
}
label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
}
input, select, textarea {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: white;
    font-size: 16px;
    backdrop-filter: blur(10px);
}
input::placeholder, textarea::placeholder {
    color: rgba(255, 255, 255, 0.6);
}
input:focus, textarea:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.2);
}
button {
    background: rgba(255, 255, 255, 0.3);
    border: none;
    color: white;
    padding: 12px 24px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}
button:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
}
.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
}
.btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    margin-left: 10px;
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
}
.percentage-circle {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: conic-gradient(#4ade80 0deg, #f87171 var(--percentage, 0deg));
    margin: 20px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: bold;
    color: white;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
    position: relative;
}
.percentage-circle::after {
    content: '';
    position: absolute;
    width: 160px;
    height: 160px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    backdrop-filter: blur(10px);
}
.badge {
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 14px;
    display: inline-block;
}
.badge.green { background: rgba(74, 222, 128, 0.4); color: #4ade80; }
.badge.red { background: rgba(248, 113, 113, 0.4); color: #f87171; }
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin: 20px 0;
}
.stat-card {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 16px;
    text-align: center;
    backdrop-filter: blur(10px);
}
.stat-number {
    font-size: 36px;
    font-weight: bold;
    color: white;
}
.warning-box {
    background: rgba(251, 191, 36, 0.3);
    border: 1px solid rgba(251, 191, 36, 0.5);
    padding: 20px;
    border-radius: 12px;
    margin: 20px 0;
}
.success-box {
    background: rgba(74, 222, 128, 0.3);
    border: 1px solid rgba(74, 222, 128, 0.5);
    padding: 20px;
    border-radius: 12px;
    margin: 20px 0;
}
.subject-list {
    max-height: 400px;
    overflow-y: auto;
}
.subject-card {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 15px;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 15px;
}
.chart-container {
    position: relative;
    height: 300px;
    margin: 20px 0;
}
.day-checkboxes {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin: 20px 0;
}
.day-checkboxes input[type="checkbox"] {
    transform: scale(0.8);
    width: 16px !important;
    height: 16px !important;
    margin-right: 8px;
}
.day-checkboxes label {
    display: flex;
    align-items: center;
    font-size: 14px;
    padding: 8px;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    cursor: pointer;
}
.email-draft {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 12px;
    white-space: pre-wrap;
    font-family: monospace;
    font-size: 14px;
    max-height: 400px;
    overflow-y: auto;
    margin-top: 10px;
}
.footer {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(16px);
    border-radius: 20px 20px 0 0;
    padding: 15px 25px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    margin-top: auto;
    width: 100%;
}

/* Mobile & Tablet Responsive Rules */
@media (max-width: 1024px) and (min-width: 769px) {
    .content { padding: 30px; }
    .glass-card { padding: 25px; }
    .nav-tab { padding: 10px 20px; font-size: 14px; }
}

@media (max-width: 768px) {
    .header { 
        padding: 20px 15px; 
    }
    .brand-container {
        padding-right: 40px; 
        padding-left: 40px;
    }
    .dark-toggle {
        top: 20px;
        right: 15px;
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    .title { font-size: 22px; }
    .tagline { font-size: 12px; }
    
    .nav-tabs { 
        padding: 15px 10px;
        gap: 8px;
    }
    .nav-tab { 
        padding: 10px 15px; 
        font-size: 14px; 
        flex: 1 1 45%;
        min-width: 80px;
        text-align: center;
    }
    .content { 
        padding: 15px 10px;
    }
    .glass-card { 
        padding: 20px 15px; 
        margin-bottom: 15px;
        border-radius: 15px;
    }
    h2 { font-size: 20px; margin-bottom: 15px; }
    input, textarea { 
        padding: 12px; 
        font-size: 16px; 
    }
    button { 
        padding: 12px 16px; 
        font-size: 15px;
    }
    .percentage-circle { 
        width: 150px; 
        height: 150px; 
        font-size: 36px; 
        margin: 15px auto;
    }
    .percentage-circle::after { width: 120px; height: 120px; }
    .stats-grid { grid-template-columns: 1fr; gap: 15px; }
    .stat-number { font-size: 28px; }
    .chart-container { height: 250px; }
    .day-checkboxes { 
        grid-template-columns: repeat(3, 1fr); 
        gap: 8px; 
    }
    .footer { 
        padding: 12px 20px; 
    }
}

@media (max-width: 480px) {
    .nav-tab { 
        flex: 1 1 100%; 
        font-size: 13px; 
        padding: 8px 12px;
    }
    .glass-card { padding: 15px 12px; }
    .percentage-circle { width: 120px; height: 120px; font-size: 28px; }
    .percentage-circle::after { width: 96px; height: 96px; }
    .content { padding: 10px 8px; }
}
