:root {
    /* Color Palette */
    --bg-dark: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    /* Status Colors */
    --status-green: #22c55e;
    --status-yellow: #eab308;
    --status-pink: #ec4899;
    --status-red: #ef4444;
    --status-gray: #64748b;

    /* Fonts */
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-family);
    overflow: hidden;
    height: 100vh;
}

/* Layout */
.dashboard-layout {
    display: grid;
    grid-template-rows: auto 1fr;
    height: 100vh;
}

/* Header */
.dashboard-header {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.teck-logo-placeholder {
    font-weight: 900;
    letter-spacing: 2px;
    font-size: 1.5rem;
    background: linear-gradient(90deg, #fbbf24, #f59e0b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.dashboard-header h1 {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-muted);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.user-badge {
    background: var(--card-bg);
    padding: 0.5rem 1rem;
    border-radius: 99px;
    font-size: 0.85rem;
    border: 1px solid var(--border-color);
}

.logout-btn {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s;
}

.logout-btn:hover {
    color: var(--status-red);
}

/* Main Content */
.dashboard-main {
    display: grid;
    grid-template-columns: 320px 1fr;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    background: rgba(15, 23, 42, 0.5);
    border-right: 1px solid var(--border-color);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    overflow-y: auto;
}

.sidebar h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.estaciones-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.estacion-item {
    background: var(--card-bg);
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: transform 0.2s, background 0.2s, border-color 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.estacion-item:hover {
    transform: translateX(4px);
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(255, 255, 255, 0.18);
}

/* Semaphore dot — now on the LEFT */
.status-dot {
    width: 12px;
    height: 12px;
    min-width: 12px;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(255,255,255,0.2);
    flex-shrink: 0;
}

/* Middle section: name + checkbox */
.estacion-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.est-name {
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.est-status-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Checkbox row */
.est-check-row {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 8px;
}

.est-check-row input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border: 1.5px solid var(--text-muted);
    border-radius: 3px;
    background: rgba(255,255,255,0.04);
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    transition: all 0.2s;
}

.est-check-row input[type="checkbox"]:checked {
    background: #fbbf24;
    border-color: #fbbf24;
}

.est-check-row input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 3.5px;
    top: 1px;
    width: 4px;
    height: 8px;
    border: solid #0f172a;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.est-check-row label {
    font-size: 0.65rem;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
    line-height: 1.2;
}

/* LEQ value — prominent on the RIGHT */
.est-leq-value {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-main);
    flex-shrink: 0;
    text-align: right;
    line-height: 1;
}

.est-leq-unit {
    display: block;
    font-size: 0.55rem;
    font-weight: 500;
    color: var(--text-muted);
    text-align: right;
    margin-top: 1px;
    letter-spacing: 0.5px;
}

/* Status Classes */
.status-green .status-dot { background-color: var(--status-green); box-shadow: 0 0 12px var(--status-green); }
.status-yellow .status-dot { background-color: var(--status-yellow); box-shadow: 0 0 12px var(--status-yellow); }
.status-pink .status-dot { background-color: var(--status-pink); box-shadow: 0 0 12px var(--status-pink); }
.status-red .status-dot { background-color: var(--status-red); box-shadow: 0 0 12px var(--status-red); }

/* Color tinting on the LEQ value */
.status-green .est-leq-value { color: var(--status-green); }
.status-yellow .est-leq-value { color: var(--status-yellow); }
.status-pink .est-leq-value { color: var(--status-pink); }
.status-red .est-leq-value { color: var(--status-red); }

/* Map View */
.map-view {
    position: relative;
    background: #000;
}

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

.dashboard-stats {
    position: absolute;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    gap: 1rem;
    z-index: 500;
}

.stat-card {
    background: var(--card-bg);
    backdrop-filter: blur(8px);
    padding: 1rem 1.5rem;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    min-width: 150px;
}

.stat-card h4 {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.stat-card p {
    font-size: 1.5rem;
    font-weight: 700;
}

.txt-red { color: var(--status-red); }

/* Leaflet Overrides */
.leaflet-container {
    background: #0f172a !important;
}

/* Custom Marker Styling */
.custom-semaforo-marker {
    background: none;
    border: none;
}

.marker-wrapper {
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.marker-ripple {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    animation: ripple 2s infinite ease-out;
}

.marker-core {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid white;
    z-index: 2;
}

@keyframes ripple {
    0% { transform: scale(0.5); opacity: 0.8; border: 2px solid currentColor; }
    100% { transform: scale(2.0); opacity: 0; border: 1px solid currentColor; }
}

/* Leaflet Dark Popup */
.leaflet-dark-popup .leaflet-popup-content-wrapper {
    background: rgba(15, 23, 42, 0.95);
    color: #f8fafc;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    font-family: 'Inter', sans-serif;
}

.leaflet-dark-popup .leaflet-popup-tip {
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.leaflet-dark-popup .leaflet-popup-close-button {
    color: #94a3b8;
}

.leaflet-dark-popup .leaflet-popup-close-button:hover {
    color: #f8fafc;
}

/* Leaflet Attribution (subtle) */
.leaflet-control-attribution {
    background: rgba(15, 23, 42, 0.7) !important;
    color: #64748b !important;
    font-size: 0.65rem !important;
}

.leaflet-control-attribution a {
    color: #94a3b8 !important;
}

/* Leaflet Zoom Control Dark Theme */
.leaflet-control-zoom a {
    background: rgba(15, 23, 42, 0.85) !important;
    color: #f8fafc !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

.leaflet-control-zoom a:hover {
    background: rgba(30, 41, 59, 0.95) !important;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(4px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-content {
    background: var(--bg-dark);
    width: 1000px;
    max-width: 90vw;
    border-radius: 24px;
    border: 1px solid var(--border-color);
    padding: 2.5rem;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
}

.close-modal {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
}

.modal-header-info {
    margin-bottom: 2rem;
}

.modal-header-info h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.chart-container {
    background: rgba(255,255,255,0.03);
    padding: 1.5rem;
    border-radius: 16px;
    height: 300px;
}

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

.metric-box {
    background: rgba(255,255,255,0.03);
    padding: 1rem;
    border-radius: 12px;
}

.metric-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.metric-value {
    font-size: 1.2rem;
    font-weight: 600;
}

/* Login Page Styling */
.login-container {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
}

.login-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    padding: 3rem;
    border-radius: 28px;
    border: 1px solid var(--border-color);
    width: 420px;
    box-shadow: 0 50px 100px -20px rgba(0,0,0,0.6);
    text-align: center;
}

.logo-section h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
    background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-section p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

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

.form-group label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    padding-left: 0.5rem;
}

.form-group input {
    width: 100%;
    padding: 1rem 1.25rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    color: white;
    font-size: 1rem;
    transition: all 0.3s;
}

.form-group input:focus {
    outline: none;
    background: rgba(255,255,255,0.07);
    border-color: #fbbf24;
    box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.1);
}

.login-btn {
    width: 100%;
    padding: 1.1rem;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    border: none;
    border-radius: 14px;
    color: #0f172a;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 1rem;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px rgba(245, 158, 11, 0.4);
}

.login-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.error-msg {
    margin-top: 1.5rem;
    padding: 0.75rem;
    background: rgba(239, 68, 68, 0.1);
    color: var(--status-red);
    border-radius: 10px;
    font-size: 0.85rem;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* ===== Enhanced Modal - Historical Data View ===== */

.modal-status-badge {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hist-chart-container {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1rem 1rem 0.5rem;
    height: 280px;
    margin-bottom: 1.5rem;
}

.station-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.info-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    text-align: center;
}

.info-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.info-value-large {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.info-sublabel {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.info-value {
    font-size: 1.3rem;
    font-weight: 700;
    margin-top: 0.5rem;
}

.trend-icon {
    font-size: 1.5rem;
    vertical-align: middle;
    margin-left: 0.25rem;
}

/* Distribution Bar */
.distribution-section {
    margin-bottom: 0.5rem;
}

.distribution-section h4 {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-main);
}

.dist-subtitle {
    color: var(--text-muted);
    font-weight: 400;
}

.distribution-bar {
    display: flex;
    height: 36px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 0.35rem;
    border: 1px solid rgba(255,255,255,0.06);
}

.dist-segment {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: #0f172a;
    transition: flex 0.5s ease;
    min-width: 28px;
}

.dist-green { background: linear-gradient(135deg, #22c55e, #16a34a); }
.dist-yellow { background: linear-gradient(135deg, #eab308, #ca8a04); }
.dist-red { background: linear-gradient(135deg, #ef4444, #dc2626); }

.distribution-scale {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    color: var(--text-muted);
    padding: 0 2px;
    margin-bottom: 0.5rem;
}

.distribution-legend {
    display: flex;
    gap: 1.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    margin-right: 4px;
    vertical-align: middle;
}

/* Silence Button */
.silence-btn {
    margin-top: 1.5rem;
    width: 100%;
    padding: 1rem;
    border-radius: 12px;
    background: rgba(255,255,255,0.05);
    color: white;
    border: 1px solid var(--border-color);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: var(--font-family);
    transition: all 0.2s;
}

.silence-btn:hover {
    background: rgba(255,255,255,0.1);
    border-color: #fbbf24;
    transform: translateY(-1px);
}

/* Loading Spinner */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: #fbbf24;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════════════════
   AUDIO PLAYER MODAL (overlays station modal)
   ═══════════════════════════════════════════════════ */

.audio-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    animation: fadeInAudio 0.25s ease;
}

@keyframes fadeInAudio {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.audio-modal-content {
    background: linear-gradient(145deg, #0f172a 0%, #1e293b 100%);
    width: 680px;
    max-width: 92vw;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 2rem 2.25rem;
    position: relative;
    box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.6),
                0 0 40px rgba(251, 191, 36, 0.05);
    animation: slideUpAudio 0.3s ease;
}

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

.audio-modal-header {
    margin-bottom: 1.25rem;
}

.audio-modal-header h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.25rem;
}

.audio-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Spectrogram Canvas */
.spectrogram-canvas {
    width: 100%;
    height: 180px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 1.25rem;
    display: block;
}

/* Audio Controls */
.audio-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    display: none; /* hidden until audio loads */
}

.audio-play-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    border: none;
    color: #0f172a;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.3);
}

.audio-play-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(251, 191, 36, 0.4);
}

.audio-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    min-width: 36px;
    text-align: center;
    flex-shrink: 0;
}

.audio-progress-bar {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.audio-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #fbbf24, #f59e0b);
    border-radius: 3px;
    width: 0%;
    transition: width 0.1s linear;
    position: relative;
}

.audio-progress-fill::after {
    content: '';
    position: absolute;
    right: -5px;
    top: -4px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fbbf24;
    box-shadow: 0 0 6px rgba(251, 191, 36, 0.5);
    opacity: 0;
    transition: opacity 0.2s;
}

.audio-progress-bar:hover .audio-progress-fill::after {
    opacity: 1;
}

/* Loading State */
.audio-loading {
    text-align: center;
    padding: 2rem 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.audio-loading .loading-spinner {
    margin-bottom: 1rem;
}

/* Error State */
.audio-error {
    text-align: center;
    padding: 1.5rem;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 12px;
    color: var(--status-red);
    font-size: 0.85rem;
}

/* ===== Permanent Station Labels on Map ===== */
.station-label {
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: #f8fafc;
    font-family: var(--font-family);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    padding: 3px 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    white-space: nowrap;
}

.station-label::before {
    border-bottom-color: rgba(15, 23, 42, 0.85) !important;
}

/* ═══════════════════════════════════════════════════
   ADMIN MODULE STYLES
   ═══════════════════════════════════════════════════ */

.admin-main {
    padding: 2rem 3rem 4rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.admin-section {
    margin-bottom: 3rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
}

.help-text {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #0f172a;
    border: none;
    padding: 0.65rem 1.5rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-family);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(245, 158, 11, 0.3);
}

.btn-secondary {
    background: rgba(255,255,255,0.05);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 0.65rem 1.5rem;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-family);
}

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

.btn-icon {
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 8px;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: rgba(255,255,255,0.1);
    transform: scale(1.15);
}

.admin-nav-btn {
    background: rgba(255,255,255,0.05);
    color: var(--text-main);
    text-decoration: none;
    padding: 0.5rem 1.25rem;
    border-radius: 10px;
    font-size: 0.85rem;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}

.admin-nav-btn:hover {
    background: rgba(255,255,255,0.1);
    border-color: #fbbf24;
}

/* Admin Table */
.admin-table-wrapper {
    overflow-x: auto;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table thead {
    background: rgba(255,255,255,0.04);
}

.admin-table th {
    padding: 1rem 1.25rem;
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

.admin-table td {
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    font-size: 0.9rem;
}

.admin-table tbody tr {
    transition: background 0.15s;
}

.admin-table tbody tr:hover {
    background: rgba(255,255,255,0.03);
}

.cell-name { font-weight: 600; }
.cell-email { color: var(--text-muted); }
.cell-date { color: var(--text-muted); font-size: 0.8rem; }
.cell-actions { text-align: center; white-space: nowrap; }

/* Role Badges */
.role-badge {
    padding: 0.3rem 0.75rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.badge-admin {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.badge-ops {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-env {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.status-badge {
    padding: 0.25rem 0.65rem;
    border-radius: 99px;
    font-size: 0.7rem;
    font-weight: 600;
}

.badge-active {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.badge-inactive {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

/* Permissions Grid */
.permissions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.permission-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    transition: border-color 0.2s;
}

.permission-card:hover {
    border-color: rgba(251, 191, 36, 0.3);
}

.permission-card-header {
    margin-bottom: 1.25rem;
}

.permission-card-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.permission-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    transition: background 0.15s;
}

.checkbox-label:hover {
    background: rgba(255,255,255,0.04);
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    position: relative;
    transition: all 0.2s;
    flex-shrink: 0;
}

.checkbox-label input:checked + .checkbox-custom {
    background: #fbbf24;
    border-color: #fbbf24;
}

.checkbox-label input:checked + .checkbox-custom::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.7rem;
    font-weight: 800;
    color: #0f172a;
}

.checkbox-label input:disabled + .checkbox-custom {
    opacity: 0.5;
}

.btn-save-perms {
    width: 100%;
    padding: 0.7rem;
    background: rgba(255,255,255,0.05);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    font-family: var(--font-family);
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-save-perms:hover {
    background: rgba(251, 191, 36, 0.1);
    border-color: #fbbf24;
    color: #fbbf24;
}

/* Stations Info Grid */
.stations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.station-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1.25rem;
}

.station-card h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.station-card p {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Admin Modals */
.admin-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(4px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 3000;
}

.admin-modal {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2rem;
    width: 480px;
    max-width: 90vw;
    box-shadow: 0 25px 60px rgba(0,0,0,0.5);
}

.admin-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.admin-modal-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
}

.admin-modal select {
    width: 100%;
    padding: 0.85rem 1rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: white;
    font-size: 0.95rem;
    font-family: var(--font-family);
    appearance: none;
    cursor: pointer;
}

.admin-modal select:focus {
    outline: none;
    border-color: #fbbf24;
    box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.1);
}

.admin-modal select option {
    background: #1e293b;
    color: white;
}

.form-error {
    padding: 0.75rem;
    background: rgba(239, 68, 68, 0.1);
    color: var(--status-red);
    border-radius: 10px;
    font-size: 0.85rem;
    border: 1px solid rgba(239, 68, 68, 0.2);
    margin-bottom: 1rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.modal-actions .btn-primary,
.modal-actions .btn-secondary {
    flex: 1;
    padding: 0.85rem;
    text-align: center;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 4000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 0.85rem 1.5rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: var(--font-family);
    transition: all 0.3s ease;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    animation: toastIn 0.3s ease forwards;
}

.toast-success {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #22c55e;
}

.toast-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(100%); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ═══════════════════════════════════════════════════
   REPORTS MODULE STYLES
   ═══════════════════════════════════════════════════ */

/* Filter Bar */
.report-filters {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
    align-items: flex-end;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    min-width: 180px;
}

.filter-group label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 600;
}

.filter-group select,
.filter-group input[type="date"] {
    width: 100%;
    padding: 0.85rem 1rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: white;
    font-size: 0.95rem;
    font-family: var(--font-family);
    transition: all 0.2s;
}

.filter-group select {
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

.filter-group select:focus,
.filter-group input[type="date"]:focus {
    outline: none;
    border-color: #fbbf24;
    box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.1);
}

.filter-group select option {
    background: #1e293b;
    color: white;
}

/* Date input calendar icon styling */
.filter-group input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.7);
    cursor: pointer;
}

.filter-actions {
    flex-direction: row;
    align-items: flex-end;
    gap: 0.75rem;
    min-width: auto;
    flex: 0 0 auto;
}

.btn-report {
    padding: 0.85rem 2rem !important;
    font-size: 0.95rem !important;
    white-space: nowrap;
}

/* Summary Cards */
.report-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.summary-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    transition: transform 0.2s, border-color 0.2s;
    position: relative;
    overflow: hidden;
}

.summary-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255,255,255,0.18);
}

.summary-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 16px 16px 0 0;
}

.summary-total::before { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.summary-rojo::before { background: #ef4444; }
.summary-rosado::before { background: #ec4899; }
.summary-amarillo::before { background: #f59e0b; }
.summary-leq::before { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.summary-max::before { background: linear-gradient(90deg, #ef4444, #f87171); }

.summary-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.summary-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin: 0 auto 0.5rem;
    box-shadow: 0 0 12px currentColor;
}

.summary-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 0.5rem;
    font-variant-numeric: tabular-nums;
}

.summary-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.summary-rojo .summary-value { color: #ef4444; }
.summary-rosado .summary-value { color: #ec4899; }
.summary-amarillo .summary-value { color: #f59e0b; }
.summary-leq .summary-value { color: #60a5fa; }
.summary-max .summary-value { color: #f87171; }

/* Color Badges */
.color-badge {
    padding: 0.3rem 0.85rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    display: inline-block;
}

.badge-color-rojo {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-color-rosado {
    background: rgba(236, 72, 153, 0.15);
    color: #ec4899;
    border: 1px solid rgba(236, 72, 153, 0.3);
}

.badge-color-amarillo {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-color-verde {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

/* Pagination */
.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    margin-top: 1.5rem;
    padding: 1rem 0;
}

.pag-info {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.btn-pag {
    padding: 0.5rem 1.25rem !important;
    font-size: 0.8rem !important;
}

.btn-pag:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* Empty State */
.empty-state-container {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state-container h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.75rem;
}

.empty-state-container p {
    font-size: 0.9rem;
    max-width: 480px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Detail Button */
.btn-detalle {
    background: rgba(251, 191, 36, 0.1);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.25);
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    margin-left: 0.5rem;
    transition: all 0.2s;
    font-family: var(--font-family);
    vertical-align: middle;
}

.btn-detalle:hover {
    background: rgba(251, 191, 36, 0.2);
    border-color: #fbbf24;
    transform: scale(1.05);
}

/* Dark select dropdowns */
select,
.admin-main select,
.report-filters select {
    background-color: var(--bg-card, #1e293b) !important;
    color: var(--text-primary, #f1f5f9) !important;
}

select option {
    background-color: #1e293b;
    color: #f1f5f9;
}
/* Alert Popup Styles */
.alert-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1.5);
    background-color: rgba(239, 68, 68, 0.85); /* Semi-transparent red */
    backdrop-filter: blur(4px);
    border: 2px solid #ef4444;
    border-radius: 4px;
    display: flex;
    align-items: center;
    padding: 12px 20px;
    gap: 15px;
    z-index: 9999;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.alert-popup:hover {
    background-color: rgba(239, 68, 68, 1);
    transform: translate(-50%, -50%) scale(1.53);
}

.alert-popup-icon {
    background-color: white;
    padding: 5px;
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.alert-popup-text {
    display: flex;
    flex-direction: column;
    color: white;
    font-family: 'Inter', sans-serif;
    line-height: 1.3;
}

.alert-popup-pulse {
    position: relative;
    width: 24px;
    height: 24px;
    margin-left: 10px;
}

.alert-popup-pulse .pulse-dot {
    width: 16px;
    height: 16px;
    background-color: #ff8a8a;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
}

.alert-popup-pulse::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    border: 2px solid #ff8a8a;
    border-radius: 50%;
    animation: pulse-ring 1.5s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
    z-index: 1;
}

@keyframes pulse-ring {
    0% { transform: translate(-50%, -50%) scale(0.8); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(2.5); opacity: 0; }
}
