/**
 * Base Styles - Layout, Typography, and Core UI
 * Consolidated from main.css and responsive.css
 */

/* CSS Custom Properties - Color System */
:root {
    /* Primary Colors - Blues/Purples for main UI */
    --color-primary: #667eea;
    --color-primary-hover: #5a67d8;
    --color-primary-dark: #764ba2;
    
    /* Responsive header heights */
    --header-height-desktop: 80px;
    --header-height-tablet: 80px;
    --header-height-mobile: 80px;
    
    /* Responsive safe margins */
    --header-safe-margin-desktop: 10px;
    --header-safe-margin-tablet: 10px;
    --header-safe-margin-mobile: 5px;
    
    /* Responsive font sizes */
    --header-title-size-desktop: 1.5rem;
    --header-title-size-tablet: 1.3rem;
    --header-title-size-mobile: 1.1rem;
    --timestamp-size-desktop: 0.8rem;
    --timestamp-size-tablet: 0.75rem;
    --timestamp-size-mobile: 0.7rem;
    
    /* Neutral Colors - Grays for text, borders, backgrounds */
    --color-neutral-50: #f7fafc;
    --color-neutral-100: #f3f4f6;
    --color-neutral-200: #e2e8f0;
    --color-neutral-300: #cbd5e0;
    --color-neutral-400: #a0aec0;
    --color-neutral-500: #4a5568;
    --color-neutral-600: #2d3748;
    --color-neutral-700: #1a202c;
    --color-neutral-800: #171923;
    --color-neutral-900: #0f1419;
    --color-neutral-text: #333;
    --color-neutral-light: #cccccc;
    --color-neutral-slate: #5a6c7d;
    --color-neutral-slate-dark: #3d4852;
    
    /* Semantic Colors */
    --color-danger: #ef4444;
    --color-danger-dark: #dc2626;
    --color-success: #10b981;
    
    /* Favorite Colors - Golden yellow system */
    --color-favorite-star: #ffd700;
    --color-favorite-star-transparent: #ffd700cc;
    --color-favorite-glow-soft: #ff9100aa;
    --color-favorite-glow-medium: #ff910033;
    --color-favorite-glow-strong: #ff910099;
    --color-favorite-glow-intense: #ff91004d;

    /* Surface Colors - Backgrounds and overlays */
    --color-surface-primary: rgba(255, 255, 255, 0.75);
    --color-surface-modal: rgba(0, 0, 0, 0.8);
    --color-surface-tooltip: rgba(0, 0, 0, 0.75);
    --color-surface-highlight: rgba(255, 255, 255, 0.2);
    --color-surface-gantt: rgba(74, 85, 104, 0.95);
    
    /* Shadow Colors */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-base: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.25);
    --shadow-xl: 0 10px 25px rgba(0, 0, 0, 0.4);
    --shadow-primary: 0 4px 12px rgba(102, 126, 234, 0.3);
    --shadow-primary-light: 0 4px 12px rgba(102, 126, 234, 0.2);
    --shadow-danger: 0 4px 12px rgba(239, 68, 68, 0.3);
    --shadow-gantt-hover: 0 12px 35px rgba(102, 126, 234, 0.25);
    
    /* Text Shadow */
    --text-shadow-light: 0 1px 2px rgba(0, 0, 0, 0.3);
    --text-shadow-medium: 0 1px 2px rgba(0, 0, 0, 0.5);
    --text-shadow-strong: 0 1px 3px rgba(0, 0, 0, 0.7);
    
    /* Border Colors */
    --border-light: rgba(255, 255, 255, 0.1);
    --border-medium: rgba(255, 255, 255, 0.2);
}

/* Reset and base typography */
html {
    overflow: hidden; /* Prevent html from scrolling */
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    min-height: 100vh;
    color: var(--color-neutral-text);
    overflow: hidden; /* Prevent body from scrolling */
}

/* ===========================================
   HEADER AND NAVIGATION
   =========================================== */

.header {
    background: var(--color-surface-primary);
    backdrop-filter: blur(4px);
    padding: 1rem 2rem;
    box-shadow: var(--shadow-base);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: var(--header-height-desktop);
    flex-wrap: nowrap;
}

/* .header > div:first-child {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    min-width: 0;
    flex: 1;
    max-width: 50%;
} */

.header h1 {
    color: var(--color-neutral-500);
    font-size: var(--header-title-size-desktop);
    font-weight: 600;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.timestamp-text {
    color: var(--color-neutral-400);
    font-size: var(--timestamp-size-desktop);
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.controls {
    display: flex;
    gap: 1.2rem;
    align-items: center;
    flex-wrap: nowrap;
    flex-shrink: 0; /* Prevent controls from shrinking */
}

/* ===========================================
   MAIN LAYOUT
   =========================================== */

.main-container {
    padding-top: calc(var(--header-height-desktop) + var(--header-safe-margin-desktop));
    padding-left: 1rem;
    padding-right: 1rem;
    padding-bottom: 1rem;
    max-width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Prevent body scroll */
}

/* ===========================================
   LOADING AND ERROR STATES
   =========================================== */

.loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--color-surface-modal);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    color: white;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading p {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    text-align: center;
}

.error {
    background: var(--color-neutral-100);
    color: var(--color-danger);
    padding: 1rem;
    border-radius: 6px;
    margin: 2rem;
    text-align: center;
}

/* ===========================================
   FILE DROP ZONE
   =========================================== */

.file-drop-zone {
    background: var(--color-surface-primary);
    border: 3px dashed var(--color-primary);
    border-radius: 12px;
    padding: 3rem;
    text-align: center;
    margin: 2rem; /* Simplified margin since padding-top handles header spacing */
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease, margin-top 0.3s ease-in-out;
    cursor: pointer;
}

/* Adjust file drop zone positioning for always-visible header */
.file-drop-zone {
    margin: 2rem; /* Consistent margin, header spacing handled by main-container */
}

.drop-content {
    max-width: 400px;
    margin: 0 auto;
}

.drop-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    color: #667eea;
}

