/**
 * Ilystics Industrial Mobile Stylesheet (v2.1 - Complete)
 * =======================================================
 * "Field Tool" aesthetic. Optimized for sunlight readability.
 * INCLUDES: Nav Drawer, Dashboard Resets, Calendar Grids, Estimate Tool, Print Styles.
 * * Include AFTER styles.css:
 * <link rel="stylesheet" href="mobile.css" media="screen and (max-width: 768px)">
 */

/* =============================================
   1. HEADER & HAMBURGER NAVIGATION
   ============================================= */

/* Hide desktop nav links */
.nav-links {
    display: none !important;
}

/* Simplify mobile auth buttons - show only Login, hide Sign Up */
#nav-auth-buttons .btn-primary,
.nav-buttons .btn-primary {
    display: none !important;
}

#nav-auth-buttons,
.nav-buttons {
    gap: 0.5rem !important;
    margin-right: 50px;
    /* Space for hamburger */
}

#nav-auth-buttons .btn-text,
.nav-buttons .btn-text {
    padding: 0.5rem 1rem !important;
    font-size: 0.875rem !important;
    background: rgba(249, 115, 22, 0.1);
    border: 1px solid var(--primary);
    border-radius: var(--radius-sm);
}

/* Mobile Header - Compact & Sturdy */
header.header-solid,
header.scrolled {
    padding: 0.5rem 0;
    background: rgba(15, 23, 42, 0.98);
    /* Opaque for readability */
    border-bottom: 1px solid var(--glass-border);
}

header .container nav {
    position: relative;
    padding-right: 60px;
    /* Space for hamburger */
}

/* Hamburger Button - Industrial Square */
.mobile-menu-btn {
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    /* Square corners */
    cursor: pointer;
    gap: 6px;
    padding: 0;
    z-index: 1100;
}

.mobile-menu-btn span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-muted);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Active State (X Icon) */
.mobile-menu-btn.active {
    border-color: var(--primary);
    background: rgba(249, 115, 22, 0.1);
}

.mobile-menu-btn.active span {
    background: var(--primary);
}

.mobile-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 6px);
}

.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -6px);
}

/* Mobile Nav Drawer - The "Tool Chest" */
.mobile-nav-drawer {
    display: block !important;
    position: fixed;
    top: 0;
    right: -100%;
    width: 85%;
    max-width: 300px;
    height: 100vh;
    background: var(--bg-darker);
    /* Solid slate 950 */
    border-left: 1px solid var(--glass-border);
    z-index: 1050;
    transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 5rem 1.5rem 2rem;
    overflow-y: auto;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
}

.mobile-nav-drawer.open {
    right: 0;
}

.mobile-nav-drawer ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-nav-drawer li {
    margin-bottom: 0.75rem;
}

.mobile-nav-drawer a {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    text-decoration: none;
}

.mobile-nav-drawer a svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.mobile-nav-drawer a:hover svg,
.mobile-nav-drawer a.active svg {
    transform: scale(1.1);
    color: var(--primary);
}

.mobile-nav-drawer a:hover,
.mobile-nav-drawer a.active {
    background: rgba(255, 255, 255, 0.03);
    border-color: var(--glass-border);
    color: var(--text-main);
    border-left: 3px solid var(--primary);
    /* Industrial Marker */
}

.mobile-nav-drawer .drawer-divider {
    height: 1px;
    background: var(--glass-border);
    margin: 1.5rem 0;
}

/* Overlay */
.mobile-nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 1040;
}

.mobile-nav-overlay.active {
    display: block;
}


/* =============================================
   2. DASHBOARD SIDEBAR (SLIDE-OUT)
   ============================================= */

.sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: 280px;
    height: 100vh;
    z-index: 1050;
    transition: left 0.3s ease;
    border-right: 1px solid var(--glass-border);
    background: var(--bg-darker);
    padding-top: 1rem;
}

.sidebar.open {
    left: 0;
}

/* Vertical Stack on Mobile */
.sidebar-nav {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.5rem !important;
    margin-top: 1rem !important;
}

.sidebar-nav li {
    width: 100% !important;
    margin: 0 !important;
}

.sidebar-nav a {
    width: 100% !important;
    padding: 0.875rem 1rem !important;
    font-size: 0.9rem !important;
    border-radius: var(--radius-sm) !important;
    display: flex !important;
    align-items: center !important;
}

