@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

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

:root {
    --primary: #35c7ff;
    --accent: #22d3ee;
    --bg-0: #061626;
    --bg-1: #0a1f35;
    --bg-2: #12315a;
    --card-bg: rgba(10, 25, 45, 0.68);
    --sidebar-bg: rgba(8, 20, 36, 0.78);
    --text: #e9f4ff;
    --text-sec: #9cb5cb;
    --text-strong: #f7fbff;
    --border: rgba(120, 171, 210, 0.25);
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    --bg-wave-opacity: 0.62;
    --input-bg: rgba(10, 24, 41, 0.55);
    --input-bg-focus: rgba(8, 24, 44, 0.78);
    --placeholder: #8ba7c2;
    --on-primary: #042038;
}

body {
    font-family: 'Plus Jakarta Sans', 'Poppins', 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, var(--bg-0) 0%, var(--bg-1) 48%, var(--bg-2) 100%);
    color: var(--text);
    overflow-x: hidden;
    min-height: 100vh;
    transition: color 260ms ease, background 380ms ease;
}

.bg-waves {
    position: fixed;
    inset: -20%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.wave {
    position: absolute;
    width: 160vw;
    height: 160vw;
    border-radius: 42%;
    left: 50%;
    top: 50%;
    transform-origin: 50% 50%;
    opacity: var(--bg-wave-opacity);
    filter: blur(2px);
}

.wave-1 {
    background: radial-gradient(circle at 30% 30%, rgba(53, 199, 255, 0.5), rgba(53, 199, 255, 0.04) 58%, transparent 72%);
    transform: translate(-50%, -50%);
    animation: driftWaveA 20s linear infinite;
}

.wave-2 {
    background: radial-gradient(circle at 70% 35%, rgba(34, 211, 238, 0.4), rgba(34, 211, 238, 0.03) 55%, transparent 76%);
    transform: translate(-42%, -45%);
    animation: driftWaveB 26s linear infinite reverse;
}

.wave-3 {
    background: radial-gradient(circle at 50% 68%, rgba(59, 130, 246, 0.34), rgba(59, 130, 246, 0.03) 56%, transparent 74%);
    transform: translate(-58%, -54%);
    animation: driftWaveC 32s linear infinite;
}

@keyframes driftWaveA {
    0% { transform: translate(-50%, -50%) rotate(0deg) scale(1); }
    50% { transform: translate(-48%, -55%) rotate(180deg) scale(1.08); }
    100% { transform: translate(-50%, -50%) rotate(360deg) scale(1); }
}

@keyframes driftWaveB {
    0% { transform: translate(-42%, -45%) rotate(0deg) scale(1); }
    50% { transform: translate(-44%, -40%) rotate(180deg) scale(1.06); }
    100% { transform: translate(-42%, -45%) rotate(360deg) scale(1); }
}

@keyframes driftWaveC {
    0% { transform: translate(-58%, -54%) rotate(0deg) scale(1.02); }
    50% { transform: translate(-54%, -52%) rotate(180deg) scale(1.1); }
    100% { transform: translate(-58%, -54%) rotate(360deg) scale(1.02); }
}

.theme-wave {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1500;
    opacity: 0;
    --wave-inner: rgba(53, 199, 255, 0.2);
    --wave-mid: rgba(10, 24, 41, 0.52);
    --wave-edge: rgba(2, 8, 20, 0.88);
    --wave-tail: rgba(0, 0, 0, 0.94);
    --wave-ring: rgba(103, 232, 249, 0.55);
    --wave-glow: rgba(56, 189, 248, 0.4);
    backdrop-filter: blur(0);
}

.theme-wave::before {
    content: "";
    position: absolute;
    left: var(--wave-x, 15%);
    top: var(--wave-y, 50%);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: radial-gradient(
        circle,
        var(--wave-inner) 0% 32%,
        var(--wave-mid) 52% 66%,
        var(--wave-edge) 72% 79%,
        var(--wave-tail) 100%
    );
    opacity: 0;
}

.theme-wave::after {
    content: "";
    position: absolute;
    left: var(--wave-x, 15%);
    top: var(--wave-y, 50%);
    width: 26px;
    height: 26px;
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: radial-gradient(
        circle,
        rgba(255, 255, 255, 0.95) 0% 7%,
        var(--wave-ring) 22% 40%,
        transparent 64%
    );
    box-shadow: 0 0 46px 14px var(--wave-glow);
    opacity: 0;
}

.theme-wave.active {
    opacity: 1;
    backdrop-filter: blur(0.8px);
}

.theme-wave.active.to-dark {
    animation: overlayFadeDark 2200ms cubic-bezier(0.22, 0.66, 0.2, 1) forwards;
}

.theme-wave.active.to-dark::before {
    animation: waveExpandDark 2200ms cubic-bezier(0.2, 0.68, 0.2, 1) forwards;
}

.theme-wave.active.to-dark::after {
    animation: waveRingDark 2200ms cubic-bezier(0.2, 0.68, 0.2, 1) forwards;
}

.theme-wave.active.to-light {
    animation: overlayFadeLight 1750ms cubic-bezier(0.24, 0.64, 0.2, 1) forwards;
}

.theme-wave.active.to-light::before {
    animation: waveExpandLight 1750ms cubic-bezier(0.22, 0.66, 0.2, 1) forwards;
}

.theme-wave.active.to-light::after {
    animation: waveRingLight 1750ms cubic-bezier(0.22, 0.66, 0.2, 1) forwards;
}

.theme-wave.to-light {
    --wave-inner: rgba(255, 255, 255, 0.78);
    --wave-mid: rgba(125, 211, 252, 0.52);
    --wave-edge: rgba(45, 212, 191, 0.42);
    --wave-tail: rgba(222, 247, 255, 0.72);
    --wave-ring: rgba(255, 255, 255, 0.7);
    --wave-glow: rgba(125, 211, 252, 0.55);
}

.theme-wave.to-dark {
    --wave-inner: rgba(56, 189, 248, 0.14);
    --wave-mid: rgba(10, 24, 41, 0.62);
    --wave-edge: rgba(2, 8, 20, 0.92);
    --wave-tail: rgba(0, 0, 0, 0.98);
    --wave-ring: rgba(34, 211, 238, 0.48);
    --wave-glow: rgba(6, 182, 212, 0.35);
}

@keyframes overlayFadeDark {
    0% {
        opacity: 0.04;
    }
    42% {
        opacity: 0.28;
    }
    74% {
        opacity: 0.2;
    }
    100% {
        opacity: 0;
    }
}

@keyframes overlayFadeLight {
    0% {
        opacity: 0.06;
    }
    35% {
        opacity: 0.34;
    }
    68% {
        opacity: 0.24;
    }
    100% {
        opacity: 0;
    }
}

@keyframes waveExpandDark {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.25);
        filter: brightness(1);
    }
    22% {
        opacity: 0.82;
        transform: translate(-50%, -50%) scale(58);
        filter: brightness(0.86);
    }
    48% {
        opacity: 0.9;
        transform: translate(-50%, -50%) scale(110);
        filter: brightness(0.72);
    }
    72% {
        opacity: 0.7;
        transform: translate(-50%, -50%) scale(158);
        filter: brightness(0.62);
    }
    90% {
        opacity: 0.28;
        transform: translate(-50%, -50%) scale(192);
        filter: brightness(0.54);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(212);
        filter: brightness(0.52);
    }
}

