:root {
    --bg-primary: #030d14; /* Slate Black matching operations-metrics dashboard */
    --bg-secondary: rgba(5, 63, 90, 0.2); /* Sleek Deep Navy glass sidebar/panels */
    --card-bg: rgba(10, 50, 72, 0.45); /* Deep Navy glass cards */
    --border-color: rgba(54, 205, 116, 0.15); /* Eco-Green glow border */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --primary: #36CD74; /* Cleanleaf Vibrant Eco-Green */
    --primary-hover: #22a55a;
    --primary-glow: rgba(54, 205, 116, 0.15);
    --secondary: #053F5A; /* Cleanleaf Deep Navy */
    --accent: #23CDFC; /* Cleanleaf Sky Blue / Cyan */
    --gold: #FDC160; /* Cleanleaf Muted Gold */
    --danger: #ef4444;
    --font-header: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* Border-radius scale (matches reference dashboards) */
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;

    /* Glows & shadows */
    --glow-green: 0 0 15px rgba(54, 205, 116, 0.25);
    --glow-cyan: 0 0 15px rgba(35, 205, 252, 0.25);
    --glow-gold: 0 0 15px rgba(253, 193, 96, 0.25);
    --shadow-card: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Lucide icons default to a fixed 24x24 SVG; size them like the FontAwesome
   glyphs they replaced so they scale with surrounding text instead of
   blowing out buttons, badges, and table cells. */
.lucide {
    width: 1em;
    height: 1em;
    stroke-width: 2px;
    vertical-align: -0.125em;
    flex-shrink: 0;
}

h1, h2, h3, h4, h5, h6, .logo-text {
    font-family: var(--font-header);
    letter-spacing: -0.01em;
}

/* Glowing Background Orbs */
.bg-orbs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.3;
    animation: float-orb 20s infinite ease-in-out;
}

.orb-1 {
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
    animation-duration: 25s;
}

.orb-2 {
    bottom: -10%;
    right: -10%;
    width: 45vw;
    height: 45vw;
    background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
    animation-duration: 20s;
}

.orb-3 {
    top: 40%;
    left: 50%;
    width: 35vw;
    height: 35vw;
    background: radial-gradient(circle, var(--secondary) 0%, transparent 70%);
    animation-duration: 30s;
    opacity: 0.15;
}

@keyframes float-orb {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    50% {
        transform: translate(3%, 5%) scale(1.1);
    }
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar styling (Slate glassmorphism) */
.sidebar {
    width: 280px;
    background: var(--bg-secondary);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 30px 20px;
    z-index: 100;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
    padding-left: 10px;
}

.logo-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px var(--primary-glow);
}

.logo-text {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 14px 18px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    border-radius: 12px;
    transition: var(--transition-smooth);
    border: 1px solid transparent;
}

.nav-item a:hover, .nav-item.active a {
    color: var(--text-primary);
    background: var(--card-bg);
    border-color: var(--border-color);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}

.nav-item.active a .nav-icon {
    color: var(--primary);
}

.nav-icon {
    font-size: 18px;
    transition: var(--transition-smooth);
}

.user-profile {
    margin-top: auto;
    padding: 15px;
    background: rgba(30, 41, 59, 0.3);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.profile-avatar {
    width: 42px;
    height: 42px;
    background: var(--card-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.profile-info {
    display: flex;
    flex-direction: column;
}

.profile-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.profile-role {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: capitalize;
}

/* Main Content Area */
.main-content {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
    max-height: 100vh;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.page-title h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 5px;
}

.page-title p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Glassmorphic Cards */
.glass-panel {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--shadow-card);
    transition: var(--transition-smooth);
}

.glass-panel:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    border-radius: 12px;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    border: 1px solid transparent;
}

.btn-primary {
    background: var(--primary);
    color: #050505;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.2);
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 0 25px rgba(16, 185, 129, 0.35);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(30, 41, 59, 0.6);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background: rgba(51, 65, 85, 0.8);
    border-color: rgba(255,255,255,0.2);
}

/* Include/Exclude, Dark/Satellite style two-way toggles */
.mode-toggle-group {
    display: flex;
    gap: 4px;
}
.mode-toggle-btn {
    padding: 5px 10px;
    font-size: 11px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
}
.mode-toggle-btn.active {
    background: var(--accent);
    color: #04222c;
    border-color: var(--accent);
    font-weight: 600;
}

/* Inputs & Form Controls */
.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Label + dropdown/switch on one row instead of stacked, so the control
   doesn't stretch to the column's full width. */
.form-group-inline {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.form-group-inline label {
    margin-bottom: 0;
    flex-shrink: 0;
}

/* Small hover-for-detail (i) badge, used to move a field's helper text out
   of the layout so the row can stay compact/inline. Keyboard-focusable
   (tabindex on the element) so the tooltip isn't mouse-only. */
.info-tooltip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
    font-style: italic;
    font-family: Georgia, 'Times New Roman', serif;
    cursor: help;
    position: relative;
    flex-shrink: 0;
    margin-left: 5px;
    vertical-align: middle;
}

.info-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 130%;
    left: 50%;
    transform: translateX(-50%);
    width: 220px;
    max-width: 60vw;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 11px;
    font-weight: 400;
    font-style: normal;
    font-family: var(--font-body, inherit);
    color: var(--text-secondary);
    line-height: 1.4;
    text-align: left;
    white-space: normal;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease;
    z-index: 60;
    pointer-events: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.info-tooltip:hover::after,
.info-tooltip:focus::after {
    opacity: 1;
    visibility: visible;
}

.form-control {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 14px;
    transition: var(--transition-smooth);
    width: 100%;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 12px var(--primary-glow);
}

/* Generic modal overlay (currently used by the draft PDF preview) */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(3, 13, 20, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-box {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-box-lg {
    width: min(900px, 92vw);
    height: min(880px, 92vh);
}

/* Tab contents (hidden by default) */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Leaflet Map Card & Integration */
#map-container {
    width: 100%;
    height: 480px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
    overflow: hidden;
    z-index: 1;
}

#wizard-map-container {
    width: 100%;
    height: 350px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    margin-bottom: 10px;
    overflow: hidden;
    z-index: 1;
}

/* Wizard Steps styling */
/* Wizard: pill-button section nav */
.wizard-nav-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.wizard-pill {
    padding: 7px 16px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-smooth);
    white-space: nowrap;
    flex: 1 1 0;
    text-align: center;
}