.sidebar-nav a svg {
    width: 18px !important;
    height: 18px !important;
    margin-right: 0.75rem !important;
    flex-shrink: 0 !important;
}

/* Sidebar Toggle - High Vis Orange Button */
.sidebar-toggle {
    display: flex !important;
    position: fixed;
    top: 0.75rem;
    /* Aligns with header */
    left: 1rem;
    z-index: 1060;
    width: 40px;
    height: 40px;
    background: var(--primary);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-sm);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.sidebar-toggle svg {
    width: 20px;
    height: 20px;
    stroke: white;
    stroke-width: 2.5;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(2px);
    z-index: 1040;
}

.sidebar-overlay.active {
    display: block;
}


/* =============================================
   3. DASHBOARD CONTENT RESETS
   ============================================= */

.main-content {
    padding: 4.5rem 1rem 2rem 1rem;
    /* Clear fixed header */
    width: 100%;
}

.dashboard-header {
    padding: 0 0 1.5rem 0;
    flex-direction: column;
    align-items: flex-start;
}

.dashboard-header h2 {
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
}

/* Stats Grid - Vertical Stack */
.stats-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem;
}

.stat-card {
    padding: 1.25rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
}

.stat-value {
    font-size: 2rem;
    font-family: var(--font-tech);
}

/* Projects Grid */
.projects-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem;
}

.project-card {
    padding: 1.25rem !important;
    border-radius: var(--radius-md);
}

/* Map Section */
.map-section {
    height: 300px !important;
    min-height: 300px !important;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

#map {
    height: 100% !important;
}

.map-overlay-controls {
    flex-wrap: wrap;
    gap: 0.25rem;
}


/* =============================================
   4. CALENDAR & LOGS (Complex Grids)
   ============================================= */

.calendar-container {
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    width: 100% !important;
    overflow-x: hidden !important;
}

/* Calendar Header - Stacked */
.calendar-header {
    flex-direction: column !important;
    gap: 1rem !important;
    background: var(--glass-bg);
    padding: 1rem;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    text-align: center;
}

.calendar-header .btn {
    width: 100%;
    /* Full width buttons */
}

/* Navigation Controls */
.calendar-nav {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.calendar-nav h2 {
    font-size: 1.1rem !important;
    font-family: var(--font-tech);
    width: 100%;
    text-align: center;
    order: -1;
    /* Month name on top */
    margin-bottom: 0.5rem;
}

/* Calendar Grid - "Shift Schedule" Look */
.calendar-grid {
    display: grid !important;
    grid-template-columns: repeat(7, 1fr) !important;
    gap: 1px !important;
    padding: 1px !important;
    background: var(--glass-border);
    /* Grid lines */
    border-radius: var(--radius-sm) !important;
    overflow: hidden;
    width: 100% !important;
}

/* Calendar Day Headers (Mon, Tue...) */
.calendar-day-header {
    background: var(--bg-darker);
    font-size: 0.7rem !important;
    padding: 0.5rem 0 !important;
    text-transform: uppercase;
    color: var(--text-muted);
    text-align: center;
}

/* Calendar Day Cells */
.calendar-day {
    min-height: 50px !important;
    padding: 0.25rem !important;
    background: var(--bg-dark);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.day-number {
    font-size: 0.8rem !important;
    font-family: var(--font-tech);
    color: var(--text-muted);
}

/* Dots for Status (Compact View) */
.day-status {
    font-size: 0 !important;
    /* Hide text */
    height: 8px;
    width: 8px;
    border-radius: 50%;
    margin: 4px auto 0;
    display: block !important;
}

.day-status.workable {
    background: var(--success);
}

.day-status.mud {
    background: var(--warning);
}

.day-status.rain {
    background: var(--primary);
}

.day-status.frozen {
    background: #3b82f6;
}

/* Legend Scroll */
.legend {
    display: flex;
    flex-wrap: nowrap !important;
    /* Force horizontal line */
    overflow-x: auto !important;
    gap: 1rem !important;
    padding-bottom: 0.5rem;
    -webkit-overflow-scrolling: touch;
}

.legend-item {
    flex-shrink: 0;
    white-space: nowrap;
}


/* =============================================
   5. ESTIMATE TOOL
   ============================================= */

.estimate-container {
    padding: 1rem 0 !important;
}

.estimate-card {
    padding: 1.5rem 1rem !important;
    border-radius: var(--radius-md);
}

/* Inputs - Field Friendly (Larger Hit Areas) */
.estimate-form input,
.estimate-form select,
#estimate-form input,
#estimate-form select,
select,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="month"],
button:not(.mobile-menu-btn):not(.sidebar-toggle) {
    min-height: 54px !important;
    font-size: 16px !important;
    border-radius: var(--radius-sm) !important;
}

/* Make date/month picker icons white for dark theme on mobile */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

.btn {
    padding: 1rem 1.5rem !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-weight: 700 !important;
}

/* Advanced Settings Toggle */
#advanced-settings {
    padding: 1rem !important;
    background: rgba(0, 0, 0, 0.3) !important;
    border: 1px solid var(--glass-border);
}