@keyframes waveExpandLight {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.25);
    }
    22% {
        opacity: 0.88;
        transform: translate(-50%, -50%) scale(62);
    }
    48% {
        opacity: 0.76;
        transform: translate(-50%, -50%) scale(112);
    }
    74% {
        opacity: 0.4;
        transform: translate(-50%, -50%) scale(156);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(196);
    }
}

@keyframes waveRingDark {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.2);
    }
    18% {
        opacity: 0.92;
        transform: translate(-50%, -50%) scale(36);
    }
    45% {
        opacity: 0.7;
        transform: translate(-50%, -50%) scale(86);
    }
    72% {
        opacity: 0.3;
        transform: translate(-50%, -50%) scale(132);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(188);
    }
}

@keyframes waveRingLight {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.2);
    }
    16% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(34);
    }
    42% {
        opacity: 0.82;
        transform: translate(-50%, -50%) scale(84);
    }
    70% {
        opacity: 0.34;
        transform: translate(-50%, -50%) scale(128);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(176);
    }
}

.container {
    display: flex;
    height: 100vh;
    position: relative;
    z-index: 2;
}

.sidebar {
    width: 280px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 1000;
}

.logo {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    margin-bottom: 2rem;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

nav {
    flex: 1;
}

.nav-item {
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--text-sec);
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(53, 199, 255, 0.12);
    color: var(--text);
}

