:root {
    /* Color Palette - Construction Industry Theme */
    --bg-dark: #0f172a;
    --bg-darker: #020617;
    --primary: #f97316;
    --primary-dark: #c2410c;
    --primary-glow: rgba(249, 115, 22, 0.4);
    --accent: #fb923c;
    --accent-glow: rgba(251, 146, 60, 0.4);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-highlight: rgba(255, 255, 255, 0.15);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    /* Typography */
    --font-main: 'Inter', sans-serif;
    --font-display: 'Outfit', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(249, 115, 22, 0.12) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(251, 146, 60, 0.10) 0%, transparent 40%);
    min-height: 100vh;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-main);
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
}

ul {
    list-style: none;
}

/* Utilities */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Buttons & Interactive */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    font-family: var(--font-main);
    min-height: 44px;
    /* Touch target fix */
    min-width: 44px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    box-shadow: 0 0 20px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px var(--primary-glow);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-main);
}

.btn-outline:hover {
    background: var(--glass-highlight);
    border-color: var(--text-main);
}

.btn-glass {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(4px);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
}

.btn-glass:hover,
.btn-glass.active {
    background: var(--primary);
    border-color: var(--primary);
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="month"],
input[type="search"],
select,
textarea,
.form-input {
    width: 100%;
    padding: 0.75rem;
    background-color: rgba(0, 0, 0, 0.3) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 0.5rem;
    color: #f8fafc !important;
    font-family: var(--font-main);
    font-size: 1rem;
    /* Prevents iOS zoom */
    transition: all 0.3s ease;
    min-height: 48px;
    /* Touch target fix */
}

/* Make date/month picker icons white for dark theme */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

input:focus,
select:focus,
textarea:focus,
.form-input:focus {
    outline: none;
    border-color: var(--primary) !important;
    background-color: rgba(0, 0, 0, 0.5) !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

select option {
    background-color: var(--bg-dark);
    color: var(--text-main);
    padding: 10px;
}

::placeholder {
    color: var(--text-muted);
    opacity: 0.8;
}

input:disabled,
select:disabled,
textarea:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: rgba(255, 255, 255, 0.05) !important;
}

.form-row,
.form-group-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Header / Nav */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: 1.5rem 0;
    transition: all 0.3s ease;
}