/* =============================================
   6. UTILITIES & ACCESSIBILITY
   ============================================= */

/* Full Width Buttons */
.header-actions {
    width: 100%;
    display: flex;
    gap: 0.5rem;
}

.header-actions .btn {
    flex: 1;
    padding: 0.75rem 0.5rem;
    font-size: 0.8rem;
    text-align: center;
}

/* Scrollable Tables */
.projects-list,
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
}

.projects-table {
    min-width: 600px;
    /* Force scroll */
}

/* Scrollable Tabs */
.tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0;
    border-bottom: 2px solid var(--glass-border);
    gap: 0;
    flex-wrap: nowrap !important;
}

.tab-btn {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 0.75rem 1.25rem;
    font-size: 0.85rem;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.tab-btn.active {
    border-bottom: 2px solid var(--primary);
    color: var(--primary);
    background: rgba(255, 255, 255, 0.02);
}

/* Modals - Bottom Sheet Style */
.modal {
    align-items: flex-end;
    /* Sheet coming from bottom */
}

.modal-content {
    width: 100% !important;
    max-width: 100%;
    border-radius: 12px 12px 0 0;
    max-height: 85vh;
    overflow-y: auto;
    padding: 1.5rem !important;
    margin: 0;
    border-bottom: none;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

/* Prevent Font Scaling weirdness */
html {
    -webkit-text-size-adjust: 100%;
}

/* Hide Scrollbars but Allow Scrolling */
.sidebar::-webkit-scrollbar,
.mobile-nav-drawer::-webkit-scrollbar {
    width: 0;
    background: transparent;
}


/* Footer Adjustments */
.footer-links {
    flex-direction: column !important;
    gap: 1.25rem !important;
    align-items: center !important;
}

footer {
    padding: 3rem 1rem !important;
}

/* =============================================
   7. PRINT STYLES (Restored)
   ============================================= */
@media print {

    .sidebar,
    .mobile-menu-btn,
    .sidebar-toggle,
    .bottom-nav,
    .mobile-nav-drawer,
    .mobile-nav-overlay,
    .sidebar-overlay,
    .header-actions,
    .btn {
        display: none !important;
    }

    .main-content {
        padding: 0 !important;
        margin: 0 !important;
        overflow: visible !important;
    }

    body {
        background: white !important;
        color: black !important;
    }

    .glass-panel,
    .section-card,
    .estimate-card {
        border: 1px solid #ccc !important;
        box-shadow: none !important;
        background: white !important;
        color: black !important;
    }
}

/* =============================================
   8. MUD MAP PAGE MOBILE OPTIMIZATIONS
   ============================================= */

/* Methodology accordion - collapsed by default on mobile */
#methodology-content {
    display: none;
}

/* Guest banner - more compact on mobile */
.guest-banner {
    flex-direction: column !important;
    gap: 0.75rem !important;
    padding: 1rem !important;
    border-radius: 1rem !important;
    white-space: normal !important;
    text-align: center !important;
    bottom: 0.75rem !important;
    width: 92% !important;
}

.guest-banner p {
    font-size: 0.85rem !important;
}

.guest-banner .btn {
    padding: 0.65rem 1rem !important;
    font-size: 0.8rem !important;
}

/* Map info cards below the map - stack them */
.grid[style*="minmax(300px"] {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
    margin-top: 1rem !important;
}

.grid[style*="minmax(300px"] .glass-panel {
    padding: 1rem !important;
}

.grid[style*="minmax(300px"] h3 {
    font-size: 0.95rem !important;
}

.grid[style*="minmax(300px"] p {
    font-size: 0.8rem !important;
}