/* EcoCity Montevideo - EcoScan Design System v1.4.0 */

/* ========== CSS Variables - EcoScan Theme ========== */
:root {
    /* Primary Colors - EcoScan Palette */
    --color-primary: #6ee7b7;
    /* Mint green accent */
    --color-primary-dark: #34d399;
    --color-primary-light: #a7f3d0;

    --color-success: #10b981;
    --color-success-dark: #059669;

    --color-warning: #fbbf24;
    --color-warning-dark: #f59e0b;

    --color-danger: #f87171;
    --color-danger-dark: #ef4444;

    --color-info: #60a5fa;
    --color-info-dark: #3b82f6;

    /* Background Colors - Dark Navy Theme */
    --color-bg-primary: #1e293b;
    /* Main dark background */
    --color-bg-secondary: #2b3544;
    /* Slightly lighter */
    --color-bg-tertiary: #334155;
    /* Card backgrounds */
    --color-bg-sidebar: #1a202e;
    /* Darker sidebar */

    /* Text Colors */
    --color-text-primary: #f8fafc;
    --color-text-secondary: #cbd5e1;
    --color-text-muted: #94a3b8;
    --color-text-dark: #64748b;

    /* Spacing System */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 2.5rem;

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.15);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.25);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.3);

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== Reset & Base ========== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background: #1e293b !important;
    color: var(--color-text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========== Main Layout ========== */
#app-container {
    height: 100vh;
    width: 100vw;
    display: flex;
    overflow: hidden;
    background: var(--color-bg-primary);
}

/* Sidebar Styles */
#sidebar {
    width: 280px;
    background: var(--color-bg-sidebar);
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 1000;
    flex-shrink: 0;
}

.brand {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.brand h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    letter-spacing: -0.5px;
    margin: 0;
}

.sidebar-nav {
    flex: 1;
    padding: 24px 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.nav-section h3 {
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 700;
    margin-bottom: 12px;
    padding-left: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 14px;
    /* Reduced padding slightly to account for border */
    border-radius: 8px;
    background: transparent;
    border: 2px solid transparent;
    /* Prepare space for border */
    color: #94a3b8;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    text-decoration: none;
    font-family: inherit;
    margin-bottom: 4px;
}

.nav-item i {
    font-size: 1.25rem;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

/* Selected State - EcoScan Green */
.nav-item.active,
.nav-item:active {
    background: var(--color-primary);
    color: #0f172a;
    /* Dark text for contrast */
    font-weight: 700;
    border-color: white;
    /* White border as requested */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.nav-item.active i,
.nav-item:active i {
    color: #0f172a;
}

.mini-panel {
    background: #2b3544;
    margin: 16px;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.mini-panel p {
    color: #cbd5e1;
    font-size: 0.85rem;
    margin: 0;
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Content Area */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    background: #0f172a;
}

header {
    height: 64px;
    background: #1e293b;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    padding: 0 24px;
    justify-content: flex-end;
    flex-shrink: 0;
}

#stats-bar {
    display: flex;
    gap: 24px;
    align-items: center;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #cbd5e1;
    font-size: 0.9rem;
    font-weight: 500;
}

.stat-item.warning {
    color: var(--color-danger);
    background: rgba(239, 68, 68, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
}

.stat-item i {
    font-size: 1.1rem;
    color: #64748b;
}

.stat-item.warning i {
    color: var(--color-danger);
}

/* Map Container */
#map-container {
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.15);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.25);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.3);

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== Reset & Base ========== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background: #1e293b !important;
    color: var(--color-text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========== Main Layout ========== */
#app-container {
    height: 100vh;
    width: 100vw;
    display: flex;
    overflow: hidden;
    background: var(--color-bg-primary);
}

/* Sidebar Styles */
#sidebar {
    width: 280px;
    background: var(--color-bg-sidebar);
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 1000;
    flex-shrink: 0;
}

.brand {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.brand h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    letter-spacing: -0.5px;
    margin: 0;
}

