:root {
    --bg-dark: #0a0a0a;
    --bg-panel: #111111;
    --border-color: #222222;
    --text-main: #ffffff;
    --text-muted: #888888;
    --accent-red: #E30613;
    
    --color-blue: #007bff;
    --color-yellow: #ffc107;
    --color-green: #28a745;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow: hidden;
    /* Comportamiento de App Nativa */
    touch-action: manipulation; 
    -webkit-user-select: none; 
    user-select: none; 
    -webkit-tap-highlight-color: transparent;
}

input, textarea {
    -webkit-user-select: auto;
    user-select: auto;
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: 350px;
    background-color: var(--bg-panel);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 20px;
    z-index: 1000;
    box-shadow: 2px 0 15px rgba(0,0,0,0.5);
}

.brand {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.logo-box {
    width: 50px;
    height: 50px;
    background-color: var(--accent-red);
    color: white;
    font-weight: 800;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(227, 6, 19, 0.4);
}

.brand-title {
    font-size: 2.6rem;
    letter-spacing: 1px;
    font-weight: 900;
    margin-bottom: 5px;
    font-family: 'Segoe UI Black', Impact, sans-serif;
    filter: drop-shadow(0px 8px 6px rgba(0,0,0,0.9));
    display: flex;
    justify-content: center;
}

.metallic-silver {
    background: linear-gradient(to bottom, #ffffff 0%, #a6a6a6 48%, #333333 50%, #999999 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.metallic-red {
    background: linear-gradient(to bottom, #ff4d4d 0%, #b30000 48%, #4d0000 50%, #cc0000 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.metallic-silver-small {
    background: linear-gradient(to bottom, #ffffff 0%, #cccccc 48%, #888888 50%, #aaaaaa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.metallic-red-small {
    background: linear-gradient(to bottom, #ff9999 0%, #ff3333 48%, #cc0000 50%, #ff1a1a 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand p {
    color: var(--accent-red);
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 400;
}

/* Status Cards */
.status-summary {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.status-card {
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.2s;
}

.status-card:hover {
    transform: translateX(5px);
    background-color: rgba(255, 255, 255, 0.05);
}

.dot {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 10px currentColor;
}

.dot-blue { color: var(--color-blue); background-color: var(--color-blue); }
.dot-yellow { color: var(--color-yellow); background-color: var(--color-yellow); }
.dot-green { color: var(--color-green); background-color: var(--color-green); }

.info h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 400;
}

.info h2 {
    font-size: 1.5rem;
    margin-top: 5px;
}

/* Calendar Mockup */
.calendar-section h3 {
    font-size: 1rem;
    margin-bottom: 15px;
    color: var(--text-muted);
}

.calendar-mockup {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 15px;
}

.calendar-mockup p {
    text-align: center;
    margin-bottom: 10px;
    font-weight: 600;
}

.days, .dates {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    gap: 5px;
}

.days span {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-bottom: 5px;
}

.dates span {
    font-size: 0.9rem;
    padding: 5px 0;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s;
}

.dates span:hover {
    background-color: rgba(255,255,255,0.1);
}

.dates span.active {
    border: 2px solid var(--accent-red);
}

.dates span.goal-yellow {
    background-color: var(--color-yellow);
    color: #000;
    font-weight: bold;
}

.dates span.goal-green {
    background-color: var(--color-green);
    color: #fff;
    font-weight: bold;
}

/* Map Container */
.map-container {
    flex: 1;
    position: relative;
}

#map {
    width: 100%;
    height: 100%;
    background-color: #000; /* Darker than default gray */
}

/* Custom Leaflet Marker Styles */
.custom-marker {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    transition: transform 0.3s;
}

.custom-marker:hover {
    transform: scale(1.3);
    z-index: 1000 !important;
}

.marker-pendiente { background-color: var(--color-blue); box-shadow: 0 0 10px var(--color-blue); }
.marker-en_proceso { background-color: var(--color-yellow); box-shadow: 0 0 10px var(--color-yellow); animation: pulse 1.5s infinite; }
.marker-terminado { background-color: var(--color-green); box-shadow: 0 0 10px var(--color-green); }

/* Tooltips (Etiquetas al hacer hover) */
.leaflet-tooltip {
    background-color: var(--bg-panel) !important;
    color: var(--text-main) !important;
    border: 1px solid var(--accent-red) !important;
    border-radius: 6px !important;
    box-shadow: 0 5px 15px rgba(227, 6, 19, 0.2) !important;
    font-weight: 600 !important;
    padding: 8px 12px !important;
}

.leaflet-tooltip-top:before { border-top-color: var(--accent-red) !important; }
.leaflet-tooltip-bottom:before { border-bottom-color: var(--accent-red) !important; }
.leaflet-tooltip-left:before { border-left-color: var(--accent-red) !important; }
.leaflet-tooltip-right:before { border-right-color: var(--accent-red) !important; }

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(255, 193, 7, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0); }
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    transform: translateY(20px);
    transition: transform 0.3s;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal h2 { margin-bottom: 10px; }
.modal p { color: var(--text-muted); margin-bottom: 25px; font-size: 0.9rem; }

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.btn {
    padding: 12px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    color: white;
    transition: filter 0.2s;
}

.btn:hover { filter: brightness(1.2); }

.btn-blue { background-color: var(--color-blue); }
.btn-yellow { background-color: var(--color-yellow); color: #000; }
.btn-green { background-color: var(--color-green); }

.btn-close {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 8px 20px;
    border-radius: 4px;
    cursor: pointer;
}

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

.input-dark {
    width: 100%;
    padding: 10px;
    background: #000;
    border: 1px solid var(--border-color);
    color: white;
    border-radius: 6px;
    font-size: 1.1rem;
    text-align: center;
}
.input-dark:focus {
    outline: none;
    border-color: var(--color-blue);
}

/* =========================================
   LOGIN SCREEN
   ========================================= */
.login-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle at center, #1a1a1a 0%, #000000 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.login-box {
    background: var(--bg-panel);
    padding: 40px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 0 30px rgba(227, 6, 19, 0.2);
    text-align: center;
    width: 90%;
    max-width: 400px;
}

.login-subtitle {
    color: var(--accent-red);
    letter-spacing: 3px;
    font-weight: 600;
    margin-bottom: 30px;
    font-size: 1rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.login-form input {
    background: #0a0a0a;
    border: 1px solid #333;
    color: white;
    padding: 12px;
    border-radius: 6px;
    font-size: 1rem;
    text-align: center;
    transition: all 0.3s;
    font-family: inherit;
    font-weight: bold;
}

.login-form input:focus {
    outline: none;
    border-color: var(--accent-red);
    box-shadow: 0 0 10px rgba(227, 6, 19, 0.3);
}

.btn-login {
    background: var(--accent-red);
    color: white;
    padding: 12px;
    font-weight: bold;
    letter-spacing: 1px;
    border-radius: 6px;
    margin-top: 10px;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
}

.btn-login:hover {
    background: #ff1a26;
    box-shadow: 0 0 15px rgba(227, 6, 19, 0.6);
}

.login-error {
    color: #ff4d4d;
    font-size: 0.9rem;
    margin-top: -5px;
    margin-bottom: 5px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        max-height: 40vh; /* Límite de altura para dejar espacio al mapa */
        overflow-y: auto; /* Scroll vertical si hay mucho contenido */
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 10px;
    }
    
    /* Mantener el logo principal, ajustando su tamaño para no empujar el mapa */
    .brand img { 
        display: block !important; 
        width: 80px !important; 
        margin: 0 auto 5px auto !important; 
    }
    
    .brand-title {
        font-size: 2rem;
        margin-bottom: 0;
    }
    
    .brand p {
        font-size: 0.9rem;
        margin-bottom: 5px;
    }
    
    .brand { margin-bottom: 5px; padding-bottom: 5px; }
    
    /* Tarjetas de estado súper compactas (1/3 cada una) */
    .status-summary {
        display: flex;
        flex-direction: row; /* Fuerza horizontal */
        flex-wrap: nowrap;
        padding-bottom: 5px;
        margin-bottom: 10px;
        justify-content: space-between;
        gap: 5px;
    }
    
    .status-card {
        flex: 1;
        padding: 5px 2px;
        margin: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        border-radius: 6px;
    }
    
    .status-card .dot {
        margin: 0 0 3px 0; /* Punto arriba, texto abajo */
        width: 10px; height: 10px;
    }
    
    .info h3 { font-size: 0.6rem; letter-spacing: -0.5px; }
    .info h2 { font-size: 1rem; margin-top: 2px; }
    
    /* Mostrar calendario ultra compacto */
    .calendar-section {
        display: block; 
        margin-top: 5px;
        margin-bottom: 5px;
    }
    
    .calendar-section h3 {
        font-size: 0.75rem;
        margin-bottom: 5px;
        text-align: center;
    }
    
    .calendar-mockup {
        padding: 5px;
        border-radius: 6px;
    }
    
    .days {
        display: none; /* Ocultar nombres de días en móvil para ahorrar espacio */
    }

    .dates {
        gap: 2px;
    }

    .dates span {
        height: 20px; 
        font-size: 0.65rem;
        padding: 1px;
        line-height: 18px;
    }
    
    .map-container {
        flex: 1; /* Ocupa el espacio restante */
    }
}

/* =========================================
   MEDIA UPLOADS & GALLERY
   ========================================= */
.btn-upload {
    background-color: #333;
    color: white;
    font-size: 0.85rem;
    padding: 8px 12px;
    flex: 1;
    display: inline-block;
    text-align: center;
    border: 1px solid #555;
}
.btn-upload:hover { background-color: #444; }

.btn-upload-360 {
    background-color: var(--accent-red);
    color: white;
    font-size: 0.85rem;
    padding: 8px 12px;
    flex: 1;
    display: inline-block;
    text-align: center;
    border: 1px solid #ff1a26;
}
.btn-upload-360:hover { filter: brightness(1.2); }

.media-gallery-container {
    max-height: 200px;
    overflow-y: auto;
    margin-top: 10px;
    padding-right: 5px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.media-gallery-container::-webkit-scrollbar {
    width: 6px;
}
.media-gallery-container::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

.media-group-title {
    font-size: 0.8rem;
    color: var(--text-muted);
    border-bottom: 1px solid #333;
    padding-bottom: 3px;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
}

.media-item {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    background-color: #222;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid transparent;
    transition: border-color 0.2s;
}

.media-item:hover {
    border-color: var(--accent-red);
}

.media-item img, .media-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.delete-media-btn {
    position: absolute;
    top: 4px;
    left: 4px;
    background: rgba(0, 0, 0, 0.7);
    color: #ff4d4d;
    border: 1px solid #ff4d4d;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    cursor: pointer;
    z-index: 20;
    transition: all 0.2s ease;
}

.delete-media-btn:hover {
    background: #ff4d4d;
    color: white;
}

.media-badge-360 {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--accent-red);
    color: white;
    font-size: 0.6rem;
    font-weight: bold;
    padding: 2px 4px;
    border-radius: 3px;
    pointer-events: none;
}

.media-badge-video {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--color-blue);
    color: white;
    font-size: 0.6rem;
    font-weight: bold;
    padding: 2px 4px;
    border-radius: 3px;
    pointer-events: none;
}

/* =========================================
   FULL SCREEN VIEWER (Pannellum / Image / Video)
   ========================================= */
.viewer-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #000;
    z-index: 99999;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.btn-close-viewer {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(227, 6, 19, 0.8);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    z-index: 100000;
    backdrop-filter: blur(5px);
}
.btn-close-viewer:hover { background: var(--accent-red); }

#panorama-container {
    width: 100%;
    height: 100%;
}

#viewer-img, #viewer-video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
