/* AUDEO Reciclaje Inteligente CSS Design System */

:root {
    --bg-main: #0a0e17;
    --bg-card: rgba(18, 24, 38, 0.75);
    --border-color: rgba(255, 255, 255, 0.06);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    
    --color-green: #10b981;
    --color-yellow: #f59e0b;
    --color-orange: #f97316;
    --color-red: #ef4444;
    --color-grey: #64748b;
    --color-blue: #3b82f6;
    
    --glow-green: rgba(16, 185, 129, 0.15);
    --glow-yellow: rgba(245, 158, 11, 0.15);
    --glow-orange: rgba(249, 115, 22, 0.15);
    --glow-red: rgba(239, 68, 68, 0.15);
    --glow-grey: rgba(100, 116, 139, 0.15);
    
    --shadow-main: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --font-stack: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
    background-color: #030712;
    background-image: 
        radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.07) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.05) 0px, transparent 50%),
        radial-gradient(at 50% 0%, rgba(168, 85, 247, 0.04) 0px, transparent 50%);
    color: var(--text-primary);
    font-family: var(--font-stack);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
    background-attachment: fixed;
}

body.modal-open {
    overflow: hidden;
}

/* App Layout */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 1.25rem;
    gap: 1.25rem;
    overflow: hidden;
    -webkit-overflow-scrolling: touch;
}

/* Header */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 1rem 2rem;
    box-shadow: 0 15px 35px -15px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    z-index: 1100;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    flex-grow: 1;
    flex-shrink: 1;
}

.logo-icon {
    font-size: 1.8rem;
    color: var(--color-blue);
    text-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

.logo-area h1 {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.logo-area h1 .thin {
    font-weight: 300;
    color: var(--text-secondary);
}

.tenant-selector-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.tenant-selector-wrapper label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.tenant-dropdown {
    background: rgba(30, 41, 59, 0.8);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 0.5rem 1.5rem 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
}

.tenant-dropdown:hover, .tenant-dropdown:focus {
    border-color: var(--color-blue);
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.3);
}

.connection-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-indicator.green {
    background-color: var(--color-green);
    box-shadow: 0 0 8px var(--color-green);
}

.status-indicator.yellow {
    background-color: var(--color-yellow);
    box-shadow: 0 0 8px var(--color-yellow);
}

.status-indicator.red {
    background-color: var(--color-red);
    box-shadow: 0 0 8px var(--color-red);
}

/* Dashboard Grid Layout */
.dashboard-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* KPIs Row */
.kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
}

.kpi-card {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.kpi-card:hover {
    transform: translateY(-3px);
}

#kpi-total:hover {
    box-shadow: 0 12px 35px -10px rgba(59, 130, 246, 0.3), 0 0 15px rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.4);
}
#kpi-total:hover .kpi-icon {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
    color: #3b82f6;
    text-shadow: 0 0 8px rgba(59, 130, 246, 0.5);
}

#kpi-active-sensors:hover {
    box-shadow: 0 12px 35px -10px rgba(16, 185, 129, 0.3), 0 0 15px rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.4);
}
#kpi-active-sensors:hover .kpi-icon {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
    color: #10b981;
    text-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

#kpi-above-80:hover {
    box-shadow: 0 12px 35px -10px rgba(249, 115, 22, 0.3), 0 0 15px rgba(249, 115, 22, 0.08);
    border-color: rgba(249, 115, 22, 0.4);
}
#kpi-above-80:hover .kpi-icon {
    background: rgba(249, 115, 22, 0.15);
    border-color: rgba(249, 115, 22, 0.3);
    color: #f97316;
    text-shadow: 0 0 8px rgba(249, 115, 22, 0.5);
}

#kpi-low-battery:hover {
    box-shadow: 0 12px 35px -10px rgba(245, 158, 11, 0.3), 0 0 15px rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.4);
}
#kpi-low-battery:hover .kpi-icon {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.3);
    color: #f59e0b;
    text-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
}

#kpi-alerts:hover {
    box-shadow: 0 12px 35px -10px rgba(239, 68, 68, 0.3), 0 0 15px rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.4);
}
#kpi-alerts:hover .kpi-icon {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
    text-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

.kpi-icon {
    font-size: 1.6rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.kpi-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.2rem;
}

.kpi-info h3 {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
    line-height: 1.2;
}

.kpi-value {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
}

/* Card Reutilizable */
.card {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    box-shadow: 0 12px 40px -10px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

main.card {
    overflow-y: auto !important;
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 12px 40px -10px rgba(0, 0, 0, 0.6), 0 0 20px rgba(59, 130, 246, 0.02);
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Map & Details section */
.map-and-details-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1rem;
    flex: 1;
    min-height: 0;
}

.map-card {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

#map {
    height: 100%;
    width: 100%;
    z-index: 1;
    flex: 1;
    min-height: 0;
}

.legend {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--text-secondary);
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.dot.green { background-color: var(--color-green); }
.dot.yellow { background-color: var(--color-yellow); }
.dot.orange { background-color: var(--color-orange); }
.dot.red { background-color: var(--color-red); }
.dot.grey { background-color: var(--color-grey); }

/* Details Card */
.details-placeholder {
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.details-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    overflow-y: auto;
}

.details-main-info h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.details-main-info .address {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-right: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
}

#detail-status {
    background: rgba(16, 185, 129, 0.1);
    color: var(--color-green);
    border-color: rgba(16, 185, 129, 0.2);
}