.sidebar-nav {
    flex: 1;
    padding: 24px 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.nav-section h3 {
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 700;
    margin-bottom: 12px;
    padding-left: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    border-radius: 8px;
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    text-decoration: none;
    font-family: inherit;
    margin-bottom: 4px;
}

.nav-item i {
    font-size: 1.25rem;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.nav-item.active,
.nav-item:active {
    background: var(--color-primary);
    color: #0f172a;
    font-weight: 600;
}

.nav-item.active i,
.nav-item:active i {
    color: #0f172a;
}

.mini-panel {
    background: #2b3544;
    margin: 16px;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.mini-panel p {
    color: #cbd5e1;
    font-size: 0.85rem;
    margin: 0;
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Content Area */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    background: #0f172a;
}

header {
    height: 64px;
    background: #1e293b;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    padding: 0 24px;
    justify-content: flex-end;
    flex-shrink: 0;
}

#stats-bar {
    display: flex;
    gap: 24px;
    align-items: center;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #cbd5e1;
    font-size: 0.9rem;
    font-weight: 500;
}

.stat-item.warning {
    color: var(--color-danger);
    background: rgba(239, 68, 68, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
}

.stat-item i {
    font-size: 1.1rem;
    color: #64748b;
}

.stat-item.warning i {
    color: var(--color-danger);
}

/* Map Container */
#map-container {
    position: relative;
    flex: 1;
    width: 100%;
}

#map {
    width: 100%;
    height: 100%;
}

/* Floating Charts Panel */
#charts-floating-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 25%;
    /* Responsive width relative to map container */
    min-width: 260px;
    max-width: 350px;
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(8px);
    padding: 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 400;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

#charts-floating-panel:hover {
    background: rgba(30, 41, 59, 0.98);
}

/* Responsive adjustments for Charts Panel */
@media (max-width: 768px) {
    #charts-floating-panel {
        width: auto;
        left: 20px;
        right: 20px;
        top: auto;
        bottom: 20px;
        max-width: none;
    }
}

/* ========== Components & Modals ========== */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    justify-content: center;
    align-items: center;
    animation: fadeIn var(--transition-base);
}

.modal-content {
    background: var(--color-bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: var(--spacing-2xl);
    border-radius: var(--radius-2xl);
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    position: relative;
    animation: slideUp var(--transition-slow);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content h2 {
    margin-bottom: var(--spacing-xl);
    color: var(--color-text-primary);
    font-size: 1.75rem;
    font-weight: 700;
}

.btn-action,
.btn-save,
.btn-cancel {
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 20px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-save {
    background: var(--color-primary);
    color: #0f172a;
    border: none;
}

.btn-save:hover {
    background: var(--color-primary-dark);
}

.btn-cancel:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Utility */
.status-warning {
    color: var(--color-warning);
    font-weight: 700;
}

.status-critical {
    color: var(--color-danger);
    font-weight: 700;
}

.status-ok {
    color: var(--color-success);
    font-weight: 700;
}

/* Pulse Animation for Map */
@keyframes pulse-ring {
    0% {
        transform: scale(0.33);
        opacity: 1;
    }

    80%,
    100% {
        opacity: 0;
        transform: scale(2.5);
    }
}

.icon-pulse-animation {
    position: relative;
}

.icon-pulse-animation::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: rgba(231, 76, 60, 0.6);
    animation: pulse-ring 1.5s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
    z-index: -1;
    pointer-events: none;
}

/* Inputs */
input,
select,
textarea {
    background: var(--color-bg-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 10px;
    border-radius: 6px;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* Keep original classes for compatibility */
.btn-action {
    width: 100%;
    margin: 5px 0;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.settings-grid label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--color-text-secondary);
}

.settings-grid h3 {
    grid-column: 1 / -1;
    margin-top: 10px;
    margin-bottom: 5px;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.settings-grid label small {
    margin-top: 4px;
    font-size: 0.8rem;
    opacity: 0.7;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #1e293b;
}

::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}