:root {
    --status-active: #facc15;
    --status-pending: #f87171;
    --status-done: #4ade80;
    --panel-bg: rgba(20, 20, 20, 0.6);
    --border-dim: rgba(255, 255, 255, 0.08);
}

/* Force browser to use dark system UI for date/select menus */
html {
    color-scheme: dark;
}

/* 5-Area Grid Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 650px 350px;
    grid-template-rows: 480px 170px;
    /* Force rows to align across columns */
    gap: 20px;
    margin-top: 20px;
    max-width: 1040px;
    margin-inline: auto;
    /* Force horizontal centering */
}

/* Panel Containers */
.admin-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-dim);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    background: rgba(255, 255, 255, 0.03);
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-dim);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-title {
    font-size: 0.75rem;
    font-weight: bold;
    color: var(--accent-color);
    letter-spacing: 0.1rem;
    text-transform: uppercase;
}

.panel-body {
    padding: 15px;
    overflow-y: auto;
    /* Internal scrolling as requested */
}

/* Left Column Elements */
/* Left Column Elements */
#project-panel {
    height: 480px;
    /* Reduced from 500 */
    grid-row: 1;
    grid-column: 1;
}

#event-panel {
    height: 170px;
    /* Reduced to match Memo */
    grid-row: 2;
    grid-column: 1;
}

#event-panel .panel-body {
    overflow-y: hidden;
    /* Force no vertical scroll as cards are horizontal */
}


/* Nuclear fix for modal animation */
.modal-form,
.modal-form * {
    animation: none !important;
    transform: none !important;
    transition: none !important;
}


/* Right Column Elements */
#right-column {
    display: contents;
    /* Allows children to participate in the grid directly */
}

#task-panel {
    height: 480px;
    /* Match project panel height */
    grid-row: 1;
    grid-column: 2;
}

#memo-panel {
    height: 170px;
    /* Match event panel height */
    grid-row: 2;
    grid-column: 2;
}

/* Project Specifics */
.project-tabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--border-dim);
    overflow-x: visible;
    /* Changed from auto to visible for dropdown */
    align-items: flex-end;
    /* Force bottom alignment */
    height: 38px;
    /* Fixed height container */
}

.project-tab {
    padding: 8px 10px;
    /* Slightly tighter padding for auto-width */
    font-size: 0.75rem;
    cursor: pointer;
    border: 1px solid transparent;
    border-bottom: none;
    background: rgba(0, 0, 0, 0.2);
    /* Dynamic width logic */
    width: auto;
    max-width: 115px;
    min-width: 60px;
    /* Ensure they aren't too tiny */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    position: relative;
    /* No border radius as requested */
    margin-bottom: -1px;
    /* Overlap the container border */
}

.project-tab.active {
    background: var(--accent-color);
    color: black;
    font-weight: bold;
    border-bottom: 1px solid var(--accent-color);
    /* Match background */
    z-index: 10;
}

/* Red Dot Notifier */
.urgent-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 6px;
    height: 6px;
    background-color: #ef4444;
    border-radius: 50%;
    z-index: 10;
    pointer-events: none;
    animation: pulse 2s infinite;
}

/* Dropdown Menu Styles */
.project-overflow-container {
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border-left: 1px solid var(--border-dim);
    margin-left: auto;
    /* Push to the right */
    height: 100%;
    /* Fill height */
    align-self: stretch;
    /* Ensure it stretches in flex container */
}

.project-more-btn {
    width: 33.67px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-color);
    cursor: pointer;
    background: transparent;
    transition: transform 0.2s ease;
    font-size: 0.6rem;
    /* Smaller icon size */
}

.project-more-btn.overflow-active {
    color: #4ade80;
    /* Green color for active overflow */
}

.project-more-btn.active {
    transform: rotate(-90deg);
    /* Rotate -90 to point down */
}

.project-more-btn:hover {
    color: white;
}

.projects-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    width: 160px;
    background: #0a0a0a;
    border: 1px solid var(--border-dim);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    display: none;
    flex-direction: column;
    max-height: 200px;
    overflow-y: auto;
    z-index: 999;
    backdrop-filter: blur(10px);
}

.projects-dropdown-menu.show {
    display: flex;
}

