/* ============ ESTILOS GENERALES FTTH ============ */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

#map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Título principal */
.super-red-title {
    position: absolute;
    top: 15px;
    left: 80px;
    font-size: 36px;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 0 #000, -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000;
    letter-spacing: 2px;
    z-index: 1000;
}

.super-red-title .red-part {
    color: #00ff00;
}

/* Mejora de visibilidad de calles en mapa */
.leaflet-tile {
    filter: contrast(1.05) brightness(1.02);
}

/* Barra superior */
.top-toolbar {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border-radius: 50px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    padding: 8px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1000;
    flex-wrap: wrap;
    justify-content: center;
}

.map-type-btn {
    padding: 6px 15px;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.map-type-btn.active {
    background: #3498db;
    color: white;
}

.map-type-btn:not(.active) {
    background: #f0f0f0;
    color: #666;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 340px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    padding: 20px;
    z-index: 1000;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    transition: all 0.3s ease;
}

.sidebar h2 {
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #007bff;
    font-size: 1.3em;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Buscador */
.search-container {
    margin-bottom: 15px;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 12px 40px 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 30px;
    font-size: 14px;
}

.search-input:focus {
    outline: none;
    border-color: #3498db;
}

.search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    cursor: pointer;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1002;
    display: none;
    margin-top: 5px;
}

.search-result-item {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-result-item:hover {
    background: #f0f7ff;
}

.result-name {
    flex: 1;
}

.result-type {
    font-size: 10px;
    color: #666;
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 10px;
}

/* Info usuario */
.user-info-sidebar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #e8f4f8;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 13px;
    flex-wrap: wrap;
}

.user-info-sidebar i {
    color: #27ae60;
}

.user-info-sidebar button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 5px 8px;
    border-radius: 5px;
}

.user-role {
    font-size: 10px;
    background: #3498db;
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
}

/* Bloqueo global */
.global-lock {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8f9fa;
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid #dee2e6;
}

.global-lock span {
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.lock-toggle {
    width: 50px;
    height: 26px;
    background: #e74c3c;
    border-radius: 30px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s;
}

.lock-toggle.locked {
    background: #27ae60;
}

.lock-toggle .lock-slider {
    width: 22px;
    height: 22px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lock-toggle.locked .lock-slider {
    left: 26px;
}

/* Capas */
.layer-item {
    margin-bottom: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

.layer-header {
    background: #f8f9fa;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.layer-header input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.layer-header label {
    flex: 1;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
}

.layer-controls {
    display: flex;
    gap: 5px;
}

.minimize-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #6c757d;
    font-size: 14px;
    padding: 2px 6px;
    border-radius: 4px;
}

.add-btn {
    background: #28a745;
    color: white;
    border: none;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.add-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.layer-items-list {
    max-height: 120px;
    overflow-y: auto;
    padding: 8px;
    background: white;
    transition: max-height 0.3s ease;
}

.layer-items-list.minimized {
    max-height: 0;
    padding: 0 8px;
    overflow: hidden;
}

.layer-item-entry {
    padding: 6px 8px;
    border-bottom: 1px solid #eee;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.layer-item-entry:hover {
    background: #e9ecef;
}

/* Estadísticas */
.stats-section {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    margin-top: 15px;
}

.stats-section h3 {
    font-size: 15px;
    margin-bottom: 8px;
}

.stats-section p {
    margin: 5px 0;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
}

.stats-section span {
    font-weight: bold;
    color: #007bff;
}

/* Menús contextuales */
#contextMenu,
#fibraContextMenu,
#mangaContextMenu {
    position: absolute;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    padding: 8px 0;
    display: none;
    z-index: 2000;
    min-width: 200px;
}

#contextMenu button,
#fibraContextMenu button,
#mangaContextMenu button {
    display: block;
    width: 100%;
    padding: 10px 15px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

#contextMenu button:hover,
#fibraContextMenu button:hover,
#mangaContextMenu button:hover {
    background: #f0f7ff;
}

/* Paneles */
#configPanel,
#cajaEditPanel,
#rutaEditPanel,
#mangaPanel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    display: none;
    z-index: 3000;
    overflow: hidden;
    flex-direction: column;
}