.divider {
    border: 0;
    height: 1px;
    background: var(--border-color);
}

.sensor-section h4, .predictions-section h4 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sensor-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

.sensor-item-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sensor-type-lbl {
    font-size: 0.85rem;
    font-weight: 500;
}

.sensor-val {
    font-weight: 700;
    font-size: 1rem;
}

.sensor-battery {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Prediction Box */
.prediction-box {
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.18);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.pred-val {
    font-size: 1.2rem;
    font-weight: 700;
    color: #60a5fa;
}

.pred-time {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.pred-conf {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-style: italic;
}

.hidden {
    display: none !important;
}

/* Lists and Alerts Section */
.lists-section {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 1rem;
    flex: 1;
    min-height: 0;
}

.list-card, .alerts-card, .predictions-list-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

/* Tables */
.table-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

th, td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

th {
    font-weight: 500;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.01);
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
}

/* Alerts List */
.alerts-list, .predictions-list {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow-y: auto;
    max-height: 280px;
}

.alert-item {
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    background: rgba(239, 68, 68, 0.05);
    border: 1px solid rgba(239, 68, 68, 0.15);
}

.alert-item.critico {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.25);
}

.alert-item.advertencia {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.25);
}

.alert-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.alert-title {
    font-weight: 600;
}

.alert-desc {
    color: var(--text-primary);
}

/* Prediction List Items */
.pred-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    border-left: 3px solid var(--color-blue);
}

.pred-item-title {
    font-weight: 600;
}

.pred-item-time {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* Responsive */
@media (max-width: 1024px) {
    .map-and-details-section {
        grid-template-columns: 1fr;
    }
    .lists-section {
        grid-template-columns: 1fr;
    }
    .app-container {
        height: auto;
    }
}

/* Estilos de los Marcadores Personalizados de Leaflet */
.custom-div-icon {
    background: transparent !important;
    border: none !important;
}

.marker-pin {
    width: 36px;
    height: 36px;
    border-radius: 50% 50% 50% 0;
    position: absolute;
    transform: rotate(-45deg);
    left: 50%;
    top: 50%;
    margin: -18px 0 0 -18px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.7);
    transition: all 0.3s ease;
}

.marker-pin:hover {
    transform: rotate(-45deg) scale(1.15);
}

.marker-pin.green {
    background-color: var(--color-green);
    box-shadow: 0 0 10px var(--glow-green);
}

.marker-pin.yellow {
    background-color: var(--color-yellow);
    box-shadow: 0 0 10px var(--glow-yellow);
}

.marker-pin.orange {
    background-color: var(--color-orange);
    box-shadow: 0 0 10px var(--glow-orange);
}

.marker-pin.red {
    background-color: var(--color-red);
    box-shadow: 0 0 10px var(--glow-red);
    animation: pulse 1.5s infinite alternate;
}

.marker-pin.grey {
    background-color: var(--color-grey);
    box-shadow: 0 0 10px var(--glow-grey);
}

.marker-inner-text {
    transform: rotate(45deg);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 700;
    margin-top: -1px;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 4px var(--color-red);
    }
    100% {
        box-shadow: 0 0 12px #ff6b6b;
    }
}

/* Resaltado de fila de tabla seleccionada */
.selected-row td {
    background-color: rgba(59, 130, 246, 0.12) !important;
    border-left: 2px solid var(--color-blue);
}

/* Nuevos elementos de cabecera y Login */
.header-right-actions {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-shrink: 0;
}

.user-badge {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

.btn-logout {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.15);
    color: var(--color-red);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    background: var(--color-red);
    color: #ffffff;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
}

/* Pantalla de Login Overlay */
.login-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at center, #111827 0%, #030712 100%);
    z-index: 10000;
    transition: opacity 0.3s ease;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(16px);
    width: 90%;
    max-width: 420px;
    padding: 2.5rem;
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    animation: fadeIn 0.4s ease-out;
}

.login-card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.login-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1.75rem;
}

.form-group {
    text-align: left;
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s ease;
}

.form-group input:focus {
    border-color: var(--color-blue);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.25);
}

.error-message {
    color: var(--color-red);
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.18);
    padding: 0.65rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
    text-align: left;
}