.nav-item.active {
    background: rgba(53, 199, 255, 0.2);
    color: var(--primary);
    border-left: 3px solid var(--primary);
}

.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.main-content {
    flex: 1;
    margin-left: 280px;
    overflow-y: auto;
    padding: 2rem;
}

.header-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.section {
    display: none;
    animation: fadeIn 0.4s;
}

.section.active {
    display: block;
}

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

h1 {
    font-size: 1.8rem;
    color: var(--text-strong);
    margin-bottom: 1.5rem;
}

h3 {
    color: var(--text-strong);
    margin-bottom: 1rem;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: linear-gradient(135deg, rgba(53, 199, 255, 0.13), rgba(34, 211, 238, 0.08));
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1.5rem;
    backdrop-filter: blur(8px);
}

.stat-num {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1.5rem;
    backdrop-filter: blur(8px);
    margin-bottom: 1.5rem;
    transition: border-color 220ms ease, box-shadow 220ms ease;
}

.card:hover {
    border-color: var(--primary);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.subjects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 340px));
    gap: 1rem;
    align-items: start;
}

#upcomingDeadlines {
    width: min(100%, 760px);
}

.form-input,
textarea {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    background: var(--input-bg);
    color: var(--text-strong);
    font-family: inherit;
    transition: all 0.3s;
}

.form-input:focus,
textarea:focus {
    outline: none;
    background: var(--input-bg-focus);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(53, 199, 255, 0.15);
}

.form-input::placeholder,
textarea::placeholder {
    color: var(--placeholder);
    opacity: 1;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
}

.btn-primary {
    background: var(--primary);
    color: var(--on-primary);
}

.btn-primary:hover {
    background: #24b7ee;
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--card-bg);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: rgba(53, 199, 255, 0.08);
}

.btn-danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    width: 100%;
    margin-bottom: 0.5rem;
}

.theme-toggle {
    width: 100%;
    margin-bottom: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    background: rgba(53, 199, 255, 0.08);
    color: var(--text);
    padding: 0.5rem 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    cursor: pointer;
    transition-property: transform, color, background-color, border-color, box-shadow;
    transition-duration: 0.2s;
    transition-timing-function: cubic-bezier(0.2, 0.7, 0.2, 1);
}

.theme-toggle:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: rgba(53, 199, 255, 0.14);
    box-shadow: 0 10px 24px rgba(3, 9, 20, 0.18);
}

.theme-toggle:active {
    transform: translateY(1px);
}

.theme-toggle:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(53, 199, 255, 0.24);
}

.reset-toggle {
    border-radius: 0.75rem;
    border-width: 1px;
    transition-property: transform, color, background-color, border-color, box-shadow;
    transition-duration: 0.2s;
    transition-timing-function: cubic-bezier(0.2, 0.7, 0.2, 1);
}

.reset-toggle:hover {
    box-shadow: 0 10px 24px rgba(25, 3, 3, 0.2);
}

.reset-toggle:active {
    transform: translateY(1px);
}

.theme-toggle-icon {
    width: 1.35rem;
    height: 1.35rem;
    position: relative;
    flex: 0 0 1.35rem;
}