#configPanel {
    width: 700px;
    max-width: 95vw;
    max-height: 90vh;
}

#cajaEditPanel,
#rutaEditPanel {
    width: 500px;
    max-width: 95vw;
    max-height: 90vh;
}

#mangaPanel {
    width: 1200px;
    max-width: 95vw;
    max-height: 90vh;
}

/* ============ ESTILOS MEJORADOS PARA CAJA EDIT PANEL (AUTO-SCROLL + BOTONES VISIBLES) ============ */
.caja-edit-content {
    padding: 20px;
    overflow-y: auto !important;
    max-height: calc(90vh - 80px) !important;
}

.caja-edit-content input,
.caja-edit-content select,
.caja-edit-content textarea {
    width: 100%;
    padding: 10px;
    margin-bottom: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
}

.caja-edit-content input:focus,
.caja-edit-content select:focus,
.caja-edit-content textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52,152,219,0.2);
}

.caja-edit-content label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
    margin-bottom: 10px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

/* Botones con marcos de color */
.caja-edit-content button,
.ruta-edit-content button,
.manga-footer button,
.config-content button {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
}

.caja-edit-content button:first-of-type {
    background: linear-gradient(135deg, #27ae60, #219a52);
    color: white;
    border: 1px solid #1e7e43;
}

.caja-edit-content button:first-of-type:hover {
    background: linear-gradient(135deg, #219a52, #1e7e43);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(39,174,96,0.3);
}

.caja-edit-content button:last-of-type {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    border: 1px solid #a93226;
}

.caja-edit-content button:last-of-type:hover {
    background: linear-gradient(135deg, #c0392b, #a93226);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231,76,60,0.3);
}

/* Grupo de gestión de puertos con borde de color */
.caja-edit-group {
    background: #f0f7ff;
    border: 2px solid #3498db;
    border-radius: 10px;
    padding: 15px;
    margin: 15px 0;
}

.caja-edit-group label {
    background: #3498db;
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: inline-block;
}

/* Login */
#loginOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-container {
    text-align: center;
    max-width: 500px;
    width: 100%;
    padding: 20px;
}

.login-super-title {
    font-size: 48px;
    font-weight: bold;
    margin-bottom: 10px;
}

.login-super-title span:first-child {
    color: #333;
}

.login-super-title span:last-child {
    color: #00ff00;
}

.login-title {
    font-size: 36px;
    font-weight: bold;
    color: #000;
    margin-bottom: 15px;
}

.location-icons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
}

.location-icon {
    font-size: 50px;
    color: #e74c3c;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

.login-form {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.login-input-group {
    margin-bottom: 15px;
    text-align: left;
}

.login-input-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.login-input-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
}

.login-button {
    width: 100%;
    padding: 12px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: bold;
    cursor: pointer;
}

.login-error {
    color: #e74c3c;
    font-size: 13px;
    margin-top: 10px;
    display: none;
}

/* Toolbar medidas */
.measure-panel {
    position: absolute;
    top: 90px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border-radius: 50px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    padding: 12px 25px;
    display: none;
    align-items: center;
    gap: 20px;
    z-index: 1000;
}

#coordInfo {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: white;
    border-radius: 30px;
    padding: 8px 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 2;
    display: none;
    font-size: 12px;
}

/* Responsive */
@media screen and (max-width: 768px) {
    .sidebar {
        width: 280px;
        right: 10px;
        top: 70px;
    }
    .top-toolbar {
        padding: 4px 10px;
    }
    .map-type-btn {
        padding: 4px 8px;
        font-size: 10px;
    }
    .super-red-title {
        font-size: 22px;
        left: 15px;
        top: 10px;
    }
    #cajaEditPanel {
        width: 95vw !important;
        max-height: 90vh !important;
    }
    .caja-edit-content {
        max-height: calc(90vh - 100px) !important;
    }
}

