:root {
    --primary-color: #0d1b2a;
    /* Navy Blue */
    --royal-blue: #4169E1;
    /* Royal Blue */
    --gris-rey-dark: #36454f;
    --gris-rey-light: #536878;
    --secondary-color: #c9a227;
    /* Gold */
    --accent-color: #e0e1dd;
    /* Off-white */
    --text-dark: #1b263b;
    --text-light: #ffffff;
    --danger-color: #d90429;
    --success-color: #2a9d8f;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--accent-color);
    color: var(--text-dark);
    line-height: 1.6;
    /* Prevent horizontal scroll on mobile */
    overflow-x: hidden;
}

/* Header & Navigation */
header {
    background-color: #f8f9fa;
    /* Light Background */
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-bottom: 5px solid #c9a227;
    /* Gold border */
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    flex-wrap: wrap;
    /* Allow wrapping on small screens */
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo img {
    height: 60px;
    /* Adjust based on preference */
    width: auto;
    object-fit: contain;
}

.nav-links {
    display: flex;
    gap: 15px;
    margin-top: 10px;
    /* Space on wrap */
}

.nav-links a {
    color: #0d1b2a;
    /* Navy Blue Text */
    text-decoration: none;
    font-weight: 600;
    /* Bolder text */
    transition: color 0.3s;
    font-size: 0.95rem;
    text-transform: uppercase;
}

.nav-links a:hover,
.nav-links a.active {
    color: #c9a227;
    /* Gold on hover */
    border-bottom: 2px solid #c9a227;
    /* Underline effect */
}

/* Hero Section */
.hero {
    position: relative;
    min-height: 70vh;
    /* Allow growth */
    height: auto;
    /* Fix overflow issue */
    padding: 2rem 0;
    /* Add vertical spacing */
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    text-align: center;
    overflow: visible;
    /* Allow content to show */
    background-color: #000;
    border-bottom: 5px solid var(--secondary-color);
    /* Gold divider */
}

/* Hero Gray King Variant (Fallback) */
.hero-gray-king {
    background-color: #536878;
    background-image: linear-gradient(135deg, #36454f 0%, #536878 100%);
}

/* Consistent Page Header for sub-pages */
.page-hero {
    background-color: #536878;
    /* Gris Rey */
    background-image: linear-gradient(135deg, #36454f 0%, #536878 100%);
    color: white;
    padding: 3rem 1rem;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
    border-bottom: 5px solid var(--secondary-color);
    /* Gold divider */
}

.page-hero h1 {
    font-size: 2.2rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
}

.hero-content {
    position: relative;
    z-index: 2;
    padding: 1rem;
    width: 100%;
}

.hero p {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 2rem;
    color: var(--secondary-color);
    /* Gold color for contrast */
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
}

.hero h1 {
    font-size: 2rem;
    /* Mobile friendly */
    margin-bottom: 1rem;
    text-transform: uppercase;
    border-bottom: 2px solid var(--secondary-color);
    display: inline-block;
}

/* Buttons - Mobile Optimized */
.btn {
    display: inline-block;
    padding: 15px 30px;
    /* Larger touch target */
    background-color: var(--secondary-color);
    color: var(--primary-color);
    text-decoration: none;
    font-weight: bold;
    border-radius: 8px;
    transition: background 0.3s;
    margin-top: 10px;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    touch-action: manipulation;
    /* Improves touch response */
}

.btn:hover {
    background-color: #b08d1f;
    transform: translateY(-3px);
    /* Lift effect */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: translateY(1px);
    /* Press effect */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Outline Button Variant */
.btn-outline {
    background-color: transparent;
    border: 2px solid var(--secondary-color);
    color: var(--secondary-color);
    transition: all 0.3s ease;
}

.btn-outline:hover {
    background-color: var(--secondary-color);
    color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: 0 0 15px rgba(201, 162, 39, 0.4);
    /* Gold glow */
}

/* Illuminated Button Variant */
.btn-glow {
    background-color: var(--secondary-color);
    /* Solid Gold */
    color: var(--primary-color);
    box-shadow: 0 0 15px rgba(201, 162, 39, 0.6);
    /* Permanent Glow */
    border: 2px solid var(--secondary-color);
    transition: all 0.3s ease;
}

.btn-glow:hover {
    background-color: #ffd700;
    /* Brighter Gold on Hover */
    box-shadow: 0 0 25px rgba(201, 162, 39, 1), 0 0 50px rgba(201, 162, 39, 0.6);
    /* Super Glow */
    transform: translateY(-4px) scale(1.05);
    /* Lift and grow */
    color: #000;
}

.btn-glow:active {
    transform: translateY(1px) scale(0.98);
    box-shadow: 0 0 10px rgba(201, 162, 39, 0.8);
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #b0021e;
}

/* Generic Section Styles */
.section {
    padding: 2rem 1rem;
    /* More compact padding */
    max-width: 1200px;
    margin: 0 auto;
}

.section h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 1.8rem;
}

.card-container {
    display: flex;
    gap: 20px;
    flex-direction: column;
    /* Stack by default on mobile */
}

.card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--box-shadow);
    text-align: center;
    flex: 1;
}

/* Forms - Mobile Optimized */
form {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--box-shadow);
}

