:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg: #0f172a;
    --header-bg: #0f172a;
    --card-bg: #1e293b;
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --error: #ef4444;
}

.app-header, .bottom-sheet-nav, .sub-nav {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg);
    color: var(--text);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding: 0;
}

main {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Cambiado de center a flex-start */
    width: 100%;
    padding: 2rem;
}


.container {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: 1.5rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    width: 100%;
    max-width: 1400px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.container-login {
    max-width: 400px;
    margin: auto; /* Centra verticalmente la caja de login aunque el main sea flex-start */
}


h1 {
    font-size: 1.875rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-align: center;
    background: linear-gradient(to right, #818cf8, #c084fc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;

}

p.subtitle {
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 2rem;
    font-size: 0.875rem;
}

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

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

input, textarea, select {
    width: 100%;
    padding: 0.8rem 1.2rem;
    background: rgba(15, 23, 42, 0.6) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 0.8rem;
    color: white !important;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.2s;
    outline: none;
    box-sizing: border-box;
}

input:focus, textarea:focus, select:focus {
    border-color: var(--primary) !important;
    background: rgba(15, 23, 42, 0.8) !important;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

button {
    width: 100%;
    padding: 0.75rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 1rem;
}

button:hover {
    background: var(--primary-hover);
}

.error-msg {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    padding: 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
    border: 1px solid rgba(239, 68, 68, 0.2);
    text-align: center;
}

.profile-info {
    margin-top: 2rem;
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

.info-value {
    font-weight: 500;
}

.logout-link {
    display: block;
    text-align: center;
    margin-top: 2rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s;
}

.logout-link:hover {
    color: var(--error);
}

/* --- Nuevo Sistema de Navegación App --- */
.app-header {
    width: 100%;
    background: var(--header-bg, #0f172a);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    z-index: 9999;
    height: 60px; /* Más compacto */
}

.app-nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    height: 100%;
}

.app-logo {
    text-decoration: none;
    font-weight: 900;
    color: white !important;
    font-size: 1.2rem;
}

.app-nav-list {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.app-nav-list a {
    color: var(--text-muted) !important;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.6rem 1rem;
    border-radius: 0.75rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.app-nav-list a i { font-size: 1rem; }

.app-nav-list a:hover, .app-nav-list a.active {
    color: white !important;
    background: rgba(255, 255, 255, 0.05);
}

.app-nav-list a.active {
    color: var(--primary) !important;
    background: rgba(99, 102, 241, 0.1);
}

.nav-item-lang {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0 1rem;
}

.app-menu-toggle {
    display: none;
    color: white !important;
    font-size: 1.3rem !important;
    cursor: pointer !important;
    width: 40px !important;
    height: 40px !important;
    justify-content: center;
    align-items: center;
    -webkit-tap-highlight-color: transparent !important;
    user-select: none;
}

.app-menu-toggle:active {
    opacity: 0.7;
}

.app-logout-link { color: #ef4444 !important; }

@media (max-width: 768px) {
    .app-nav-container { padding: 0 1.5rem; }
    .app-logo { font-size: 1.1rem; }
    .app-menu-toggle { display: flex; }
    .app-nav-list {
        display: none !important;
        position: absolute;
        top: 60px; /* Ajustado a la nueva altura */
        left: 0;
        width: 100%;
        background: #0f172a !important;
        flex-direction: column;
        padding: 0.5rem 0;
        border-bottom: 2px solid var(--primary);
        box-shadow: 0 15px 30px rgba(0,0,0,0.8);
    }
    .app-nav-list.active {
        display: flex !important;
    }
    .app-nav-list a {
        padding: 0.75rem 1.5rem;
        width: 100%;
        border-bottom: 1px solid rgba(255,255,255,0.02);
        font-size: 0.9rem;
    }
    .nav-item-lang {
        padding: 0.75rem 1.5rem;
        width: 100% !important;
        border-bottom: 1px solid rgba(255,255,255,0.02);
        justify-content: flex-start;
    }
    .nav-item-lang .lang-selector-modern {
        flex: 1;
    }
}

/* --- Responsiveness --- */
@media (max-width: 768px) {
    /* Transformar tabla en tarjetas para móviles */
    table, thead, tbody, th, td, tr {
        display: block;
    }
    thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    tr {
        background: rgba(255,255,255,0.02);
        border: 1px solid rgba(255,255,255,0.05);
        border-radius: 1rem;
        margin-bottom: 1.5rem;
        padding: 1rem;
    }
    td {
        border: none !important;
        border-bottom: 1px solid rgba(255,255,255,0.03) !important;
        position: relative;
        padding-left: 50% !important;
        text-align: right !important;
        min-height: 3.5rem;
        display: flex;
        align-items: center;
        justify-content: flex-end;
    }
    td:last-child {
        border-bottom: 0 !important;
        justify-content: center;
        padding-left: 0 !important;
        margin-top: 1rem;
    }
    td:before {
        content: attr(data-label);
        position: absolute;
        left: 1rem;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: bold;
        color: var(--text-muted);
        font-size: 0.75rem;
        text-transform: uppercase;
    }
    .grid-2-col {
        grid-template-columns: 1fr !important;
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    .nav-container {
        padding: 0 1.5rem;
    }
    .mobile-menu-btn {
        display: block;
    }
    .nav-links {
        display: none;
        position: absolute;
        top: 70px;
        left: 0;
        width: 100%;
        background: #0f172a;
        flex-direction: column;
        padding: 1rem 0;
        border-bottom: 2px solid var(--primary);
        box-shadow: 0 20px 40px rgba(0,0,0,0.6);
        z-index: 4999;
    }
    .nav-links.show {
        display: flex;
    }
    .nav-links a {
        padding: 1.2rem 2rem;
        width: 100%;
        border-bottom: 1px solid rgba(255,255,255,0.03);
        font-size: 1.1rem;
    }
    .nav-links a i {
        width: 25px;
    }
}

@media (max-width: 640px) {
    main {
        padding: 0.5rem;
    }
    .container {
        padding: 1rem;
    }
    h1 {
        font-size: 1.3rem;
    }
}

/* Clases de Utilidad Responsivas */
.grid-2-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}
.responsive-card {
    background: rgba(255,255,255,0.02);
    padding: 2rem;
    border-radius: 1.5rem;
    border: 1px solid rgba(255,255,255,0.05);
}
@media (max-width: 768px) {
    .responsive-card {
        padding: 1.25rem;
    }
}

/* --- Sub-navigation (Tabs) --- */
.sub-nav {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2.5rem;
    background: rgba(255, 255, 255, 0.02);
    padding: 0.4rem;
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
    max-width: 100%;
}

@media (max-width: 768px) {
    .sub-nav {
        width: 100%;
        overflow-x: auto;
        justify-content: flex-start;
        padding: 0.6rem;
        -webkit-overflow-scrolling: touch;
        gap: 0.3rem;
        scrollbar-width: none; /* Firefox */
    }
    .sub-nav::-webkit-scrollbar {
        display: none; /* Chrome/Safari */
    }
}

.sub-nav a {
    padding: 0.6rem 1.2rem;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0.7rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    flex-shrink: 0;
}

.sub-nav a:hover {
    color: white;
    background: rgba(255, 255, 255, 0.03);
}

.sub-nav a.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

/* --- Dropdown Sistema --- */
.nav-dropdown {
    position: relative;
    display: flex;
}

.nav-dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    min-width: 160px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    border-radius: 0.8rem;
    border: 1px solid rgba(255,255,255,0.1);
    z-index: 1000;
    overflow: hidden;
    /* Puente invisible para evitar que se cierre al bajar el ratón */
    padding-top: 0;
}

/* Creamos un área de interacción superior invisible para unir el botón con el menú */
.nav-dropdown::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    height: 15px;
    display: none;
}

.nav-dropdown:hover::after {
    display: block;
}

.nav-dropdown:hover .nav-dropdown-content {
    display: block;
}

.nav-dropdown-content a {
    display: block !important;
    width: 100% !important;
    border-radius: 0 !important;
    text-align: left;
    padding: 0.8rem 1.2rem !important;
    box-shadow: none !important;
}

.nav-dropdown-content a:hover {
    background: rgba(99, 102, 241, 0.1) !important;
    color: var(--primary) !important;
}

.nav-dropdown > a {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.25rem !important;
}

.nav-dropdown > a::after {
    content: '\f107';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.7rem;
    line-height: 1;
    transition: transform 0.3s;
    opacity: 0.7;
}

.nav-dropdown:hover > a::after {
    transform: rotate(180deg);
}

@media (max-width: 768px) {
    .sub-nav {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        justify-content: flex-start !important;
        align-items: center !important;
        padding: 0.5rem !important;
    }

    .nav-dropdown {
        flex-shrink: 0 !important;
    }

    .nav-dropdown > a {
        display: inline-block !important;
        padding: 0.6rem 1rem !important;
        margin: 0 0.2rem !important;
        font-size: 0.85rem !important;
        color: white !important;
        font-weight: 600 !important;
        background: rgba(255, 255, 255, 0.05) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        border-radius: 0.7rem !important;
    }
    .nav-dropdown > a::after { display: inline-block !important; }

    .sub-nav .nav-dropdown-content {
        display: none !important; /* En móvil usamos el Bottom Sheet */
    }
}

/* --- Estilos Bottom Sheet Nav --- */
.sheet-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85); /* Un poco más oscuro para que resalte el panel */
    backdrop-filter: blur(8px);
    z-index: 20000; /* Z-index altísimo */
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.sheet-overlay.show {
    display: block;
    opacity: 1;
}

.bottom-sheet-nav {
    position: fixed;
    bottom: -100%;
    left: 0;
    width: 100%;
    background: #111827; /* Fondo muy oscuro pero sólido */
    border-top-left-radius: 2rem;
    border-top-right-radius: 2rem;
    z-index: 20001; /* Siempre por encima del overlay */
    padding: 1rem 1.5rem 3rem;
    transition: bottom 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 -20px 40px rgba(0,0,0,0.8);
    border-top: 1px solid rgba(255,255,255,0.15);
    visibility: hidden; /* Oculto por defecto para no interferir */
}
.bottom-sheet-nav.show {
    bottom: 0;
    visibility: visible;
}

.sheet-header {
    text-align: center;
    margin-bottom: 2rem;
}
.sheet-handle {
    width: 40px;
    height: 5px;
    background: rgba(255,255,255,0.2);
    border-radius: 10px;
    margin: 0 auto 1.5rem;
}
.sheet-header h3 {
    font-size: 1.2rem;
    color: var(--primary);
}

.sheet-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-bottom: 2rem;
}
.sheet-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.2rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 1rem;
    color: white !important;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
}
.sheet-item i {
    width: 30px;
    height: 30px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
}
.sheet-item:active {
    background: rgba(99, 102, 241, 0.1);
    transform: scale(0.98);
}
.sheet-item.active {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

/* --- Tabs Multidioma --- */
.tab-container {
    margin-top: 2rem;
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 1rem;
    overflow: hidden;
}

.tab-header {
    display: flex;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.tab-btn {
    padding: 1rem 1.5rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tab-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.02);
}

.tab-btn.active {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    border-bottom: 2px solid var(--primary);
}

.tab-content {
    display: none;
    padding: 2rem;
}

.tab-content.active {
    display: block;
}


table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1.5rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 1rem;
    overflow: hidden;
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

th {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.badge {
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.btn-delete {
    color: var(--error);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 600;
}

.btn-delete:hover {
    text-decoration: underline;
}

select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    color: white;
    font-size: 1rem;
    appearance: none;
}





/* --- Modales --- */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.modal-backdrop.show {
    display: flex;
    opacity: 1;
}
.modal {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal-backdrop.show .modal {
    transform: scale(1);
}
.modal h3 { margin-bottom: 1rem; color: white; }
.modal p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 2rem; line-height: 1.5; }
.modal-actions { display: flex; gap: 1rem; }
.btn-modal { padding: 0.75rem 1rem; border-radius: 0.75rem; border: none; cursor: pointer; font-weight: 600; flex: 1; transition: all 0.2s; }
.btn-cancel { background: rgba(255, 255, 255, 0.05); color: white; border: 1px solid rgba(255, 255, 255, 0.1); }
.btn-confirm-delete { background: var(--error); color: white; }
.btn-confirm-delete:hover { background: #dc2626; transform: translateY(-2px); }
/* --- Switches Modernos --- */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
    min-width: 50px;
}
.switch input {
    opacity: 0; width: 0; height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(255,255,255,0.15);
    transition: .4s;
    border-radius: 34px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}
input:checked + .slider {
    background-color: var(--primary);
}
input:checked + .slider:before {
    transform: translateX(24px);
}
.btn-confirm-delete:hover { background: #dc2626; transform: translateY(-2px); }

/* --- Marcadores de Mapa Personalizados --- */
.marker-pin-container {
    position: relative;
    width: 40px;
    height: 40px;
}
.marker-pin {
    width: 32px;
    height: 32px;
    border-radius: 50% 50% 50% 0;
    background: var(--primary);
    position: absolute;
    transform: rotate(-45deg);
    left: 50%;
    top: 0;
    margin-left: -16px;
    border: 2px solid white;
    box-shadow: 0 0 10px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 2;
}
.marker-pin i {
    transform: rotate(45deg);
    color: white;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.marker-shadow {
    background: rgba(0,0,0,0.25);
    border-radius: 50%;
    width: 12px;
    height: 4px;
    position: absolute;
    bottom: 2px;
    left: 50%;
    margin-left: -6px;
    filter: blur(1.5px);
    z-index: 1;
}
.marker-pin:hover {
    transform: rotate(-45deg) scale(1.1);
    background: #4f46e5;
}

/* Inhabilitar visualmente el vínculo para marcadores activos */
.marker-active {
    cursor: default !important;
}
.marker-active .marker-pin {
    cursor: default !important;
}
.marker-active .marker-pin:hover {
    transform: rotate(-45deg) scale(1) !important;
}