.btn-login {
    width: 100%;
    background: linear-gradient(135deg, var(--color-blue) 0%, #1d4ed8 100%);
    border: none;
    border-radius: 10px;
    padding: 0.85rem;
    color: #ffffff;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 0.5rem;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.45);
}

.login-footer {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
    text-align: center;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.header-nav {
    display: flex;
    gap: 0.5rem;
    margin-left: 1.5rem;
    padding-left: 1.5rem;
    border-left: 1px solid var(--border-color);
}

.header-nav::-webkit-scrollbar {
    display: none;
}

/* Estilos para el Menu Unico de Navegacion */
.main-nav-dropdown {
    position: relative;
    display: inline-block;
}

.nav-dropdown-toggle-btn {
    background: rgba(30, 41, 59, 0.7);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.55rem 1.25rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: var(--font-stack);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.nav-dropdown-toggle-btn:hover {
    background: rgba(30, 41, 59, 0.95);
    border-color: var(--color-blue);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.25);
}

.main-nav-dropdown-content {
    display: none;
    position: absolute;
    left: 0;
    top: calc(100% + 8px);
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    min-width: 240px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    padding: 0.5rem;
    flex-direction: column;
    gap: 0.25rem;
}

/* Mostrar el menu cuando tiene la clase open */
.main-nav-dropdown.open .main-nav-dropdown-content {
    display: flex;
}

/* Estilo para los botones de navegacion dentro del menu */
.main-nav-dropdown-content .nav-btn {
    text-align: left;
    width: 100%;
    padding: 0.65rem 1rem !important;
    font-size: 0.95rem !important;
    background: transparent !important;
    border: none !important;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-secondary) !important;
    transition: all 0.15s ease;
}

.main-nav-dropdown-content .nav-btn:hover {
    background: rgba(255, 255, 255, 0.05) !important;
    color: var(--text-primary) !important;
    padding-left: 1.25rem !important;
}

.main-nav-dropdown-content .nav-btn.active {
    background: rgba(59, 130, 246, 0.15) !important;
    color: var(--color-blue) !important;
    font-weight: 600;
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-family: var(--font-stack);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
    white-space: nowrap;
}

.nav-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.nav-btn.active {
    color: var(--text-primary);
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

/* Modal Overlay & Modal Card */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 14, 23, 0.75);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: all 0.3s ease;
}

.modal-card {
    background: rgba(18, 24, 38, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 2rem;
    width: 90%;
    max-width: 480px;
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.7);
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.modal-header h2 {
    font-size: 1.3rem;
    font-weight: 600;
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.8rem;
    cursor: pointer;
    transition: color 0.2s ease;
    line-height: 1;
}

.modal-close-btn:hover {
    color: var(--color-red);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 1.25rem;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 0.6rem 1.25rem;
    font-family: var(--font-stack);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.btn-primary-submit {
    background: linear-gradient(135deg, var(--color-blue), #1d4ed8);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 0.6rem 1.5rem;
    font-family: var(--font-stack);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
    transition: all 0.2s ease;
}

.btn-primary-submit:hover {
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
}

.btn-pdf {
    background: linear-gradient(135deg, #a855f7, #7c3aed) !important;
    border: none !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.25);
    transition: all 0.2s ease;
}

.btn-pdf:hover {
    box-shadow: 0 6px 16px rgba(168, 85, 247, 0.4) !important;
    transform: translateY(-1px) !important;
}

/* User Management Buttons */
.btn-add-user {
    background: linear-gradient(135deg, var(--color-blue), #1d4ed8);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 0.6rem 1.25rem;
    font-family: var(--font-stack);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
    transition: all 0.2s ease;
}

.btn-add-user:hover {
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.35);
    transform: translateY(-1px);
}

.btn-edit-user {
    background: rgba(59, 130, 246, 0.1);
    color: var(--color-blue);
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: 6px;
    padding: 0.35rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-right: 0.5rem;
}

.btn-edit-user:hover {
    background: var(--color-blue);
    color: #ffffff;
}

.btn-delete-user {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-red);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: 6px;
    padding: 0.35rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-delete-user:hover {
    background: var(--color-red);
    color: #ffffff;
}

/* ==========================================================================
   Admin Container Inventory View & Cards
   ========================================================================== */
.admin-containers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.admin-container-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.admin-container-card:hover {
    transform: translateY(-4px);
    border-color: var(--color-blue);
    background: rgba(59, 130, 246, 0.03);
    box-shadow: 0 12px 24px -10px rgba(0, 0, 0, 0.6);
}

.admin-container-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--color-grey);
}

.admin-container-card.fill-green::before { background: var(--color-green); }
.admin-container-card.fill-yellow::before { background: var(--color-yellow); }
.admin-container-card.fill-orange::before { background: var(--color-orange); }
.admin-container-card.fill-red::before { background: var(--color-red); }

.admin-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.admin-card-code {
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.5px;
}

.admin-card-type {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-card-address {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-card-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.01);
    padding: 0.5rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.admin-stat-item {
    display: flex;
    flex-direction: column;
    font-size: 0.75rem;
}

.admin-stat-lbl {
    color: var(--text-secondary);
}

.admin-stat-val {
    font-weight: 600;
    color: var(--text-primary);
}

.admin-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    padding-top: 0.5rem;
    margin-top: 0.25rem;
}

/* ==========================================================================
   Advanced Modal & Double Column Layout
   ========================================================================== */
.modal-card-large {
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 0;
    width: 95%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
    animation: modalFadeIn 0.3s ease;
    backdrop-filter: blur(20px);
}

.modal-scrollable-content {
    flex: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.modal-scrollable-content::-webkit-scrollbar {
    width: 6px;
}

.modal-scrollable-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 3px;
}

.modal-scrollable-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.modal-scrollable-content::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.4);
}