.theme-toggle-icon .icon {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transition-property: transform, opacity, color;
    transition-duration: 0.2s;
    transition-timing-function: cubic-bezier(0.2, 0.7, 0.2, 1);
}

.theme-toggle-icon .icon-sun {
    opacity: 0;
    transform: rotate(80deg) scale(0.45);
}

.theme-toggle-icon .icon-moon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.theme-toggle-label {
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

body.light-theme .theme-toggle-icon .icon-sun {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

body.light-theme .theme-toggle-icon .icon-moon {
    opacity: 0;
    transform: rotate(-75deg) scale(0.45);
}

body.light-theme .theme-toggle {
    background: rgba(14, 165, 233, 0.08);
}

.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    animation: fadeIn 0.3s;
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h2 {
    color: var(--text-strong);
    margin-bottom: 1.5rem;
}

.modal-footer {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

th {
    background: rgba(53, 199, 255, 0.08);
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-sec);
    font-size: 0.85rem;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

tr:hover {
    background: rgba(53, 199, 255, 0.06);
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-primary {
    background: rgba(53, 199, 255, 0.2);
    color: var(--primary);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.progress-bar {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 4px;
    transition: width 0.3s;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-sec);
}

.empty-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

@media (max-width: 768px) {
    .sidebar {
        width: 70px;
        padding: 1rem 0.5rem;
    }

    .main-content {
        margin-left: 70px;
        padding: 1rem;
    }

    .logo {
        font-size: 0;
        margin-bottom: 1rem;
    }

    .nav-item {
        text-align: center;
        padding: 0.75rem;
        margin-bottom: 0.25rem;
    }

    .theme-toggle-label {
        display: none;
    }

    .theme-toggle {
        padding: 0.55rem;
        min-height: 2.25rem;
    }

    .header-section {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .stats {
        grid-template-columns: 1fr;
    }

    .grid {
        grid-template-columns: 1fr;
    }

    .subjects-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
    }

    h1 {
        font-size: 1.3rem;
    }

    table {
        font-size: 0.85rem;
    }

    th, td {
        padding: 0.75rem 0.5rem;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 0.75rem;
    }

    .card {
        padding: 1rem;
    }

    .stat-num {
        font-size: 1.5rem;
    }
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(53, 199, 255, 0.34);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(53, 199, 255, 0.52);
}

body.light-theme {
    --primary: #0ea5e9;
    --accent: #10b981;
    --bg-0: #eef7ff;
    --bg-1: #e4f3ff;
    --bg-2: #d9f0ff;
    --card-bg: rgba(255, 255, 255, 0.68);
    --sidebar-bg: rgba(255, 255, 255, 0.77);
    --text: #0d2337;
    --text-sec: #3f5e76;
    --text-strong: #081b2e;
    --border: rgba(54, 107, 147, 0.24);
    --bg-wave-opacity: 0.56;
    --input-bg: rgba(255, 255, 255, 0.84);
    --input-bg-focus: rgba(255, 255, 255, 0.97);
    --placeholder: #6c859a;
    --on-primary: #04253a;
    background: linear-gradient(135deg, var(--bg-0) 0%, var(--bg-1) 48%, var(--bg-2) 100%);
}

body.light-theme .sidebar {
    background: var(--sidebar-bg);
}

body.light-theme .nav-item {
    color: var(--text-sec);
}

body.light-theme .nav-item:hover,
body.light-theme .nav-item.active {
    color: var(--primary);
}

body.light-theme .card {
    background: var(--card-bg);
}

label {
    display: block;
    margin-bottom: 0.75rem;
    color: var(--text-sec);
    cursor: pointer;
}

label input {
    margin-right: 0.5rem;
}

@media (prefers-reduced-motion: reduce) {
    .wave,
    .theme-wave.active,
    .section {
        animation: none !important;
    }
    .card,
    .btn,
    .nav-item,
    .theme-toggle,
    .theme-toggle-icon .icon {
        transition: none !important;
    }
}
