/* Global Styles */
:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-glow: rgba(99, 102, 241, 0.5);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --nav-width: 250px;
    --transition-speed: 0.3s;
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Outfit', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Glassmorphism Utilities */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
    padding: 24px;
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}

.glass-panel:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 40px rgba(99, 102, 241, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Layout & Screens */
.screen {
    display: none;
    height: 100%;
    width: 100%;
}

.screen.active {
    display: flex;
}

/* --- LOGIN PAGE REFINED --- */
#login-section {
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at 50% 50%, #2e1065, #0f172a 70%);
    position: absolute;
    /* Changed from relative to absolute to overlay */
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    z-index: 2000;
    /* High Z-index to ensure it sits on top */
}

/* Decorative background elements for Login */
#login-section::before,
#login-section::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    filter: blur(80px);
    z-index: 0;
}

#login-section::before {
    background: rgba(99, 102, 241, 0.3);
    top: -50px;
    left: -50px;
}

#login-section::after {
    background: rgba(236, 72, 153, 0.2);
    /* Pinkish glow */
    bottom: -50px;
    right: -50px;
}

.login-container {
    width: 100%;
    max-width: 420px;
    text-align: center;
    padding: 40px;
    background: rgba(15, 23, 42, 0.6);
    /* Darker glass for better contrast */
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1;
    position: relative;
}

.login-container h1 {
    font-size: 2.2rem;
    margin-bottom: 8px;
    background: linear-gradient(to right, #fff, #a5b4fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

.login-container p {
    color: var(--text-secondary);
    margin-bottom: 35px;
    font-size: 0.95rem;
}

.input-group,
.captcha-group {
    margin-bottom: 24px;
    text-align: left;
    position: relative;
}

.input-group label,
.captcha-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

input,
select {
    width: 100%;
    padding: 14px 16px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: all 0.2s ease;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: rgba(15, 23, 42, 0.9);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

/* Button Refinements */
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-small {
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    letter-spacing: 0.3px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    width: 100%;
    box-shadow: 0 10px 20px -5px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px -5px rgba(99, 102, 241, 0.5);
    filter: brightness(1.1);
}

.btn-primary:active {
    transform: scale(0.98);
}

/* --- PRIORITY TASKS UI --- */
#view-home .card h3 {
    margin-bottom: 20px;
}

.task-list {
    list-style: none;
    padding: 0;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.task-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    transition: all 0.2s;
    animation: fadeIn 0.3s ease-out;
}

.task-item:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.1);
}

/* Custom Checkbox */
.custom-checkbox {
    position: relative;
    cursor: pointer;
    user-select: none;
    width: 20px;
    height: 20px;
    margin-right: 15px;
}

.custom-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 20px;
    width: 20px;
    background-color: transparent;
    border: 2px solid var(--text-secondary);
    border-radius: 6px;
    transition: all 0.2s;
}

.custom-checkbox:hover input~.checkmark {
    border-color: var(--accent-primary);
}

.custom-checkbox input:checked~.checkmark {
    background-color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.custom-checkbox input:checked~.checkmark:after {
    display: block;
}

.custom-checkbox .checkmark:after {
    left: 6px;
    top: 2px;
    width: 4px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.task-text {
    flex: 1;
    font-size: 0.95rem;
    color: var(--text-primary);
    transition: all 0.2s;
}

.task-item.completed .task-text {
    text-decoration: line-through;
    color: var(--text-secondary);
    opacity: 0.7;
}

/* Add Task Button Styling */
.btn-add-task {
    background: rgba(255, 255, 255, 0.05);
    color: var(--accent-primary);
    border: 1px dashed rgba(99, 102, 241, 0.3);
    width: 100%;
    padding: 12px;
    margin-top: 10px;
    border-radius: 12px;
    transition: all 0.2s;
}

.btn-add-task:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--accent-primary);
    transform: translateY(-1px);
}

/* --- CALENDAR UPDATES --- */
.calendar-wrapper h3 {
    margin-bottom: 5px;
}

.subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.calendar-container {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    text-align: center;
}

.calendar-day-header {
    font-weight: bold;
    font-size: 0.8rem;
    color: var(--accent-secondary);
    margin-bottom: 5px;
}

.calendar-day {
    padding: 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: default;
}

.calendar-day.empty {
    background: transparent;
}