.modal-large-body {
    display: flex;
    gap: 2rem;
    margin-top: 1rem;
}

.modal-col-left {
    width: 280px;
    flex-shrink: 0;
}

.modal-col-right {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.sensor-mini-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sensor-mini-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-top: 0.1rem;
}

@media (max-width: 850px) {
    .modal-large-body {
        flex-direction: column;
    }
    .modal-col-left {
        width: 100%;
    }
}

/* ==========================================================================
   CSS 3D Container Engine
   ========================================================================== */
.bin-3d-wrapper {
    width: 200px;
    height: 240px;
    perspective: 800px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1rem auto;
}

.bin-3d {
    position: relative;
    width: 120px;
    height: 180px;
    transform-style: preserve-3d;
    transform: rotateX(-20deg) rotateY(30deg);
    transition: transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.bin-3d-wrapper:hover .bin-3d {
    transform: rotateX(-20deg) rotateY(210deg);
}

.bin-3d > .face {
    position: absolute;
    box-sizing: border-box;
    border: 2px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.015);
    backdrop-filter: blur(1px);
}

.bin-3d > .face.front {
    width: 120px;
    height: 180px;
    left: 0;
    top: 0;
    transform: rotateY(0deg) translateZ(60px);
}

.bin-3d > .face.back {
    width: 120px;
    height: 180px;
    left: 0;
    top: 0;
    transform: rotateY(180deg) translateZ(60px);
}

.bin-3d > .face.left {
    width: 120px;
    height: 180px;
    left: 0;
    top: 0;
    transform: rotateY(-90deg) translateZ(60px);
}

.bin-3d > .face.right {
    width: 120px;
    height: 180px;
    left: 0;
    top: 0;
    transform: rotateY(90deg) translateZ(60px);
}

.bin-3d > .face.top {
    width: 120px;
    height: 120px;
    left: 0;
    top: 30px;
    transform: rotateX(90deg) translateZ(90px);
    border: 3px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
}

.bin-3d > .face.bottom {
    width: 120px;
    height: 120px;
    left: 0;
    top: 30px;
    transform: rotateX(-90deg) translateZ(90px);
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

/* Fluid fill inside */
.fill-3d {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 120px;
    height: 0%; /* Set dynamically by JS */
    transform-style: preserve-3d;
    transition: height 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.fill-3d > .face {
    position: absolute;
    box-sizing: border-box;
    transition: background 0.5s ease, border-color 0.5s ease;
}

.fill-3d > .face.front {
    width: 120px;
    height: 100%;
    left: 0;
    top: 0;
    transform: rotateY(0deg) translateZ(59.8px);
}

.fill-3d > .face.back {
    width: 120px;
    height: 100%;
    left: 0;
    top: 0;
    transform: rotateY(180deg) translateZ(59.8px);
}

.fill-3d > .face.left {
    width: 120px;
    height: 100%;
    left: 0;
    top: 0;
    transform: rotateY(-90deg) translateZ(59.8px);
}

.fill-3d > .face.right {
    width: 120px;
    height: 100%;
    left: 0;
    top: 0;
    transform: rotateY(90deg) translateZ(59.8px);
}

.fill-3d > .face.top {
    width: 119.6px;
    height: 119.6px;
    left: 0.2px;
    top: -59.8px;
    transform: rotateX(90deg);
    transition: background 0.5s ease, box-shadow 0.5s ease;
}

/* Green theme */
.fill-3d.green > .face:not(.top) {
    background: rgba(16, 185, 129, 0.25);
    border: 1px solid rgba(16, 185, 129, 0.4);
}
.fill-3d.green > .face.top {
    background: rgba(16, 185, 129, 0.45);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.6);
    border: 1px solid rgba(16, 185, 129, 0.6);
}

/* Yellow theme */
.fill-3d.yellow > .face:not(.top) {
    background: rgba(245, 158, 11, 0.25);
    border: 1px solid rgba(245, 158, 11, 0.4);
}
.fill-3d.yellow > .face.top {
    background: rgba(245, 158, 11, 0.45);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.6);
    border: 1px solid rgba(245, 158, 11, 0.6);
}

/* Orange theme */
.fill-3d.orange > .face:not(.top) {
    background: rgba(249, 115, 22, 0.25);
    border: 1px solid rgba(249, 115, 22, 0.4);
}
.fill-3d.orange > .face.top {
    background: rgba(249, 115, 22, 0.45);
    box-shadow: 0 0 20px rgba(249, 115, 22, 0.6);
    border: 1px solid rgba(249, 115, 22, 0.6);
}