/* ============ ESTILOS PARA MANGA ============ */
@keyframes blink-animation {
    0% { background-color: #fff3cd; }
    50% { background-color: #ffeeba; }
    100% { background-color: #fff3cd; }
}

.fibra-item.selected {
    background: #cce5ff !important;
    border: 2px solid #007bff;
    animation: pulseSelected 1.5s infinite;
}

.fibra-item.connected {
    border-left: 5px solid #2ecc71;
    background: #f0fff0;
}

/* Puntos de color junto al nombre de la fibra en MANGA */
.fibra-color {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin-right: 10px;
    vertical-align: middle;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.fibra-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.fibra-numero {
    font-size: 13px;
    font-weight: 500;
}

@keyframes pulseSelected {
    0% { background-color: #cce5ff; }
    50% { background-color: #99ccff; }
    100% { background-color: #cce5ff; }
}

.color-picker-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 5px;
    margin: 10px 0;
}

.color-option {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.color-option:hover {
    transform: scale(1.2);
    border-color: #333;
}

.preview-line.fider {
    background: #3498db;
    height: 6px;
    border-radius: 3px;
}

.preview-line.drop {
    background: #000000;
    height: 6px;
    border-radius: 3px;
    border: 2px solid #9b59b6;
}

.preview-line.cobre {
    background: #e67e22;
    height: 6px;
    border-radius: 3px;
}

/* Efecto de brillo para fibras conectadas en MANGA */
.fibra-conectada {
    animation: fibraGlow 1.5s ease-in-out infinite !important;
    position: relative;
    z-index: 10;
    border-radius: 8px;
}

@keyframes fibraGlow {
    0% {
        box-shadow: 0 0 0px 0px rgba(39, 174, 96, 0);
        background-color: rgba(39, 174, 96, 0);
    }
    50% {
        box-shadow: 0 0 12px 5px rgba(39, 174, 96, 0.7);
        background-color: rgba(39, 174, 96, 0.15);
    }
    100% {
        box-shadow: 0 0 0px 0px rgba(39, 174, 96, 0);
        background-color: rgba(39, 174, 96, 0);
    }
}

/* Animación para MANGA en el mapa */
@keyframes mangaGlow {
    0% {
        filter: drop-shadow(0 0 2px #9b59b6);
        transform: scale(1);
    }
    50% {
        filter: drop-shadow(0 0 15px #9b59b6) drop-shadow(0 0 5px #ff00ff);
        transform: scale(1.15);
    }
    100% {
        filter: drop-shadow(0 0 2px #9b59b6);
        transform: scale(1);
    }
}

.manga-activa {
    animation: mangaGlow 1.5s ease-in-out infinite !important;
    cursor: pointer;
    display: inline-block;
}

/* ============ ANIMACIÓN LÁSER PARA RUTAS ========== */
@keyframes laserPulse {
    0% {
        filter: drop-shadow(0 0 2px #ff6600);
        transform: scale(1);
    }
    50% {
        filter: drop-shadow(0 0 8px #ff6600);
        transform: scale(1.1);
    }
    100% {
        filter: drop-shadow(0 0 2px #ff6600);
        transform: scale(1);
    }
}

.laser-marker {
    animation: laserPulse 0.5s ease-in-out infinite !important;
    filter: drop-shadow(0 0 5px currentColor);
    transition: all 0.05s linear;
}

/* Animación para el punto láser que recorre la ruta */
@keyframes laserTrail {
    0% {
        opacity: 1;
        transform: scale(0.8);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.2);
    }
    100% {
        opacity: 1;
        transform: scale(0.8);
    }
}

.laser-point {
    animation: laserTrail 0.3s ease-in-out infinite;
    filter: drop-shadow(0 0 8px #ff6600);
}

/* Puntos de ruta con color según señal */
.punto-ruta-excelente {
    background: #27ae60 !important;
    box-shadow: 0 0 10px rgba(39, 174, 96, 0.8);
    animation: pulsoVerde 1s ease-in-out infinite;
}

.punto-ruta-media {
    background: #f39c12 !important;
    box-shadow: 0 0 10px rgba(243, 156, 18, 0.8);
    animation: pulsoAmarillo 1.2s ease-in-out infinite;
}

.punto-ruta-baja {
    background: #e74c3c !important;
    box-shadow: 0 0 10px rgba(231, 76, 60, 0.8);
    animation: pulsoRojo 0.8s ease-in-out infinite;
}

@keyframes pulsoVerde {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: 0.9; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes pulsoAmarillo {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.85; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes pulsoRojo {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

/* Animación para blink de cajas */
@keyframes blink-padre {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes blink-hija {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

/* Animación para gradiente en conexiones de MANGA */
@keyframes moveGradient {
    0% { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
}

.conexion-gradiente {
    background: linear-gradient(90deg, #0066CC, #0066CC80, white, #FF990080, #FF9900);
    background-size: 300% 100%;
    animation: moveGradient 2s linear infinite;
    height: 4px;
    margin: 5px 0;
    border-radius: 2px;
}

/* Efecto radar para cobertura */
@keyframes radarPulse {
    0% { transform: scale(0.95); opacity: 0.8; stroke-width: 3px; }
    50% { transform: scale(1.05); opacity: 0.4; stroke-width: 2px; }
    100% { transform: scale(1.15); opacity: 0; stroke-width: 1px; }
}

.radar-wave {
    animation: radarPulse 2s ease-out infinite;
    pointer-events: none;
}

/* Menú retráctil para móvil */
.sidebar.retraido {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.sidebar {
    transition: transform 0.3s ease;
    z-index: 999;
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        z-index: 1000;
        width: 280px !important;
        right: auto;
    }
    #map {
        width: 100% !important;
        left: 0 !important;
    }
    .sidebar.retraido {
        transform: translateX(-100%);
    }
    #btnMenuMovil {
        display: flex !important;
    }
}

@media (min-width: 769px) {
    #btnMenuMovil {
        display: none !important;
    }
}

/* Botón flotante menú móvil */
#btnMenuMovil {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    background: #2c3e50;
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

#btnMenuMovil:hover {
    background: #9b59b6;
    transform: scale(1.05);
}

/* Estilos para el presupuesto óptico */
.presupuesto-sidebar {
    transition: all 0.3s ease;
}

.presupuesto-sidebar:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Estilos para cajas con potencia */
.potencia-excelente {
    color: #27ae60;
    background: #1a3a1a;
    padding: 2px 6px;
    border-radius: 10px;
    display: inline-block;
    font-weight: bold;
}

.potencia-media {
    color: #f39c12;
    background: #3a2a1a;
    padding: 2px 6px;
    border-radius: 10px;
    display: inline-block;
    font-weight: bold;
}

.potencia-baja {
    color: #e74c3c;
    background: #3a1a1a;
    padding: 2px 6px;
    border-radius: 10px;
    display: inline-block;
    font-weight: bold;
}

/* Estilos para items de fibra en MANGA */
.fibra-item {
    transition: all 0.2s ease;
    cursor: pointer;
    border-radius: 8px;
    padding: 8px;
    margin: 4px 0;
    background: #f5f5f5;
    border-left: 3px solid transparent;
}

.fibra-item:hover {
    background: #e0e0e0;
    transform: translateX(3px);
}

.fibra-item.selected {
    background: #3498db !important;
    color: white;
    border-left-color: #ff0000;
}

.fibra-item.connected {
    border-left: 4px solid #27ae60;
}

.fibra-item.fibra-conectada {
    background: linear-gradient(90deg, #e8f5e9, #c8e6c9) !important;
}

/* Estilos para bloques de colores en MANGA */
.bloque-colores {
    border: 2px solid #3498db;
    border-radius: 10px;
    margin-bottom: 15px;
    overflow: hidden;
}

.bloque-titulo {
    background: #f0f0f0;
    padding: 10px;
    border-bottom: 2px solid #3498db;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.bloque-titulo-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.bloque-actions {
    display: flex;
    gap: 5px;
}

.bloque-colores-content {
    padding: 10px;
    max-height: 300px;
    overflow-y: auto;
}

/* Estilos para conexiones activas en MANGA */
.conexion-item {
    transition: all 0.3s ease;
}

.conexion-item:hover {
    transform: translateX(5px);
    background: #e8f5e9 !important;
}

/* Estilos para el panel de edición de caja */
.caja-edit-header,
.ruta-edit-header,
.manga-header,
.config-header {
    background: #2c3e50;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.caja-edit-header button,
.ruta-edit-header button,
.manga-header button,
.config-header button {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
}

.caja-edit-content,
.ruta-edit-content {
    padding: 20px;
    overflow-y: auto;
}

/* Estilos para el panel de MANGA */
.manga-tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
    background: #f8f9fa;
}

.manga-tab {
    padding: 12px 20px;
    cursor: pointer;
    border: none;
    background: none;
    font-weight: bold;
}

.manga-tab.active {
    border-bottom: 2px solid #9b59b6;
    color: #9b59b6;
}

.manga-content {
    display: flex;
    gap: 20px;
    padding: 20px;
    min-height: 500px;
    overflow-y: auto;
}

.columna-fibras {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

.columna-header {
    background: #f8f9fa;
    padding: 12px;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.espacio-central {
    width: 300px;
    overflow-y: auto;
}

.manga-footer {
    padding: 15px;
    border-top: 1px solid #ddd;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.manga-footer button {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.manga-footer button:first-child {
    background: #27ae60;
    color: white;
}

.manga-footer button:last-child {
    background: #e74c3c;
    color: white;
}

/* Estilos para impresión */
@media print {
    .sidebar,
    #btnMenuMovil,
    .leaflet-control-container,
    .top-toolbar,
    .history-panel,
    #contextMenu,
    .measure-panel {
        display: none !important;
    }
    #map {
        width: 100% !important;
        height: 100% !important;
    }
    body {
        margin: 0;
        padding: 0;
    }
}

/* Estilos para el historial */
.history-list {
    position: fixed;
    bottom: 60px;
    right: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    width: 280px;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    z-index: 1001;
}

.history-item {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s;
}

.history-item:hover {
    background: #e8f4f8;
}

.history-item span:first-child {
    font-size: 14px;
}

.history-item small {
    margin-left: auto;
    color: #999;
    font-size: 10px;
}

.history-empty {
    padding: 20px;
    text-align: center;
    color: #999;
    font-size: 12px;
}

.history-panel {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #2c3e50;
    color: white;
    border-radius: 8px;
    padding: 8px 15px;
    font-size: 12px;
    z-index: 1000;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-panel:hover {
    background: #9b59b6;
}

/* Mensajes temporales */
#temporalMessage {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 14px;
    z-index: 10001;
    pointer-events: none;
    white-space: nowrap;
    font-weight: bold;
    display: none;
}

#saveIndicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 11px;
    z-index: 1000;
    transition: opacity 0.3s;
    opacity: 0;
}

/* Config panel tabs */
.config-section {
    display: none;
}

.config-section.active {
    display: block;
}

.config-tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
    padding: 0 20px;
}

.config-tab {
    padding: 10px 20px;
    cursor: pointer;
    border: none;
    background: none;
    font-weight: bold;
}

.config-tab.active {
    border-bottom: 2px solid #3498db;
    color: #3498db;
}

.config-content {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.staff-list,
.backup-list,
.log-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 15px;
}

.add-staff-form {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.add-staff-form input,
.add-staff-form select {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.config-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #2c3e50;
    color: white;
}

.config-header button {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
}

/* Drop options */
.drop-options {
    display: flex;
    gap: 10px;
    margin: 10px 0;
}

.drop-option {
    flex: 1;
    padding: 8px;
    text-align: center;
    background: #f0f0f0;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
}

.drop-option:hover {
    background: #3498db;
    color: white;
}

.drop-option.selected {
    background: #27ae60;
    color: white;
}
@media (max-width: 768px) {
    .sidebar {
        display: none !important;
    }
}
@media (max-width: 768px) {
    .sidebar {
        display: none !important;
    }
}
/* REACTIVAR MENÚ EN CELULAR - PONER AL FINAL DEL CSS */
@media (max-width: 768px) {
    .sidebar {
        display: block !important;
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        z-index: 1000;
        width: 280px !important;
        right: auto;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.retraido {
        transform: translateX(0);
    }
    
    #btnMenuMovil {
        display: flex !important;
        position: fixed;
        bottom: 20px;
        left: 20px;
        z-index: 1001;
        background: #2c3e50;
        color: white;
        border: none;
        border-radius: 50%;
        width: 50px;
        height: 50px;
        font-size: 24px;
        cursor: pointer;
        align-items: center;
        justify-content: center;
        box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    }
}