.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
    font-weight: bold;
    font-size: 1rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    /* Easy to tap */
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    /* Prevents iOS zoom */
}

/* Login specific */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

/* Dashboard specific */
.panic-grid {
    display: grid;
    grid-template-columns: 1fr;
    /* Stack vertically on mobile */
    gap: 15px;
    margin-top: 2rem;
}

.dash-btn {
    padding: 2rem;
    font-size: 1.2rem;
    text-transform: uppercase;
    width: 100%;
    /* Full width on mobile */
    transition: transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.dash-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.dash-btn:active {
    transform: scale(0.95);
}

/* Media Queries for Tablet/Desktop */
@media (min-width: 768px) {
    .nav-links {
        margin-top: 0;
    }

    .hero h1 {
        font-size: 3rem;
    }

    .card-container {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .panic-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

/* Gold Divider Utility */
.gold-divider {
    height: 4px;
    background-color: var(--secondary-color);
    width: 80px;
    margin: 2rem auto;
    border-radius: 2px;
}

/* --- Image Modal (Lightbox) --- */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    padding-top: 50px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9);
}

.modal-content {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 800px;
    max-height: 85vh;
    object-fit: contain;
    border: 2px solid var(--secondary-color);
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(201, 162, 39, 0.5);
}

#caption {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
    text-align: center;
    color: #ccc;
    padding: 10px 0;
    font-size: 1.2rem;
}

.close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    z-index: 2001;
}

.close:hover,
.close:focus {
    color: var(--secondary-color);
    text-decoration: none;
    cursor: pointer;
}

/* Zoom Animation */
.modal-content,
#caption {
    animation-name: zoom;
    animation-duration: 0.6s;
}

@keyframes zoom {
    from {
        transform: scale(0)
    }

    to {
        transform: scale(1)
    }
}

@media only screen and (max-width: 700px) {
    .modal-content {
        width: 100%;
    }
}

/* Utility Class */
.hidden {
    display: none !important;
}

/* --- BOTONES DE EMERGENCIA PERSONALIZADOS --- */
.emergency-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.btn-emergency {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px;
    border-radius: 12px;
    border: none;
    text-decoration: none;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    /* Elastic bounce */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    height: 140px;
    /* Fixed height for consistency */
}

.btn-emergency span {
    margin-top: 10px;
    font-size: 0.9rem;
    text-transform: uppercase;
    text-align: center;
}