/* Red theme */
.fill-3d.red > .face:not(.top) {
    background: rgba(239, 68, 68, 0.25);
    border: 1px solid rgba(239, 68, 68, 0.4);
}
.fill-3d.red > .face.top {
    background: rgba(239, 68, 68, 0.45);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.6);
    border: 1px solid rgba(239, 68, 68, 0.6);
}

/* ==========================================================================
   Sección de Planificación de Rutas
   ========================================================================== */
.routes-container {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 1.5rem;
    align-items: stretch;
}

.itinerary-step {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    transition: all 0.2s ease;
}

.itinerary-step:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.itinerary-badge {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--color-blue);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.4);
}

.itinerary-badge.depot {
    background: var(--color-green);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.itinerary-info {
    flex: 1;
    min-width: 0;
}

.itinerary-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.itinerary-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
}

/* Badge de número de parada flotante sobre el pin del contenedor */
.route-number-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--color-blue);
    color: #ffffff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #0c121f;
    box-shadow: 0 0 6px rgba(59, 130, 246, 0.65);
    z-index: 1000;
}

/* Tooltip personalizado oscuro de Leaflet para información rápida al hover */
.leaflet-tooltip.route-tooltip {
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    color: var(--text-primary);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
    padding: 0.25rem 0.5rem;
}

.leaflet-tooltip-top.route-tooltip::before {
    border-top-color: rgba(15, 23, 42, 0.95);
}

/* --- Nuevos Estilos: Modo Operario, Sostenibilidad y Capa de Calor --- */

/* Selector de modo */
.route-mode-btn {
    transition: all 0.2s ease-in-out;
}
.route-mode-btn:hover {
    color: var(--text-primary);
}
.route-mode-btn.active {
    background: rgba(59, 130, 246, 0.15) !important;
    border: 1px solid rgba(59, 130, 246, 0.3) !important;
    color: var(--text-primary) !important;
}

/* Items de Itinerario Activos y Completados */
.itinerary-item.active-stop {
    border-left: 4px solid var(--color-blue) !important;
    background: rgba(59, 130, 246, 0.05) !important;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.1);
    transform: scale(1.02);
    transition: all 0.2s ease;
}

.itinerary-item.completed-stop {
    opacity: 0.55;
    border-left: 4px solid var(--color-green) !important;
    background: rgba(16, 185, 129, 0.02) !important;
    text-decoration: line-through;
}

/* Efectos para el Toggle de Heatmap */
.heatmap-toggle-label:hover {
    color: var(--text-primary) !important;
}

/* Efectos de hover para botones del Operario */
#btn-operator-empty:hover {
    filter: brightness(1.1);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.3) !important;
}
#btn-operator-empty:active {
    transform: scale(0.98);
}

/* ==========================================================================
   Estilos de Pestañas (Tabs) y Tablas de Telemetría Nordsense en el Modal
   ========================================================================== */

/* Contenedor de Botones de Pestaña */
.modal-tabs {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: rgba(15, 23, 42, 0.4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

/* Botón de Pestaña Individual */
.modal-tab-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.modal-tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.modal-tab-btn.active {
    color: #ffffff;
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.1);
}

/* Ocultar paneles inactivos */
.modal-tab-panel.hidden {
    display: none !important;
}

/* Contenedor de Tablas de Telemetría */
.telemetry-table-wrapper {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.telemetry-table-wrapper::-webkit-scrollbar {
    width: 6px;
}

.telemetry-table-wrapper::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

/* Tabla Estilizada */
.telemetry-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.telemetry-table th {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 10;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.75rem 1rem;
}

.telemetry-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.telemetry-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.telemetry-table tr:nth-child(even) td {
    background: rgba(255, 255, 255, 0.005);
}

/* Estilos adicionales para las tarjetas de analítica ecológica (Sostenibilidad) */
.eco-card:hover {
    transform: translateY(-4px);
    filter: brightness(1.1);
}
.eco-card:nth-child(1):hover {
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.12);
}
.eco-card:nth-child(2):hover {
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.12);
}
.eco-card:nth-child(3):hover {
    box-shadow: 0 8px 24px rgba(245, 158, 11, 0.12);
}
.eco-card:nth-child(4):hover {
    box-shadow: 0 8px 24px rgba(168, 85, 247, 0.12);
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}



/* Mejora B: Animación de Transición al Cambiar de Pestaña */
#view-dashboard:not(.hidden),
#view-admin-containers:not(.hidden),
#view-routes:not(.hidden),
#view-analytics:not(.hidden),
#view-users:not(.hidden),
#view-settings:not(.hidden) {
    animation: tabFadeIn 0.38s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes tabFadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   Responsive Adaptations for Mobile Devices
   ========================================================================== */