.wizard-pill:hover {
    border-color: var(--primary);
    color: var(--text-primary);
}

.wizard-pill.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #050505;
    box-shadow: 0 0 12px var(--primary-glow);
}

.wizard-header-sticky {
    position: sticky;
    top: 0;
    z-index: 60;
    background: var(--bg-primary);
    padding-bottom: 20px;
    margin-bottom: 0;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 20px 20px -20px rgba(0, 0, 0, 0.5);
}

/* Wizard: single-page sections */
.wizard-section {
    margin-bottom: 30px;
    scroll-margin-top: 180px;
}

.wizard-section:first-of-type {
    margin-top: 25px;
}

.wizard-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 25px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
}

.wiz-metadata-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px 20px;
}

@media (max-width: 1100px) {
    .wiz-metadata-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

/* Grid columns & summaries */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 30px;
}

.stat-card {
    text-align: left;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.stat-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 5px;
}

/* Compact stat card rows that stay on a single line across the page instead of
   wrapping, with equal-width columns. Overrides the default auto-fit dashboard-grid. */
.stat-row {
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    gap: 16px;
}

.stat-row .glass-panel {
    padding: 18px 20px;
}

.stat-row .stat-label {
    font-size: 11.5px;
    margin-bottom: 6px;
}

.stat-row .stat-value {
    font-size: 24px;
}

.stat-row .stat-desc {
    font-size: 11px;
}

@media (max-width: 900px) {
    .stat-row {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
}

/* Tables styling */
.clean-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.clean-table th, .clean-table td {
    padding: 16px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.clean-table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.clean-table td {
    font-size: 14px;
    color: var(--text-primary);
}

.clean-table tr:hover td {
    background: rgba(255,255,255,0.02);
}

.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    display: inline-block;
}

.badge-success {
    background: rgba(54, 205, 116, 0.15);
    color: var(--primary);
    border: 1px solid rgba(54, 205, 116, 0.3);
}

.badge-info {
    background: rgba(35, 205, 252, 0.15);
    color: var(--accent);
    border: 1px solid rgba(35, 205, 252, 0.3);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-warning {
    background: rgba(253, 193, 96, 0.15);
    color: var(--gold);
    border: 1px solid rgba(253, 193, 96, 0.3);
}

/* Icon spin utility (pairs with the loader-circle Lucide icon) */
.icon-spin {
    animation: spin 1s linear infinite;
    display: inline-block;
}

/* Login Panel Layout */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(4, 8, 16, 0.85);
    backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.login-card {
    max-width: 420px;
    padding: 40px;
    background: rgba(12, 22, 44, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    border-radius: 16px;
    text-align: center;
}

.login-error {
    color: #FB7185;
    font-size: 13px;
    margin-top: 12px;
    display: none;
}

/* User card in sidebar */
.user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    margin-top: auto;
    border-top: 1px solid var(--border-color);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: #050505;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
    overflow: hidden;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 11px;
    color: var(--text-muted);
}

.logout-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
}

.logout-btn:hover {
    color: var(--danger);
}

.login-logo-wrap {
    margin-bottom: 24px;
    text-align: center;
}

.login-logo {
    width: 210px;
    height: auto;
}

.login-desc {
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 30px;
}

.login-btn-container {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
}

.login-error-text {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    line-height: 1.4;
    margin-top: 10px;
}

/* File upload dropzone */
.dropzone {
    border: 2px dashed rgba(255,255,255,0.15);
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.dropzone:hover {
    border-color: var(--primary);
    background: rgba(16, 185, 129, 0.03);
}

.dropzone-icon {
    font-size: 40px;
    color: var(--text-secondary);
    margin-bottom: 15px;
}

/* Custom switch toggle */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(30, 41, 59, 0.8);
    transition: .4s;
    border-radius: 34px;
    border: 1px solid var(--border-color);
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-secondary);
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary-glow);
    border-color: var(--primary);
}

input:checked + .slider:before {
    transform: translateX(24px);
    background-color: var(--primary);
}

/* Loader spinner */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255,255,255,0.1);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Scrollbar customizations */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--card-bg);
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.12);
}