.emergency-icon {
    width: 60px;
    height: 60px;
    object-fit: contain;
    transition: transform 0.3s ease;
    font-size: 3rem;
    /* Tamaño para iconos FontAwesome */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Animaciones y Hover */
.btn-emergency:hover {
    transform: scale(1.05) translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.btn-emergency:hover .emergency-icon {
    transform: scale(1.1) rotate(5deg);
}

.btn-emergency:active {
    transform: scale(0.95);
}

/* Variantes Específicas */
.btn-central {
    background-color: #e9ecef;
    /* Gris Claro */
    color: #333;
    border: 2px solid #ccc;
}

.btn-911 {
    background-color: #ffc107;
    /* Amber */
    color: #333;
    /* Dark text for contrast */
    border: 2px solid #e0a800;
}

.btn-fire {
    background-color: #ff5e00;
    /* Strong Orange-Red */
    color: white;
    /* White text for contrast */
    border: 2px solid #e04f00;
}

.btn-medical {
    background-color: #ffffff;
    color: #d90429;
    /* Red text */
    border: 2px solid #e0e0e0;
}

/* --- BOTÓN DE PÁNICO S.O.S --- */
.btn-sos {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: radial-gradient(circle, #ff0000 0%, #b30000 100%);
    border: 4px solid #fff;
    box-shadow: 0 0 0 4px #ff0000, 0 0 20px rgba(255, 0, 0, 0.6);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    transition: all 0.2s ease;
    animation: pulse-red 2s infinite;
    padding: 0;
    overflow: hidden;
}

.btn-sos:active {
    transform: scale(0.95);
}

.sos-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.sos-inner span {
    color: white;
    font-size: 2rem;
    font-weight: 900;
    font-family: 'Arial Black', sans-serif;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: 2px;
    line-height: 1;
    text-align: center;
    display: block;
    width: 100%;
}

@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.7);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(255, 0, 0, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 0, 0, 0);
    }
}

/* --- ADMIN DASHBOARD LAYOUT (NUEVO) --- */
.admin-wrapper {
    display: flex;
    min-height: calc(100vh - 80px);
    /* Restando el header apróx */
    width: 100%;
}

.admin-sidebar {
    width: 250px;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
    z-index: 100;
    position: sticky;
    top: 75px;
    height: calc(100vh - 75px);
    overflow-y: auto;
}

.admin-sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 2px solid var(--secondary-color);
}

.admin-sidebar-nav {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding-top: 20px;
}

.admin-sidebar-btn {
    background: none;
    border: none;
    color: #ccc;
    padding: 15px 20px;
    text-align: left;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 15px;
    border-left: 4px solid transparent;
}

.admin-sidebar-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.admin-sidebar-btn.active {
    background-color: rgba(255, 255, 255, 0.15);
    color: var(--secondary-color);
    border-left: 4px solid var(--secondary-color);
    font-weight: bold;
}

.admin-main {
    flex: 1;
    padding: 20px;
    padding-bottom: 100px;
    /* Increased bottom padding */
    background-color: #f4f6f9;
}

/* Tab visiblity */
.admin-tab-pane {
    display: none;
    animation: fadeIn 0.4s ease-in-out;
}

.admin-tab-pane.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hamburger toggle for mobile sidebar */
.admin-sidebar-toggle {
    display: none;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    font-size: 1.5rem;
    position: fixed;
    bottom: 20px;
    right: 20px;
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    z-index: 2000;
}

@media (max-width: 768px) {
    .admin-wrapper {
        flex-direction: column;
    }

    .admin-sidebar {
        position: fixed;
        left: 0;
        top: 80px;
        /* Header height */
        bottom: 0;
        height: auto;
        transform: translateX(-100%);
    }

    .admin-sidebar.show {
        transform: translateX(0);
    }

    .admin-sidebar-toggle {
        display: block;
    }

    .admin-main {
        max-height: none;
        overflow-y: visible;
        padding-bottom: 80px;
    }
}

/* --- ESTILO GLOBAL PIE DE PÁGINA --- */
footer,
.footer-vip,
.footer {
    background-color: #f8f9fa !important;
    color: #0d1b2a !important;
    padding: 10px 20px !important;
    text-align: center !important;
    font-size: 0.8rem !important;
    width: 100% !important;
    border-top: 5px solid #c9a227 !important;
    border-bottom: 5px solid #c9a227 !important;
    /* Línea dorada inferior */
    position: relative !important;
    z-index: 10 !important;
}

footer p,
.footer-vip p,
.footer p {
    margin: 2px 0 !important;
    color: #0d1b2a !important;
}

#dev-credits {
    font-size: 0.65rem !important;
    opacity: 0.5 !important;
    margin-top: 2px !important;
}

footer a,
.footer-vip a,
.footer a {
    color: #0d1b2a !important;
    text-decoration: underline !important;
}