@media (max-width: 768px) {
    /* 1. App Layout Container */
    .app-container {
        height: auto !important;
        min-height: 100vh;
        overflow-y: auto !important;
        padding: 0.75rem !important;
        gap: 1rem !important;
    }

    /* 2. Main Header */
    .main-header {
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 1rem !important;
        gap: 1rem !important;
    }

    .logo-area {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.5rem !important;
        width: 100%;
    }

    .logo-area h1 {
        font-size: 1.2rem !important;
    }

    /* Horizontal scrollable navigation tabs */
    .header-nav {
        margin-left: 0 !important;
        padding-left: 0 !important;
        border-left: none !important;
        width: 100% !important;
        overflow-x: auto !important;
        padding-bottom: 0.35rem !important;
        display: flex !important;
        gap: 0.5rem !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* Hide standard Firefox scrollbar */
    }

    .header-nav::-webkit-scrollbar {
        display: none; /* Hide Chrome/Safari scrollbar */
    }

    .nav-btn {
        font-size: 0.85rem !important;
        padding: 0.45rem 0.85rem !important;
        flex-shrink: 0 !important; /* Prevents shrinking in horizontal scroll */
    }

    /* Actions area (Selector, Badges, Logout) */
    .header-right-actions {
        flex-wrap: wrap !important;
        justify-content: space-between !important;
        gap: 0.75rem !important;
        width: 100%;
        border-top: 1px solid rgba(255, 255, 255, 0.05);
        padding-top: 0.75rem;
    }

    .tenant-selector-wrapper {
        width: 100% !important;
        justify-content: space-between !important;
        gap: 0.5rem !important;
    }

    .tenant-dropdown {
        flex-grow: 1 !important;
        max-width: 100% !important;
        font-size: 0.85rem !important;
        padding: 0.45rem 1rem !important;
    }

    .user-badge {
        font-size: 0.8rem !important;
        padding: 0.45rem 0.85rem !important;
        text-align: center;
        flex-grow: 1;
    }

    .btn-logout {
        font-size: 0.8rem !important;
        padding: 0.45rem 0.85rem !important;
        flex-grow: 1;
    }

    .connection-badge {
        font-size: 0.8rem !important;
        padding: 0.45rem 0.85rem !important;
        width: 100% !important;
        justify-content: center !important;
    }

    /* 3. Map & Dashboard Layout */
    #map {
        min-height: 280px !important;
    }

    .map-and-details-section {
        min-height: auto !important;
        gap: 1rem !important;
    }

    /* 4. Analytics & Sostenibilidad */
    #view-analytics {
        padding: 1rem !important;
    }

    .eco-summary-card {
        padding: 1rem !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 1rem !important;
    }

    .eco-summary-stats {
        width: 100% !important;
        flex-wrap: wrap !important;
        justify-content: space-between !important;
        gap: 0.75rem !important;
    }

    .eco-summary-stats > div {
        flex: 1 1 calc(50% - 0.5rem) !important; /* Take half width */
        min-width: 110px !important;
        padding: 0.5rem !important;
    }

    .analytics-charts-grid {
        grid-template-columns: 1fr !important;
    }

    /* 5. Modals */
    .modal-card-large {
        width: 95% !important;
        max-height: 95vh !important;
    }
}

@media (max-width: 480px) {
    /* Even smaller screens (Mobile Portrait) */
    .logo-area {
        align-items: center !important;
        text-align: center;
    }
    
    .kpi-card {
        padding: 1rem !important;
        gap: 0.75rem !important;
    }
    
    .kpi-value {
        font-size: 1.5rem !important;
    }

    .modal-card {
        padding: 1.25rem !important;
        width: 95% !important;
    }

    .eco-summary-stats > div {
        flex: 1 1 100% !important; /* Full width on tiny screens */
    }
}

/* ==========================================================================
   Table & Dashboard UI/UX Upgrades (Premium Styles)
   ========================================================================== */

/* 1. Row effects */
#containers-table tbody tr {
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

#containers-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.03) !important;
    transform: translateY(-1px);
    box-shadow: inset 3px 0 0 var(--color-blue);
}

/* 2. Color-coded Residue Badges */
.badge-residuo-organico {
    background-color: rgba(180, 83, 9, 0.12) !important;
    color: #f59e0b !important;
    border: 1px solid rgba(180, 83, 9, 0.3) !important;
}

.badge-residuo-plastico {
    background-color: rgba(234, 179, 8, 0.1) !important;
    color: #facc15 !important;
    border: 1px solid rgba(234, 179, 8, 0.25) !important;
}

.badge-residuo-vidrio {
    background-color: rgba(16, 185, 129, 0.12) !important;
    color: #34d399 !important;
    border: 1px solid rgba(16, 185, 129, 0.3) !important;
}

.body.light-theme .nav-tab-btn.active {
    background-color: rgba(59, 130, 246, 0.1) !important;
    color: var(--color-blue) !important;
}

/* Adaptacion para pantallas medianas (laptops estandar) */
@media (max-width: 1400px) and (min-width: 769px) {
    .nav-btn {
        font-size: 0.85rem !important;
        padding: 0.4rem 0.65rem !important;
    }
    .header-nav {
        gap: 0.35rem !important;
        margin-left: 1rem !important;
        padding-left: 1rem !important;
    }
    .logo-area h1 {
        font-size: 1.2rem !important;
    }
}