.dropdown-item {
    padding: 8px 12px;
    font-size: 0.75rem;
    color: #a0a0a0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}



.dropdown-item.active {
    color: var(--accent-color);
    font-weight: bold;
    border-left: 2px solid var(--accent-color);
}

.subtask-item {
    padding: 8px 12px;
    margin-bottom: 5px;
    border-left: 3px solid transparent;
    transition: all 0.2s;
}

.subtask-active {
    border-color: var(--status-active);
    background: rgba(250, 204, 21, 0.05);
}

.subtask-pending {
    border-color: var(--status-pending);
    background: rgba(248, 113, 113, 0.05);
}

.subtask-done {
    border-color: var(--status-done);
    background: rgba(74, 222, 128, 0.05);
    opacity: 0.6;
}

/* Event Cards - Horizontal */
.event-cards {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.event-card {
    flex: 0 0 180px;
    height: 90px;
    /* Fixed height for consistency */
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-dim);
    padding: 12px;
    border-radius: 4px;
    cursor: pointer;
    overflow: hidden;
}

.event-card:hover {
    border-color: var(--accent-color);
}

/* Memo Search Input */
.memo-search {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-dim);
    color: var(--primary-color);
    padding: 8px 12px;
    font-size: 0.8rem;
    margin-bottom: 15px;
    border-radius: 4px;
}

/* Form Shared Styles */
.form-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--primary-color);
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-family: inherit;
    transition: all 0.2s;
}

.form-input option {
    background-color: #1a1a1a;
    /* Dark background for options */
    color: var(--primary-color);
}

/* Accentuated Date Picker Icon */
.form-input::-webkit-calendar-picker-indicator {
    filter: invert(50%) sepia(100%) saturate(500%) hue-rotate(110deg);
    cursor: pointer;
    transition: transform 0.2s;
}

.form-input::-webkit-calendar-picker-indicator:hover {
    transform: scale(1.2);
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 10px rgba(0, 255, 157, 0.1);
}

/* Modal Styling */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-form {
    padding: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 450px;
    width: 100%;
    /* Removed slideUp animation to prevent floating */
}

/* Scrollbar Styling */
.panel-body::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

.panel-body::-webkit-scrollbar-track {
    background: transparent;
}

.panel-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.panel-body::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

/* --- MOBILE / TABLET RESPONSIVE OVERRIDES --- */
@media (max-width: 1050px) {

    /* 1. Unlock Body Scrolling */
    body {
        overflow-y: auto !important;
        height: auto !important;
        align-items: flex-start !important;
        /* Top align to avoid cutting off header */
        padding-top: 20px;
        padding-bottom: 60px;
    }

    /* 2. Reset Container */
    #dashboard-container {
        width: 100% !important;
        height: auto !important;
        padding: 10px !important;
        overflow: visible !important;
    }

    /* Ensure hidden stays hidden even on mobile */
    #dashboard-container.hidden {
        display: none !important;
    }

    /* 3. Break Grid into Vertical Stack */
    .dashboard-grid {
        display: flex !important;
        flex-direction: column;
        width: 100%;
        margin-top: 15px;
        gap: 20px;
        grid-template-rows: unset !important;
        grid-template-columns: unset !important;
    }

    /* 4. Reset Panel Positioning & Sizing */
    #project-panel,
    #event-panel,
    #task-panel,
    #memo-panel {
        grid-row: auto !important;
        grid-column: auto !important;
        width: 100%;
        /* Let them stack naturally */
    }

    /* 5. Adjust Heights for Mobile Comfort */
    #project-panel {
        height: 500px;
        order: 1;
    }

    /* Main focus */
    #task-panel {
        height: 400px;
        order: 2;
    }

    /* Tasks second */
    #event-panel {
        height: 180px;
        order: 3;
    }

    #memo-panel {
        height: 250px;
        order: 4;
    }

    /* Taller memo for mobile typing */

    /* 6. Fix Mobile Text Sizing */
    .panel-title {
        font-size: 0.9rem;
    }

    .project-tab {
        padding: 10px 15px;
        font-size: 0.85rem;
        max-width: 120px;
    }

    /* 7. Hide Login Container properly if needed */
    #login-container {
        width: 90%;
        margin: auto;
        /* Allow flex centering to work */
    }
}

/* Progress Bar Animations */
@keyframes stripe-flow {
    0% {
        background-position: 0 0;
    }

    100% {
        background-position: 30px 0;
    }
}

.progress-active {
    background-image: linear-gradient(45deg,
            rgba(0, 0, 0, 0.4) 25%,
            transparent 25%,
            transparent 50%,
            rgba(0, 0, 0, 0.4) 50%,
            rgba(0, 0, 0, 0.4) 75%,
            transparent 75%,
            transparent);
    background-size: 30px 30px;
    animation: stripe-flow 4s linear infinite;
    box-shadow: 0 0 10px var(--accent-color);
}

/* Remove focus outline from header buttons */
#dashboard-container .glass button:focus,
#dashboard-container .glass button:active {
    outline: none !important;
    box-shadow: none !important;
}

/* Force Body Centering for Login/Dashboard */
body {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 100vh;
    width: 100%;
}