header.scrolled {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    padding: 1rem 0;
    border-bottom: 1px solid var(--glass-border);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(to right, var(--primary), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    color: var(--text-muted);
    font-weight: 500;
}

.nav-links a:hover {
    color: var(--text-main);
}

/* Hero Section */
.hero {
    padding: 12rem 0 8rem;
    text-align: center;
    position: relative;
    background-image: linear-gradient(to bottom, rgba(15, 23, 42, 0.8), var(--bg-dark)), url('hero-bg.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

.hero h1 {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    background: linear-gradient(to bottom, #fff, #cbd5e1);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 700px;
    margin: 0 auto 3rem;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Features & Pricing */
.features,
.pricing {
    padding: 6rem 0;
}

.section-title {
    text-align: center;
    margin-bottom: 4rem;
}

.section-title h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.section-title p {
    color: var(--text-muted);
}

.features-grid,
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.feature-card,
.pricing-card {
    padding: 2rem;
    transition: transform 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    background: var(--glass-highlight);
}

.feature-icon {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: var(--accent);
}

.pricing-card.featured {
    border-color: var(--primary);
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.1);
    position: relative;
    overflow: hidden;
}

.pricing-card.featured::before {
    content: 'POPULAR';
    position: absolute;
    top: 1rem;
    right: -2rem;
    background: var(--primary);
    color: white;
    padding: 0.25rem 3rem;
    transform: rotate(45deg);
    font-size: 0.75rem;
    font-weight: 700;
}

.price {
    font-size: 3rem;
    font-weight: 800;
    margin: 1.5rem 0;
    color: var(--text-main);
}

.price span {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 400;
}

.pricing-features {
    margin: 2rem 0;
    text-align: left;
}

.pricing-features li {
    margin-bottom: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pricing-features li::before {
    content: '✓';
    color: var(--success);
    font-weight: bold;
}

/* Footer */
footer {
    padding: 4rem 0;
    border-top: 1px solid var(--glass-border);
    margin-top: 4rem;
    text-align: center;
    color: var(--text-muted);
}

.footer-links {
    margin-top: 1.5rem;
    font-size: 0.9rem;
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.footer-link {
    color: var(--text-muted);
}

.footer-link:hover {
    color: var(--text-main);
}

/* Auth Pages */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-card {
    width: 100%;
    max-width: 450px;
    padding: 3rem 2.5rem;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.auth-footer a {
    color: var(--primary);
}

/* Dashboard Layout */
.dashboard-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: rgba(15, 23, 42, 0.95);
    border-right: 1px solid var(--glass-border);
    padding: 2rem;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.sidebar-nav {
    margin-top: 3rem;
    flex: 1;
}

.sidebar-nav li {
    margin-bottom: 0.5rem;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    color: var(--text-muted);
    min-height: 44px;
    /* Touch target */
}

.sidebar-nav a.active,
.sidebar-nav a:hover {
    background: var(--glass-highlight);
    color: var(--text-main);
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    padding: 1.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin: 0.5rem 0;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Tables */
.projects-table {
    width: 100%;
    border-collapse: collapse;
}

.projects-table th,
.projects-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

.projects-table th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.875rem;
}

/* Status Badges */
.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

.status-badge.status-planning {
    background: rgba(59, 130, 246, 0.2);
    color: var(--primary);
}

.status-badge.status-in_progress {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.status-badge.status-on_hold {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.status-badge.status-completed {
    background: rgba(99, 102, 241, 0.2);
    color: #6366f1;
}

.status-badge.status-delayed {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.status-badge.status-good {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-dark);
    padding: 2rem;
    width: 90%;
    max-width: 600px;
    position: relative;
    animation: modalSlideIn 0.3s ease;
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal:hover {
    color: var(--text-main);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 1rem;
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 1.5rem;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-weight: 600;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
    min-height: 44px;
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Map Controls */
.map-overlay-controls {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    z-index: 1000;
    display: flex;
    gap: 0.5rem;
}

/* =========================================
   Mobile Responsiveness Overrides
   ========================================= */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }

    /* Hero */
    .hero {
        padding: 8rem 0 4rem;
    }

    .hero h1 {
        font-size: 2.5rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .hero-buttons {
        flex-direction: column;
        width: 100%;
    }

    .hero-buttons .btn {
        width: 100%;
    }

    /* Dashboard Layout */
    .dashboard-layout {
        flex-direction: column;
        padding-top: 0;
        /* Header is sticky */
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        border-right: none;
        border-bottom: 1px solid var(--glass-border);
        padding: 1rem;
        overflow-x: auto;
    }

    .sidebar-nav {
        display: flex;
        gap: 1rem;
        margin-top: 0;
        white-space: nowrap;
    }

    .sidebar-nav li {
        margin-bottom: 0;
    }

    .sidebar>div:last-child {
        display: none;
        /* Hide logout button in sidebar on mobile */
    }

    /* Dashboard Content */
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .header-actions {
        width: 100%;
        display: flex;
        justify-content: space-between;
        gap: 0.5rem;
    }

    .header-actions .btn {
        flex: 1;
        padding: 0.5rem;
        font-size: 0.9rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .form-row,
    .form-group-row {
        grid-template-columns: 1fr;
    }

    .tabs {
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }

    .tab-btn {
        white-space: nowrap;
    }

    /* Tables */
    .projects-list {
        overflow-x: auto;
    }

    .projects-table {
        min-width: 600px;
    }
}

/* FORCE DARK HEADER (For inner pages) */
header.header-solid {
    background: rgba(15, 23, 42, 0.95);
    /* Solid dark background */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 1rem 0;
    border-bottom: 1px solid var(--glass-border);
}