.badge-residuo-papel {
    background-color: rgba(59, 130, 246, 0.12) !important;
    color: #60a5fa !important;
    border: 1px solid rgba(59, 130, 246, 0.3) !important;
}

.badge-residuo-resto {
    background-color: rgba(148, 163, 184, 0.12) !important;
    color: #cbd5e1 !important;
    border: 1px solid rgba(148, 163, 184, 0.25) !important;
}

/* 3. Fill Level Progress Bars */
.fill-level-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 110px;
}

.fill-level-bar-container {
    width: 60px;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
}

.fill-level-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Neon fill colors with shadow glows */
.fill-green {
    background: linear-gradient(90deg, #10b981 0%, #059669 100%);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

.fill-yellow {
    background: linear-gradient(90deg, #eab308 0%, #ca8a04 100%);
    box-shadow: 0 0 8px rgba(234, 179, 8, 0.6);
}

.fill-orange {
    background: linear-gradient(90deg, #f97316 0%, #ea580c 100%);
    box-shadow: 0 0 8px rgba(249, 115, 22, 0.6);
}

.fill-red {
    background: linear-gradient(90deg, #ef4444 0%, #b91c1c 100%);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.8);
}

.fill-grey {
    background: linear-gradient(90deg, #64748b 0%, #475569 100%);
}

.fill-level-text {
    font-size: 0.9rem;
    white-space: nowrap;
}

/* 4. Status Pills */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.3rem 0.75rem;
    border-radius: 99px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-pill.status-green {
    background-color: rgba(16, 185, 129, 0.1) !important;
    color: #34d399 !important;
    border: 1px solid rgba(16, 185, 129, 0.2) !important;
}

.status-pill.status-yellow {
    background-color: rgba(234, 179, 8, 0.1) !important;
    color: #facc15 !important;
    border: 1px solid rgba(234, 179, 8, 0.2) !important;
}

.status-pill.status-grey {
    background-color: rgba(148, 163, 184, 0.08) !important;
    color: #94a3b8 !important;
    border: 1px solid rgba(148, 163, 184, 0.15) !important;
}

.pulse-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.status-green .pulse-dot {
    background-color: #10b981;
    box-shadow: 0 0 6px #10b981;
    animation: statusPulse 1.8s infinite;
}

.status-yellow .pulse-dot {
    background-color: #eab308;
    box-shadow: 0 0 6px #eab308;
    animation: statusPulse 1.8s infinite;
}

.status-grey .pulse-dot {
    background-color: #94a3b8;
}

@keyframes statusPulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 5px rgba(16, 185, 129, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* 5. Battery Badges and Icons */
.battery-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.battery-icon-container {
    width: 22px;
    height: 12px;
    border: 1.5px solid #94a3b8;
    border-radius: 3px;
    position: relative;
    padding: 1px;
    display: inline-block;
    flex-shrink: 0;
}

.battery-icon-container::after {
    content: "";
    position: absolute;
    right: -3px;
    top: 2.5px;
    width: 2px;
    height: 4px;
    background: #94a3b8;
    border-radius: 0 1px 1px 0;
}

.battery-level-bar {
    height: 100%;
    border-radius: 1px;
    transition: width 0.3s ease;
}

.battery-green {
    border-color: rgba(16, 185, 129, 0.6);
}
.battery-green::after {
    background: #10b981;
}
.battery-green .battery-level-bar {
    background: #10b981;
    box-shadow: 0 0 4px rgba(16, 185, 129, 0.4);
}

.battery-yellow {
    border-color: rgba(234, 179, 8, 0.6);
}
.battery-yellow::after {
    background: #eab308;
}
.battery-yellow .battery-level-bar {
    background: #eab308;
    box-shadow: 0 0 4px rgba(234, 179, 8, 0.4);
}

.battery-red {
    border-color: rgba(239, 68, 68, 0.8);
    animation: batteryFlash 1s infinite alternate;
}
.battery-red::after {
    background: #ef4444;
}
.battery-red .battery-level-bar {
    background: #ef4444;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
}

@keyframes batteryFlash {
    0% {
        opacity: 0.4;
    }
    100% {
        opacity: 1;
    }
}

/* ==========================================================================
   Design Styled Scrollbars
   ========================================================================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.01);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    border: 2px solid transparent;
    background-clip: padding-box;
    transition: background 0.3s ease;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid transparent;
    background-clip: padding-box;
}

/* Firefox compatibility */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) rgba(255, 255, 255, 0.01);
}

.btn-range-selector {
    background: transparent;
    border: none;
    color: #94a3b8;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-range-selector:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}
.btn-range-selector.active-range {
    background: #3b82f6;
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.demo-login-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    color: #cbd5e1;
    font-size: 0.78rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
}
.demo-login-btn:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.4);
    color: #ffffff;
}

/* ==========================================================================
   AUDEO Light Theme Design System
   ========================================================================== */
body.light-theme {
    --bg-main: #f1f5f9;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --shadow-main: 0 10px 30px -10px rgba(0, 0, 0, 0.08);
    
    background-color: #f8fafc;
    background-image: 
        radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.06) 0px, transparent 50%),
        radial-gradient(at 50% 0%, rgba(168, 85, 247, 0.04) 0px, transparent 50%);
}

body.light-theme .main-header,
body.light-theme .card,
body.light-theme .modal-card-large,
body.light-theme #view-settings,
body.light-theme .login-card,
body.light-theme .admin-container-card,
body.light-theme .user-card,
body.light-theme .event-card,
body.light-theme .list-card,
body.light-theme .map-card,
body.light-theme .alerts-card,
body.light-theme .predictions-list-card,
body.light-theme .details-card {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05) !important;
    color: #0f172a !important;
}

body.light-theme input,
body.light-theme select,
body.light-theme textarea {
    background: #f8fafc !important;
    color: #0f172a !important;
    border-color: #cbd5e1 !important;
}

body.light-theme th {
    background: #f1f5f9 !important;
    color: #475569 !important;
    border-bottom: 2px solid #e2e8f0 !important;
}

body.light-theme td {
    border-bottom: 1px solid #f1f5f9 !important;
    color: #334155 !important;
}

body.light-theme tr:hover {
    background: rgba(59, 130, 246, 0.05) !important;
}

body.light-theme .nav-tab-btn {
    color: #64748b;
}

body.light-theme .nav-tab-btn:hover {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.08);
}

