/* =========================================
   Theme Variables (Premium Onyx Aesthetic)
   ========================================= */
/* Cache Buster Version: 20260531_1005 */
:root {
    --bg-base: #151419; /* Deepest black/charcoal for the very back / sidebar */
    --bg-main: #1d1c21; /* Main application background (Onyx Core) */
    --bg-panel: #26252b; /* Elevated cards and inputs */
    --bg-sidebar: #151419; /* Sidebar depth */
    --bg-input: #32313b; /* Lightened specifically for input visibility */
    
    --text-primary: #f4f4f5; /* Crisp off-white */
    --text-secondary: #a1a1aa; /* Ash grey for less important text */
    
    --border-subtle: #36353d; /* Resting borders */
    --border-active: #4a4952; /* Hover borders */
    
    --accent-color: #2c2b33; /* For hovered elements and chips */
    --primary-brand: #e4e4e7; /* Stark contrast for primary actions */
    --primary-brand-text: #111113; /* Deep text on primary buttons */
    
    --accent-turquoise: #06b6d4; /* Vibrant Turquoise for adding elements */
    --success-color: #10b981; /* Muted Emerald */
    --error-color: #ef4444; /* Muted Red */
}

/* =========================================
   Global Reset & Base
   ========================================= */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* =========================================
   Grid Layout Structure (Floating Onyx Architecture)
   ========================================= */
.app-layout {
    display: flex;
    width: 100%;
    max-width: 1400px;
    min-height: 100vh;
    position: relative;
}

/* --- THE SIDEBAR (Floating Desktop Palette) --- */
.app-sidebar {
    width: 72px;
    background-color: var(--bg-sidebar);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem 0;
    position: fixed;
    height: calc(100vh - 40px);
    left: 20px;
    top: 20px;
    z-index: 100;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    flex: 1;
    width: 100%;
    align-items: center;
}

.sidebar-bottom {
    margin-top: auto;
}

/* Sidebar Icons */
.sidebar-icon {
    background: none;
    border: none;
    color: var(--text-secondary);
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sidebar-icon:hover {
    color: var(--text-primary);
    background-color: var(--accent-color);
    transform: translateY(-2px);
}

.sidebar-icon.active {
    color: var(--text-primary);
    background-color: var(--border-subtle);
    border: 1px solid var(--border-active);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* --- THE MAIN STAGE --- */
.app-main {
    flex: 1;
    margin-left: 112px; /* Offset by the sidebar width + margins */
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
}

#loginOverlay {
    margin-left: 0; 
}

/* =========================================
   Container & Header Typography
   ========================================= */
.app-container {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.app-header {
    width: 100%;
    text-align: center;
    margin-bottom: 1.5rem;
}

.brand-title {
    font-size: 1.85rem;
    font-weight: 600;
    letter-spacing: -0.5px;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.brand-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.dashboard-section {
    width: 100%;
}

/* =========================================
   Form Elements & Elevated Cards
   ========================================= */
.update-form, .detail-header-card {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    background-color: var(--bg-panel);
    padding: 2rem;
    border-radius: 20px;
    border: 1px solid var(--border-subtle);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    padding-left: 0.5rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="search"],
input:not([type]),
textarea,
select {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    font-size: 1rem;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    outline: none;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

textarea {
    resize: vertical;
    min-height: 120px;
}

input::placeholder,
textarea::placeholder {
    color: var(--text-secondary);
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--border-active);
    background-color: var(--bg-panel);
    box-shadow: 0 0 0 2px rgba(228, 228, 231, 0.1); 
}

/* Date Picker Icon Correction (Stark White) */
input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1) brightness(100);
    cursor: pointer;
    opacity: 0.8;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

/* =========================================
   Primary Action Buttons
   ========================================= */
.primary-btn {
    width: 100%;
    background-color: var(--primary-brand);
    color: var(--primary-brand-text);
    border: none;
    padding: 1rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 0.5rem;
    transition: all 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.primary-btn:hover {
    background-color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(255, 255, 255, 0.15);
}

.primary-btn:active {
    transform: scale(0.98);
}

.success-btn {
    width: 100%;
    background-color: var(--success-color);
    color: #0E1015;
    border: none;
    padding: 1rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 0.5rem;
    transition: all 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.success-btn:hover {
    background-color: #34d399;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(16, 185, 129, 0.25);
}

/* --- THE FLOATING ACTION BUTTON (FAB) --- */
.fab-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background-color: var(--accent-turquoise);
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(6, 182, 212, 0.4);
    z-index: 1000;
    cursor: pointer;
    border: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fab-btn:hover {
    transform: scale(1.05) translateY(-4px);
    box-shadow: 0 10px 25px rgba(6, 182, 212, 0.6);
}

/* =========================================
   To-Do List Specifics (Onyx Custom)
   ========================================= */
.todo-item {
    display: flex;
    align-items: center;
    padding: 1.25rem;
    background-color: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    margin-bottom: 0.75rem;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.todo-item:hover {
    transform: translateY(-2px);
    border-color: var(--border-active);
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

/* =========================================
   Timeline Specifics
   ========================================= */
.timeline-container {
    position: relative;
    padding-left: 2rem;
    margin-top: 1.5rem;
}

.timeline-container::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: var(--border-subtle);
}

.timeline-item {
    position: relative;
    margin-bottom: 2rem;
    background-color: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 1.25rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    animation: floatUp 0.4s ease-out forwards;
}

@keyframes floatUp {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -2.35rem;
    top: 1.5rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--primary-brand);
    border: 3px solid var(--bg-main);
}

/* =========================================
   Custom Modal Overlay
   ========================================= */
.custom-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(21, 20, 25, 0.85); /* Onyx Base with opacity */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    backdrop-filter: blur(5px);
}

.custom-modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.custom-modal-panel {
    background-color: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: 24px;
    width: 90%;
    max-width: 500px;
    padding: 2rem;
    transform: translateY(20px);
    transition: transform 0.2s ease;
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
}

.custom-modal-overlay.active .custom-modal-panel {
    transform: translateY(0);
}

/* =========================================
   Team Management / Worker List
   ========================================= */
.worker-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-base);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
}

.worker-list-item button {
    background: none;
    border: none;
    color: var(--error-color);
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.worker-list-item button:hover {
    opacity: 1;
}

/* =========================================
   Mobile Overrides (The Floating Bottom Dock)
   ========================================= */
@media (max-width: 768px) {
    /* Transform Sidebar into Bottom Dock */
    .app-sidebar {
        flex-direction: row;
        width: calc(100% - 2rem);
        height: 72px;
        left: 1rem;
        right: 1rem;
        top: auto;
        bottom: 1rem;
        padding: 0 1rem;
        z-index: 9000;
        border-radius: 24px;
        justify-content: center;
    }
    
    .sidebar-nav {
        flex-direction: row;
        gap: 0;
        justify-content: space-around;
        margin-top: 0 !important; /* Overrides inline style if present */
    }

    .app-main {
        margin-left: 0;
        padding: 1rem;
        padding-bottom: 100px; /* Clear space for the dock */
    }
    
    /* Reposition FAB so it doesn't overlap the dock */
    .fab-btn {
        bottom: 100px;
        right: 1.5rem;
    }
}