.calendar-day.active {
    background: var(--accent-primary);
    color: white;
    font-weight: bold;
}

.calendar-day.today {
    border: 1px solid var(--accent-secondary);
}

/* --- OTHER EXISTING STYLES (Preserved) --- */
.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.8rem;
    width: auto;
}

#dashboard-section {
    display: grid;
    grid-template-columns: var(--nav-width) 1fr;
    height: 100vh;
}

.sidebar {
    background: var(--bg-secondary);
    padding: 20px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--glass-border);
}

.brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-primary);
    margin-bottom: 40px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-links {
    list-style: none;
    flex: 1;
}

.nav-links li {
    padding: 14px 16px;
    margin-bottom: 8px;
    border-radius: 10px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-links li:hover,
.nav-links li.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent-primary);
}

.user-profile-mini {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 20px;
    border-top: 1px solid var(--glass-border);
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(45deg, var(--accent-primary), var(--accent-secondary));
}

.info h4 {
    font-size: 0.9rem;
    margin-bottom: 2px;
}

.info span {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.main-content {
    padding: 30px;
    overflow-y: auto;
    position: relative;
    background: radial-gradient(circle at top right, #1e293b, #0f172a);
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.greeting h2 {
    font-size: 1.8rem;
    margin-bottom: 5px;
}

.greeting p {
    color: var(--text-secondary);
    font-style: italic;
}

.gamification-stats {
    display: flex;
    gap: 15px;
}

.stat-badge {
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #fbbf24;
}

.view {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.view.active {
    display: block;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.countdown-card {
    grid-column: span 1;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.2));
    border: 1px solid rgba(99, 102, 241, 0.3);
}

@media (min-width: 1024px) {
    .countdown-card {
        grid-column: span 2;
    }
}

.countdown-timer {
    display: flex;
    justify-content: space-around;
    margin-top: 15px;
    text-align: center;
}

.countdown-timer div {
    display: flex;
    flex-direction: column;
}

.countdown-timer span {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.countdown-timer label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Warning Box */
.warning-box {
    margin-top: 15px;
    padding: 10px;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid #ef4444;
    border-radius: 8px;
    color: #fca5a5;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
}

.warning-box.hidden {
    display: none;
}

/* Analytics Layout */
.analytics-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

.chart-box {
    min-height: 300px;
    position: relative;
    height: 300px;
}

.log-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.log-controls input {
    flex: 1;
}

/* Planner Tabs */
.planner-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-btn {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn.active,
.tab-btn:hover {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.planner-display {
    min-height: 400px;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    width: 90%;
    max-width: 500px;
    text-align: center;
}

.setup-step {
    display: none;
}

.setup-step.active {
    display: block;
}

/* Footer */
.main-footer {
    text-align: center;
    padding: 15px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    margin-top: auto;
    border-top: 1px solid var(--glass-border);
    width: 100%;
}

/* Specific Page Overrides */
.paper-controls-row {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.achievements-grid {
    min-height: 200px;
    display: flex;
    flex-direction: column;
}

#badges-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.badge-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.badge-icon {
    width: 50px;
    height: 50px;
    background: var(--glass-border);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    margin-bottom: 5px;
    color: gold;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    #dashboard-section {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 60px;
        padding: 0;
        border-top: 1px solid var(--glass-border);
        border-right: none;
        background: var(--bg-secondary);
        z-index: 1000;
        flex-direction: row;
        width: 100%;
    }

    .brand,
    .user-profile-mini {
        display: none;
    }

    .nav-links {
        display: flex;
        justify-content: space-around;
        align-items: center;
        width: 100%;
        margin: 0;
        padding: 0;
    }

    .nav-links li {
        flex-direction: column;
        gap: 4px;
        padding: 5px;
        font-size: 0.7rem;
        margin: 0;
        border-radius: 0;
        background: none !important;
    }

    .nav-links li i {
        font-size: 1.2rem;
    }

    .nav-links li.active {
        color: var(--accent-primary);
    }

    .main-content {
        padding-bottom: 80px;
        padding-top: 20px;
        padding-left: 15px;
        padding-right: 15px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .countdown-card {
        grid-column: span 1;
    }

    .paper-controls-row {
        flex-direction: column;
    }

    .charts-container {
        grid-template-columns: 1fr;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}