body.light-theme .nav-tab-btn.active {
    background: #3b82f6;
    color: #ffffff;
}

body.light-theme .modal-overlay {
    background: rgba(15, 23, 42, 0.6) !important;
    backdrop-filter: blur(8px) !important;
}

body.light-theme .modal-tabs {
    background: #f1f5f9 !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

body.light-theme .modal-tab-btn {
    color: #64748b !important;
}

body.light-theme .modal-tab-btn.active {
    background: #ffffff !important;
    color: #3b82f6 !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05) !important;
}

/* ==========================================================================
   AUDEO Aesthetic Enhancements & Micro-Interactions
   ========================================================================== */

/* 1. Pulse Animation for Critical Container Markers on Map */
.pulse-marker-red {
    border-radius: 50%;
    animation: pulse-ring-red 2s infinite;
}
@keyframes pulse-ring-red {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.8), 0 0 12px rgba(239, 68, 68, 0.6);
    }
    70% {
        box-shadow: 0 0 0 16px rgba(239, 68, 68, 0), 0 0 20px rgba(239, 68, 68, 0.8);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0), 0 0 12px rgba(239, 68, 68, 0);
    }
}

/* 2. Interactive Card Hover Elevation */
.card, .admin-container-card, .user-card, .event-card, .list-card, .map-card, .alerts-card, .predictions-list-card, .details-card {
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), border-color 0.3s ease;
}
.card:hover, .admin-container-card:hover, .user-card:hover, .event-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 35px -5px rgba(0, 0, 0, 0.4), 0 0 18px rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3) !important;
}

/* 3. Skeleton Shimmer Loading Animation */
.skeleton {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.03) 25%, rgba(255, 255, 255, 0.08) 37%, rgba(255, 255, 255, 0.03) 63%);
    background-size: 400% 100%;
    animation: skeleton-shimmer 1.4s ease infinite;
    border-radius: 6px;
    color: transparent !important;
}
@keyframes skeleton-shimmer {
    0% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* 4. KPI Progress Trackers */
.kpi-progress-track {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 0.5rem;
}
.kpi-progress-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}
.kpi-progress-bar.green { background: linear-gradient(90deg, #10b981, #34d399); }
.kpi-progress-bar.yellow { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.kpi-progress-bar.orange { background: linear-gradient(90deg, #f97316, #fb923c); }
.kpi-progress-bar.red { background: linear-gradient(90deg, #ef4444, #f87171); }

/* 5. Enhanced 3D Liquid Surface Wave */
.fill-3d {
    box-shadow: inset 0 0 15px rgba(255, 255, 255, 0.2);
}
.fill-3d > .face.top {
    position: relative;
    overflow: hidden;
}
.fill-3d > .face.top::after {
    content: '';
    position: absolute;
    top: 0; left: -50%; width: 200%; height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.35) 0%, transparent 65%);
    animation: wave-sheen 3s infinite linear;
}
@keyframes wave-sheen {
    0% { transform: translate(-30%, -30%) rotate(0deg); }
    100% { transform: translate(30%, 30%) rotate(360deg); }
}
/* Animación del sentido de circulación mediante guiones en movimiento (Flow effect) */
@keyframes routeFlow {
    to {
        stroke-dashoffset: -22;
    }
}

.animated-flow-route {
    stroke-dasharray: 10, 12;
    animation: routeFlow 1.2s linear infinite;
}

.animated-flow-real {
    stroke-dasharray: 8, 10;
    animation: routeFlow 1.5s linear infinite;
}

.animated-flow-opt {
    stroke-dasharray: 10, 12;
    animation: routeFlow 1s linear infinite;
}