/* ===========================================
   RESPONSIVE BREAKPOINTS
   =========================================== */

@media (max-width: 768px) {
    :root {
        --header-height-desktop: var(--header-height-tablet);
        --header-safe-margin-desktop: var(--header-safe-margin-tablet);
        --header-title-size-desktop: var(--header-title-size-tablet);
        --timestamp-size-desktop: var(--timestamp-size-tablet);
    }
    
    .header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        padding: 1rem;
        height: var(--header-height-tablet);
        min-height: var(--header-height-tablet);
    }
    
    .header h1 {
        text-align: center;
        margin: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }
    
    .timestamp-text {
        text-align: center;
    }

    .controls {
        width: 100%;
        justify-content: center;
        gap: 0.8rem;
        order: 2;
        flex-wrap: wrap;
    }

    .main-container {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
        padding-bottom: 0.5rem;
    }
    
    .file-drop-zone {
        margin: 1rem;
        padding: 2rem;
    }
    
    .controls .btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.6rem;
        min-width: 90px;
        width: auto;
        height: 36px;
        flex: 1;
        max-width: 120px;
    }
    
    .controls .btn .btn__icon {
        font-size: 0.9rem;
    }
    
    .favorites-controls {
        display: flex;
        gap: 0.5rem;
        flex: 1;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    :root {
        --header-height-desktop: var(--header-height-mobile);
        --header-safe-margin-desktop: var(--header-safe-margin-mobile);
        --header-title-size-desktop: var(--header-title-size-mobile);
        --timestamp-size-desktop: var(--timestamp-size-mobile);
    }
    
    .header {
        padding: 0.75rem 1rem;
        height: var(--header-height-mobile);
        min-height: var(--header-height-mobile);
        gap: 0.5rem;
    }
    
    .main-container {
        padding-left: 0.25rem;
        padding-right: 0.25rem;
        padding-bottom: 0.25rem;
    }
    
    .file-drop-zone {
        margin: 0.5rem;
        padding: 1.5rem 1rem;
    }
    
    .controls {
        gap: 0.4rem;
    }
    
    .controls .btn {
        font-size: 0.7rem;
        padding: 0.3rem 0.5rem;
        min-width: 70px;
        height: 32px;
        flex: 1;
        max-width: 90px;
    }
    
    .controls .btn .btn__icon {
        font-size: 0.8rem;
    }
    
    .favorites-controls {
        width: 100%;
        order: 3;
        gap: 0.4rem;
    }
    
    .favorites-controls .btn {
        max-width: none;
        min-width: 80px;
    }
}



/* ===========================================
   RESPONSIVE HEADER IMPROVEMENTS  
   =========================================== */

/* Extreme narrow screens - further reduce font sizes */
@media (max-width: 360px) {
    :root {
        --header-title-size-mobile: 1rem;
        --timestamp-size-mobile: 0.65rem;
    }
}

/* Landscape orientation on small devices */
@media (max-width: 768px) and (orientation: landscape) {
    :root {
        --header-height-desktop: 100px;
        --header-height-tablet: 100px;
        --header-height-mobile: 100px;
    }
    
    .header {
        height: 100px;
        min-height: 100px;
        flex-direction: row;
        gap: 1rem;
    }
    
    .header > div:first-child {
        align-items: flex-start;
        text-align: left;
        max-width: 60%;
    }
    
    .header h1 {
        text-align: left;
        font-size: 1.1rem;
    }
    
    .timestamp-text {
        text-align: left;
    }
    
    .controls {
        width: auto;
        flex-wrap: wrap;
        order: initial;
        max-width: 40%;
    }
    
    .controls .btn {
        min-width: 70px;
        font-size: 0.75rem;
        height: 32px;
    }
}


/* @media (orientation: landscape) and (max-width: 415px) {
    .header {
        max-height: 10%;
    }

    .hamburger {
        top: 4px !important;
        width: 32px !important;
        height: 32px !important;
    }

    .sidebar {
        top: 41px !important;
    }

    #placeFilter.modal--visible {
        top: 73px !important;
        left: 320px !important;
    }

    #placeFilter .place-filter-content {
        max-height: unset !important;
    }

    .main-container {
        padding-top: calc(var(--header-height-desktop) + var(--header-safe-margin-desktop) - 40px) !important;
    }

} */