/* ==========================================================================
   VARIABLES Y CONFIGURACIÓN BASE (Temas Claro y Oscuro)
   ========================================================================== */
:root {
    /* MODO CLARO (Default) */
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f7;
    --bg-tertiary: #ffffff;
    --text-primary: #1d1d1f;
    --text-secondary: #86868b;
    --accent-color: #0066cc;
    --accent-hover: #004499;
    --border-color: rgba(0, 0, 0, 0.1);
    --card-shadow: 0 4px 12px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.02);
    --modal-bg: rgba(255, 255, 255, 0.85);
    --overlay-bg: rgba(0, 0, 0, 0.4);
    --header-bg: rgba(255, 255, 255, 0.95);
    
    /* Variables de diseño */
    --max-width: 1200px;
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 16px;
    --transition-smooth: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);

    /* Variables Carrusel 3D */
    --carousel-w: min(84vw, 430px);
    --carousel-ratio: 1.45;
}

.dark-mode {
    /* MODO OSCURO */
    --bg-primary: #000000;
    --bg-secondary: #111111;
    --bg-tertiary: #1c1c1e;
    --text-primary: #f5f5f7;
    --text-secondary: #86868b;
    --accent-color: #2997ff;
    --accent-hover: #0071e3;
    --border-color: rgba(255, 255, 255, 0.1);
    --card-shadow: 0 4px 12px rgba(0,0,0,0.2), 0 1px 2px rgba(0,0,0,0.1);
    --modal-bg: rgba(28, 28, 30, 0.85);
    --overlay-bg: rgba(0, 0, 0, 0.7);
    --header-bg: rgba(0, 0, 0, 0.95);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    transition: background-color var(--transition-smooth), color var(--transition-smooth);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* REPRODUCTOR SUPERIOR (INTACTO) */
.top-player-container {
    background-color: #1a1a1a;
    color: #ffffff;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid #333;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

.player-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 12px 20px;
}

.play-btn {
    background: transparent;
    border: 2px solid #f39c12;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    color: #f39c12;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.play-btn:hover {
    background-color: rgba(243, 156, 18, 0.1);
    transform: scale(1.05);
}

.track-info {
    flex-grow: 1;
    margin-left: 20px;
    display: flex;
    flex-direction: column;
}

.live-indicator {
    color: #e74c3c;
    font-size: 0.8rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 6px;
}

.live-indicator .dot {
    width: 8px;
    height: 8px;
    background-color: #e74c3c;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.3; }
    100% { opacity: 1; }
}

.station-name {
    font-size: 1.1rem;
    font-weight: bold;
    margin-top: 2px;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.volume-control input[type="range"] {
    -webkit-appearance: none;
    width: 100px;
    background: transparent;
}

.volume-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 14px;
    width: 14px;
    border-radius: 50%;
    background: #f39c12;
    cursor: pointer;
    margin-top: -5px;
}

.volume-control input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: #555;
    border-radius: 2px;
}

/* ENCABEZADO Y NAVEGACIÓN */
.main-header {
    background-color: var(--header-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 73px;
    z-index: 990;
    transition: background-color var(--transition-smooth), border-color var(--transition-smooth);
}

.header-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-img {
    height: 40px;
    width: auto;
    object-fit: contain;
}

.dark-mode .logo-img {
    filter: brightness(0) invert(1);
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

.icon-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: background-color 0.2s, color 0.2s, box-shadow 0.2s;
}

.icon-btn:hover {
    background-color: rgba(134, 134, 139, 0.1);
}

.theme-btn {
    position: relative;
    overflow: hidden;
}

.theme-btn .moon-icon {
    display: none;
}

.dark-mode .theme-btn .sun-icon {
    display: none;
}

.dark-mode .theme-btn .moon-icon {
    display: block;
    color: #4dabf7;
    text-shadow: 0 0 10px rgba(77, 171, 247, 0.8);
}

.dark-mode .theme-btn {
    box-shadow: inset 0 0 0 1px rgba(77, 171, 247, 0.3), 0 0 15px rgba(77, 171, 247, 0.15);
    background-color: rgba(77, 171, 247, 0.05);
}

.login-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.login-btn:hover {
    border-color: var(--text-primary);
    background-color: var(--text-primary);
    color: var(--bg-primary);
}

/* MENÚ DESPLEGABLE */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    height: 100vh;
    background-color: var(--overlay-bg);
    backdrop-filter: blur(5px);
    z-index: 1001;
    transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    justify-content: flex-end;
}

.mobile-menu-overlay.active {
    right: 0;
}

.menu-content {
    width: 300px;
    max-width: 80%;
    height: 100%;
    background-color: var(--bg-tertiary);
    padding: 40px;
    position: relative;
    box-shadow: -5px 0 25px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.close-btn:hover {
    color: var(--text-primary);
    background-color: rgba(134, 134, 139, 0.1);
}

.nav-links {
    list-style: none;
    margin-top: 40px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 600;
    transition: color 0.2s;
    display: block;
}

.nav-links a:hover,
.nav-links a.activo {
    color: var(--text-primary);
}

/* MODAL */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: var(--overlay-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1002;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-window {
    background-color: var(--modal-bg);
    width: 90%;
    max-width: 400px;
    padding: 40px 30px;
    border-radius: var(--border-radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px var(--border-color);
    position: relative;
    transform: scale(0.95) translateY(20px);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
}

.modal-overlay.active .modal-window {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 25px;
    text-align: center;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.input-group input {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-group input:focus,
.input-group textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.2);
}

.input-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 25px;
}

.input-checkbox label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.submit-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: var(--border-radius-sm);
    background-color: var(--accent-color);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-bottom: 15px;
}

.submit-btn:hover {
    background-color: var(--accent-hover);
}

.forgot-link {
    display: block;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.forgot-link:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

/* CONTENIDO PRINCIPAL */
#app-content {
    min-height: calc(100vh - 250px);
    padding-bottom: 40px;
}

.content-section {
    max-width: var(--max-width);
    margin: 60px auto 20px;
    padding: 0 20px;
}

.section-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 40px;
    text-align: center;
    letter-spacing: -0.02em;
}

.subtitle {
    font-weight: 300;
    color: var(--text-secondary);
}

.animacion-entrada {
    animation: fadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeUp {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Emergencias y Carrusel index */
.grid-emergencias {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
}

.tarjeta {
    background-color: var(--bg-tertiary);
    border-radius: var(--border-radius-lg);
    padding: 40px 30px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.tarjeta:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.1);
}

.dark-mode .tarjeta:hover {
    box-shadow: 0 12px 24px rgba(0,0,0,0.4);
}

.icono-tarjeta {
    font-size: 3rem;
    margin-bottom: 20px;
}

.tarjeta h3 {
    font-size: 1.3rem;
    margin-bottom: 25px;
    font-weight: 600;
}

.btn-llamar {
    display: inline-block;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    text-decoration: none;
    padding: 12px 24px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.95rem;
    width: 100%;
    transition: all 0.2s;
}

.btn-llamar:hover {
    background-color: var(--text-primary);
    color: var(--bg-primary);
}

/* ==========================================================================
   NUESTROS ALIADOS (CARRUSEL 3D CON BOTONES SOCIALES)
   ========================================================================== */
.aliados-section {
    background-color: var(--bg-primary);
    padding: 60px 0 100px;
    border-top: 1px solid var(--border-color);
    overflow: hidden;
}

.aliados-wrap {
    max-width: var(--max-width);
    margin: auto;
    padding: 0 20px;
}

.eyebrow {
    font-size: 11px;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.aliados-title {
    font-size: clamp(32px, 5vw, 48px);
    line-height: .95;
    letter-spacing: -.055em;
    margin: 10px 0 18px;
    color: var(--text-primary);
    font-weight: 700;
}

.intro {
    color: var(--text-secondary);
    max-width: 650px;
    font-size: 18px;
    line-height: 1.5;
    margin-bottom: 25px;
}

.stage {
    height: var(--stage-h, 430px);
    display: grid;
    place-items: center;
    perspective: 1500px;
    overflow: visible;
    transition: height .45s ease;
}

.carousel {
    position: relative;
    width: var(--carousel-w);
    aspect-ratio: var(--carousel-ratio);
    transform-style: preserve-3d;
}

.card {
    position: absolute;
    inset: 0;
    border-radius: 28px;
    transform-style: preserve-3d;
    transform: translate3d(var(--x),var(--y),var(--z)) rotateY(var(--ry)) rotateZ(var(--rz)) scale(var(--scale));
    opacity: var(--opacity);
    z-index: var(--zi);
    transition: transform .75s cubic-bezier(.2,.85,.2,1), opacity .55s ease;
    will-change: transform;
}

.card::before {
    content: "";
    position: absolute;
    inset: -9px;
    border-radius: 36px;
    z-index: -2;
    pointer-events: none;
    background: radial-gradient(ellipse at center, rgba(255,255,255,.20) 0%, rgba(255,255,255,.10) 42%, rgba(255,255,255,0) 72%);
    filter: blur(14px);
    opacity: 0;
    transform: scale(.99);
    transition: opacity .5s ease, transform .7s ease;
}

.card.active::before {
    opacity: .82;
    animation: haloPulse 5.8s ease-in-out infinite;
}

@keyframes haloPulse {
    0%,100% {
        filter: blur(14px);
        opacity: .38;
        transform: scale(.99);
    }
    50% {
        filter: blur(12px);
        opacity: .62;
        transform: scale(1.008);
    }
}

.floatLayer {
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;
}

.card.active .floatLayer.floating {
    animation: realFloating 6.4s ease-in-out infinite;
}

@keyframes realFloating {
    0%,100% {
        transform: translate3d(0,0,0) rotateZ(0deg) rotateY(0deg);
    }
    20% {
        transform: translate3d(7px,-11px,8px) rotateZ(.45deg) rotateY(1.2deg);
    }
    40% {
        transform: translate3d(13px,2px,13px) rotateZ(.7deg) rotateY(2deg);
    }
    60% {
        transform: translate3d(-11px,10px,-7px) rotateZ(-.6deg) rotateY(-1.8deg);
    }
    80% {
        transform: translate3d(-15px,-7px,-10px) rotateZ(-.75deg) rotateY(-1deg);
    }
}

.card.entering .floatLayer {
    animation: entranceBounce .95s cubic-bezier(.16,1.25,.24,1) both;
}

@keyframes entranceBounce {
    0% {
        transform: translate3d(0,145px,-125px) rotateZ(-7deg) scale(.82);
    }
    25% {
        transform: translate3d(8px,-60px,90px) rotateZ(5deg) scale(1.065);
    }
    43% {
        transform: translate3d(-6px,24px,32px) rotateZ(-3deg) scale(.975);
    }
    59% {
        transform: translate3d(3px,-13px,11px) rotateZ(1.6deg) scale(1.025);
    }
    75% {
        transform: translate3d(-2px,6px,3px) rotateZ(-.65deg) scale(.996);
    }
    100% {
        transform: translate3d(0,0,0) rotateZ(0deg) scale(1);
    }
}

.photoWrap {
    position: absolute;
    inset: 0;
    border-radius: 28px;
    overflow: hidden;
    background: #151719;
    border: 1px solid rgba(255,255,255,.16);
    box-shadow: 0 25px 75px rgba(0,0,0,.52), inset 0 0 0 1px rgba(0,0,0,.45);
}

.photo {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    object-position: center;
    background: #151719;
}

.shade {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top,rgba(0,0,0,.9),transparent 62%);
    pointer-events: none;
}

.info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 26px;
    z-index: 3;
    text-align: left;
}

.tag {
    display: inline-block;
    padding: 7px 11px;
    border-radius: 99px;
    border: 1px solid rgba(255,255,255,.25);
    background: rgba(0,0,0,.28);
    backdrop-filter: blur(10px);
    font-size: 10px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #fff;
}

.aliado-title-card {
    font-size: clamp(25px,5vw,38px);
    margin: 11px 0 4px;
    letter-spacing: -.04em;
    color: #fff;
    font-weight: 700;
}

.desc {
    margin: 0;
    color: #c4c7c9;
    font-size: 14px;
}

.social-bar {
    position: absolute;
    left: 50%;
    bottom: -68px;
    transform: translateX(-50%);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 10px;
    z-index: 10;
    pointer-events: none;
    white-space: nowrap;
}

.card.active .social-bar {
    pointer-events: auto;
}

.social-btn {
    width: 48px;
    height: 48px;
    border-radius: 24px;
    background: rgba(20,22,25,.78);
    border: 1px solid rgba(255,255,255,.16);
    box-shadow: 0 0 13px var(--btn-glow), inset 0 0 12px rgba(255,255,255,.04);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #fff;
    overflow: hidden;
    transition: all .35s cubic-bezier(.25,.8,.25,1);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.social-btn:hover,
.social-btn:focus-visible {
    width: 140px;
    background: var(--btn-color);
    border-color: var(--btn-color);
    box-shadow: 0 0 24px var(--btn-glow);
    outline: none;
}

.social-icon {
    width: 48px;
    height: 48px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    color: var(--btn-color);
    filter: drop-shadow(0 0 7px var(--btn-glow));
}

.social-btn:hover .social-icon,
.social-btn:focus-visible .social-icon {
    color: #fff;
}

.social-name {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(-10px);
    transition: all .3s ease;
}

.social-btn:hover .social-name,
.social-btn:focus-visible .social-name {
    opacity: 1;
    transform: translateX(0);
    transition-delay: .1s;
}

.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    position: relative;
    z-index: 30;
}

.controls button {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.controls button:hover {
    background: var(--bg-secondary);
}

.dots {
    display: flex;
    gap: 7px;
}

.dot {
    width: 7px;
    height: 7px;
    padding: 0;
    border: 0;
    background: var(--text-secondary);
    opacity: 0.5;
    transition: all 0.3s;
    border-radius: 50%;
    cursor: pointer;
}

.dot.active {
    width: 23px;
    border-radius: 99px;
    background: var(--text-primary);
    opacity: 1;
}

/* ==========================================================================
   MÓDULO DE NOTICIAS
   ========================================================================== */
/* NOTICIAS (V6.0 Mazo Apilado) */
.grid-noticias {
    position: relative;
    width: 100%;
    max-width: 540px;
    margin: 20px auto 60px;
    min-height: 500px;
    perspective: 1000px;
    touch-action: pan-y;
}

.card-noticia {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-lg);
    padding: 25px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.4s ease, box-shadow 0.4s ease;
    will-change: transform, opacity;
    transform-origin: bottom center;
    opacity: 0;
    pointer-events: none;
    z-index: 1;
    cursor: grab;
}

.card-noticia:active {
    cursor: grabbing;
}

/* Estados del mazo */
.card-noticia.stack-past {
    transform: translateX(-120%) rotate(-8deg);
    opacity: 0;
    pointer-events: none;
}

.card-noticia.stack-front {
    transform: translateX(0) scale(1) translateY(0);
    opacity: 1;
    pointer-events: auto;
    z-index: 10;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

/* CORRECCIÓN V6.0:
   La noticia más reciente tiene .destacada + .stack-front.
   Esta regla garantiza que stack-front siempre quede encima. */
.card-noticia.stack-front.destacada {
    z-index: 10;
}

.card-noticia.stack-next-1 {
    transform: translateX(0) scale(0.95) translateY(20px);
    opacity: 0.8;
    pointer-events: none;
    z-index: 9;
}

.card-noticia.stack-next-2 {
    transform: translateX(0) scale(0.90) translateY(40px);
    opacity: 0.4;
    pointer-events: none;
    z-index: 8;
}

.card-noticia.stack-hidden {
    transform: translateX(0) scale(0.85) translateY(60px);
    opacity: 0;
    pointer-events: none;
    z-index: 7;
}

.card-noticia.is-dragging {
    transition: none !important;
}

/* Carrusel interno (imágenes de la noticia) */
.news-gallery {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 10px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 20px;
    scrollbar-width: none;
}

.news-gallery::-webkit-scrollbar {
    display: none;
}

.news-gallery img {
    flex: 0 0 100%;
    scroll-snap-align: center;
    height: 200px;
    object-fit: cover;
    border-radius: var(--border-radius-sm);
}

.card-noticia h3 {
    font-size: 1.4rem;
    margin-bottom: 5px;
    color: var(--text-primary);
    line-height: 1.3;
}

.news-date {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.news-desc {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 20px;
    flex-grow: 1;
}

/* Redes en Noticia */
.news-social-bar {
    display: flex;
    gap: 10px;
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.news-social-btn {
    width: 36px;
    height: 36px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
}

.news-social-btn:hover {
    transform: translateY(-3px);
}

.news-social-btn svg {
    width: 18px;
    height: 18px;
}

/* Efecto Destacado Rojo para la noticia más reciente */
.card-noticia.destacada {
    z-index: 2;
    border-color: rgba(255, 59, 48, 0.4);
}

.card-noticia.destacada::before {
    content: "";
    position: absolute;
    inset: -9px;
    border-radius: 26px;
    z-index: -2;
    pointer-events: none;
    background: radial-gradient(
        ellipse at center,
        rgba(255,59,48,0.3) 0%,
        rgba(255,59,48,0.1) 45%,
        transparent 70%
    );
    filter: blur(12px);
    animation: pulseRed 3s ease-in-out infinite;
}

@keyframes pulseRed {
    0%,100% {
        opacity: 0.4;
        transform: scale(0.98);
    }
    50% {
        opacity: 1;
        transform: scale(1.015);
    }
}

.badge-nueva {
    position: absolute;
    top: -12px;
    right: 20px;
    background: #FF3B30;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 10px rgba(255,59,48,0.4);
    z-index: 10;
}

.btn-delete-news {
    position: absolute;
    top: -12px;
    left: 20px;
    background: var(--bg-tertiary);
    color: #FF3B30;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: var(--card-shadow);
    z-index: 10;
    transition: all 0.2s;
}

.btn-delete-news:hover {
    background: #FF3B30;
    color: white;
}

/* FOOTER MINIMALISTA */
.main-footer {
    background-color: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
    padding: 40px 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.footer-content p {
    margin-bottom: 10px;
}

/* RESPONSIVE DESIGN */
@media (max-width: 768px) {
    .header-controls {
        gap: 10px;
    }

    .login-btn .login-text {
        display: none;
    }

    .login-btn {
        padding: 8px;
        border-radius: 50%;
        width: 40px;
        height: 40px;
        justify-content: center;
    }

    .section-title {
        font-size: 1.6rem;
    }

    .volume-control {
        display: none;
    }

    .social-bar {
        left: 50%;
        bottom: -64px;
        transform: translateX(-50%);
        gap: 9px;
    }

    .social-btn:hover {
        width: 48px;
    }

    .social-btn:focus-visible {
        width: 48px;
    }

    .social-btn:active {
        transform: scale(.94);
    }
}

@media (max-width: 600px) {
    .stage {
        height: 570px;
    }

    .aliados-wrap {
        padding-top: 20px;
    }

    :root {
        --carousel-w: min(86vw, 400px);
    }
}

/* =====================================================================
   V5.6 RESTAURADA + MEJORAS SEGURAS
   Identidad editable, álbum minimalista y detalles de emergencias.
   ===================================================================== */
.identity-wrap {
    display:flex;
    align-items:center;
    gap:8px;
    min-width:0;
}

.identity-link {
    display:flex;
    align-items:center;
    gap:10px;
    min-width:0;
    text-decoration:none;
    color:var(--text-primary);
}

.identity-image-wrap {
    width:118px;
    height:40px;
    min-height:40px;
    max-height:40px;
    display:flex;
    align-items:center;
    justify-content:flex-start;
    overflow:hidden;
    flex:0 0 auto;
}

.logo-img {
    max-width:118px;
    height:40px;
    width:auto;
    object-fit:contain;
    object-position:left center;
}

.identity-fallback {
    display:inline-flex;
    align-items:center;
    height:32px;
    padding:0 10px;
    border-radius:9px;
    border:1px solid var(--border-color);
    color:var(--text-primary);
    font-size:12px;
    font-weight:800;
    letter-spacing:.12em;
    background:var(--bg-tertiary);
}

.header-name {
    font-size:1rem;
    font-weight:700;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
    max-width:240px;
}

.admin-identity-btn {
    width:32px;
    height:32px;
    font-size:1rem;
}

.modal-subtitle {
    text-align:center;
    color:var(--text-secondary);
    font-size:.85rem;
    line-height:1.45;
    margin:-15px 10px 20px;
}

.identity-modal-window {
    max-width:520px;
    max-height:90vh;
    overflow-y:auto;
}

.identity-preview {
    /* Límite del logo en edición: ancho del área del encabezado y alto de la barra.
       El recuadro se encoge si la imagen es menor, pero nunca crece más allá del límite. */
    display:inline-flex;
    width:fit-content;
    max-width:118px;
    height:fit-content;
    max-height:70px;
    min-width:0;
    min-height:0;
    border:1px solid var(--border-color);
    border-radius:14px;
    background:var(--bg-secondary);
    align-items:center;
    justify-content:center;
    overflow:hidden;
    margin-bottom:22px;
    vertical-align:top;
}

.identity-preview img {
    display:block;
    width:auto;
    height:auto;
    max-width:118px;
    max-height:70px;
    object-fit:contain;
}

.identity-preview span {
    font-size:14px;
    font-weight:800;
    letter-spacing:.14em;
    color:var(--text-secondary);
}

.field-help {
    display:block;
    margin-top:7px;
    color:var(--text-secondary);
    font-size:.76rem;
    line-height:1.35;
}

.identity-options {
    display:grid;
    grid-template-columns:1.2fr .8fr;
    gap:14px;
    align-items:start;
}

.compact-group {
    margin-bottom:20px;
}

.compact-group select {
    width:100%;
    padding:12px 14px;
    border-radius:var(--border-radius-sm);
    border:1px solid var(--border-color);
    background:var(--bg-primary);
    color:var(--text-primary);
    font-size:.95rem;
}

.identity-actions {
    display:flex;
    gap:10px;
}

.identity-actions .submit-btn {
    flex:1;
}

.secondary-submit {
    background:transparent;
    border:1px solid var(--border-color);
    color:var(--text-primary);
}

.secondary-submit:hover {
    background:var(--bg-secondary);
}

/* Álbum minimalista: un solo recuadro protagonista + haz de luz */
.album-section {
    max-width:var(--max-width);
    margin:18px auto 30px;
    padding:28px 20px 46px;
}

.album-section-head {
    display:flex;
    justify-content:space-between;
    align-items:flex-end;
    gap:20px;
    margin-bottom:20px;
    border-bottom:1px solid var(--border-color);
    padding-bottom:15px;
}

.album-section-title {
    margin-bottom:0;
    text-align:left;
}

.admin-section-btn {
    width:auto;
    font-size:13px;
    padding:9px 15px;
    margin:0;
    background:var(--accent-color);
    color:#fff;
    border:none;
    white-space:nowrap;
}

.album-carousel-container {
    position:relative;
    width:100%;
    display:flex;
    align-items:center;
    justify-content:center;
    min-height:350px;
}

.album-track-wrapper {
    width:min(760px,calc(100% - 90px));
    overflow:hidden;
    border-radius:22px;
}

.album-track {
    display:flex;
    width:100%;
    transition:transform .65s cubic-bezier(.2,.8,.2,1);
    will-change:transform;
}

.album-slide {
    flex:0 0 100%;
    padding:3px;
    box-sizing:border-box;
}

.album-card {
    position:relative;
    overflow:hidden;
    min-height:340px;
    border-radius:20px;
    background:var(--bg-tertiary);
    border:1px solid var(--border-color);
    box-shadow:var(--card-shadow);
    isolation:isolate;
}

.album-card::after {
    content:"";
    position:absolute;
    top:-35%;
    left:-45%;
    width:28%;
    height:170%;
    transform:rotate(18deg) translateX(-30%);
    background:linear-gradient(90deg,transparent,rgba(255,255,255,.34),transparent);
    filter:blur(3px);
    opacity:0;
    pointer-events:none;
    z-index:3;
}

.album-slide.active .album-card::after {
    opacity:1;
    animation:albumLightSweep 2.2s ease-in-out .35s 1;
}

@keyframes albumLightSweep {
    from {
        transform:rotate(18deg) translateX(-30%);
    }
    to {
        transform:rotate(18deg) translateX(470%);
    }
}

.album-card img {
    display:block;
    width:100%;
    height:340px;
    object-fit:cover;
    background:var(--bg-secondary);
}

.album-info {
    position:absolute;
    left:0;
    right:0;
    bottom:0;
    padding:28px 26px 24px;
    background:linear-gradient(to top,rgba(0,0,0,.84),rgba(0,0,0,.12),transparent);
    color:#fff;
    z-index:2;
}

.album-date {
    display:inline-block;
    font-size:10px;
    letter-spacing:.14em;
    text-transform:uppercase;
    opacity:.8;
    margin-bottom:8px;
}

.album-info h3 {
    margin:0 0 5px;
    font-size:clamp(21px,3vw,30px);
}

.album-info p {
    margin:0;
    color:rgba(255,255,255,.78);
    font-size:14px;
    line-height:1.45;
}

.album-nav {
    width:42px;
    height:42px;
    border-radius:50%;
    border:1px solid var(--border-color);
    background:var(--bg-tertiary);
    color:var(--text-primary);
    display:flex;
    align-items:center;
    justify-content:center;
    cursor:pointer;
    box-shadow:var(--card-shadow);
    z-index:4;
    transition:transform .2s,background .2s;
}

.album-nav:hover {
    transform:scale(1.06);
    background:var(--bg-secondary);
}

.album-prev {
    margin-right:12px;
}

.album-next {
    margin-left:12px;
}

.album-dots {
    display:flex;
    justify-content:center;
    gap:7px;
    margin-top:15px;
}

.album-dots .dot {
    flex:0 0 auto;
}

.album-hint {
    text-align:center;
    color:var(--text-secondary);
    font-size:11px;
    margin:11px 0 0;
    letter-spacing:.03em;
}

/* Información adicional de emergencias */
.tarjeta {
    min-height:310px;
}

.phone-card-header {
    width:100%;
    display:flex;
    flex-direction:column;
    align-items:center;
}

.phone-img-wrap {
    width:78px;
    height:64px;
    display:flex;
    align-items:center;
    justify-content:center;
    margin-bottom:20px;
}

.phone-img-wrap img {
    max-width:100%;
    max-height:100%;
    object-fit:contain;
    border-radius:12px;
}

.phone-info-box {
    width:100%;
    margin-top:20px;
    padding-top:16px;
    border-top:1px solid var(--border-color);
    text-align:left;
}

.phone-info-list {
    margin:0;
    padding-left:20px;
    color:var(--text-secondary);
    font-size:.88rem;
    line-height:1.5;
}

.phone-info-list li {
    margin-bottom:6px;
}

.info-alert li::marker {
    color:#ff3b30;
}

.btn-show-more {
    display:block;
    margin:10px auto 0;
    border:0;
    background:transparent;
    color:var(--text-secondary);
    font-size:.8rem;
    cursor:pointer;
    padding:5px 8px;
}

.btn-show-more:hover {
    color:var(--text-primary);
}

.botones-multiples {
    width:100%;
    display:flex;
    flex-direction:column;
    gap:10px;
}

@media (max-width:768px) {
    .identity-image-wrap {
        width:88px;
    }

    .logo-img {
        max-width:88px;
    }

    .header-name {
        max-width:140px;
        font-size:.9rem;
    }

    .identity-options {
        grid-template-columns:1fr;
        gap:0;
    }

    .identity-actions {
        flex-direction:column;
    }

    .album-section {
        padding-left:14px;
        padding-right:14px;
    }

    .album-section-head {
        align-items:flex-start;
    }

    .album-track-wrapper {
        width:calc(100% - 68px);
    }

    .album-card,
    .album-card img {
        min-height:270px;
        height:270px;
    }

    .album-info {
        padding:22px 18px 18px;
    }

    .album-prev {
        margin-right:7px;
    }

    .album-next {
        margin-left:7px;
    }
}

@media (max-width:520px) {
    .identity-link {
        gap:7px;
    }

    .identity-image-wrap {
        width:72px;
        height:36px;
        min-height:36px;
        max-height:36px;
    }

    .logo-img {
        max-width:72px;
        height:36px;
    }

    .identity-fallback {
        font-size:10px;
        padding:0 7px;
    }

    .header-name {
        max-width:110px;
        font-size:.82rem;
    }

    .admin-identity-btn {
        display:none;
    }

    .album-section-head {
        flex-direction:column;
        align-items:stretch;
    }

    .admin-section-btn {
        align-self:flex-end;
    }

    .album-track-wrapper {
        width:calc(100% - 56px);
    }

    .album-card,
    .album-card img {
        min-height:230px;
        height:230px;
    }

    .album-info h3 {
        font-size:20px;
    }

    .album-info p {
        font-size:12px;
    }
}

/* BANNERS PUBLICITARIOS EDITABLES - V5.6 */
.banner-section-head {
    position:relative;
    display:flex;
    justify-content:center;
    align-items:center;
    gap:16px;
    margin-bottom:22px;
    max-width:var(--max-width);
    margin-left:auto;
    margin-right:auto;
    padding:0 20px;
}

.banner-section-head .section-title {
    margin-bottom:0;
}

.banner-section-head .admin-section-btn {
    position:absolute;
    right:20px;
}

/* El bloque publicitario ocupa todo el ancho disponible de la ventana. */
#publicidad-section {
    max-width:none;
    padding-left:0;
    padding-right:0;
}

.banners {
    width:100%;
    display:flex;
    flex-direction:column;
    align-items:stretch;
}

.banner-slider {
    width:100%;
    max-width:none;
    overflow:hidden;
    border-radius:0;
}

.banner-track {
    display:flex;
    width:100%;
    transition:transform .7s cubic-bezier(.2,.8,.2,1);
    will-change:transform;
}

.banner-slide {
    flex:0 0 100%;
    padding:0;
    box-sizing:border-box;
}

.banner-card {
    position:relative;
    overflow:hidden;
    width:100%;
    aspect-ratio:3.5 / 1;
    height:auto;
    min-height:0;
    max-height:none;
    border-radius:0;
    background:var(--bg-tertiary);
    border-top:1px solid var(--border-color);
    border-bottom:1px solid var(--border-color);
    box-shadow:none;
    isolation:isolate;
}

.banner-card img {
    display:block;
    width:100%;
    height:100%;
    object-fit:contain;
    object-position:center;
}

.banner-light {
    position:absolute;
    inset:-45% auto -45% -30%;
    width:16%;
    transform:rotate(18deg) translateX(-80%);
    background:linear-gradient(90deg,transparent,rgba(255,255,255,.3),transparent);
    filter:blur(3px);
    opacity:0;
    pointer-events:none;
    z-index:2;
}

.banner-slide.active .banner-light {
    opacity:1;
    animation:bannerLightSweep 2.3s ease-in-out .25s 1;
}

@keyframes bannerLightSweep {
    from {
        transform:rotate(18deg) translateX(-80%);
    }
    to {
        transform:rotate(18deg) translateX(900%);
    }
}

.banner-slide.banner-error .banner-card {
    display:none;
}

.banner-controls {
    display:flex;
    justify-content:center;
    align-items:center;
    gap:7px;
    min-height:22px;
    margin-top:12px;
}

.banner-dot {
    width:7px;
    height:7px;
    padding:0;
    border:0;
    border-radius:50%;
    background:var(--text-secondary);
    opacity:.35;
    cursor:pointer;
    transition:transform .2s,opacity .2s;
}

.banner-dot.active {
    opacity:1;
    transform:scale(1.35);
    background:var(--accent-color);
}

.banner-hint {
    margin:3px 0 0;
    color:var(--text-secondary);
    font-size:11px;
    letter-spacing:.03em;
    text-align:center;
}

.banner-empty {
    width:100%;
    min-height:150px;
    display:flex;
    align-items:center;
    justify-content:center;
    border:1px dashed var(--border-color);
    border-radius:16px;
    color:var(--text-secondary);
}

.banner-admin-list {
    margin-bottom:20px;
    max-height:310px;
    overflow-y:auto;
    padding-right:4px;
}

.admin-banner-item {
    display:grid;
    grid-template-columns:92px 1fr auto;
    gap:12px;
    align-items:center;
    padding:10px;
    margin-bottom:10px;
    border:1px solid var(--border-color);
    border-radius:12px;
    background:var(--bg-secondary);
}

.admin-banner-item img {
    width:92px;
    height:46px;
    object-fit:cover;
    border-radius:8px;
    background:var(--bg-primary);
}

.admin-banner-info {
    min-width:0;
    display:flex;
    flex-direction:column;
    gap:3px;
}

.admin-banner-info strong {
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.admin-banner-info span {
    color:var(--text-secondary);
    font-size:.76rem;
}

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

.admin-banner-actions button {
    width:30px;
    height:30px;
    border-radius:8px;
    border:1px solid var(--border-color);
    background:var(--bg-tertiary);
    color:var(--text-primary);
    cursor:pointer;
}

.admin-banner-actions button:disabled {
    opacity:.25;
    cursor:not-allowed;
}

.banner-admin-form {
    border-top:1px solid var(--border-color);
    padding-top:20px;
}

.banner-admin-form h3 {
    margin-bottom:15px;
    font-size:1.1rem;
}

@media (max-width:768px) {
    .banner-section-head {
        justify-content:space-between;
    }

    .banner-section-head .admin-section-btn {
        position:static;
        margin-left:0;
        flex-shrink:0;
    }

    .banner-card {
        border-radius:13px;
    }

    .banner-slider {
        border-radius:13px;
    }
}

@media (max-width:520px) {
    .banner-section-head {
        align-items:center;
        gap:10px;
    }

    .banner-section-head .section-title {
        font-size:1.35rem;
    }

    .banner-section-head .admin-section-btn {
        font-size:11px;
        padding:7px 10px;
    }

    .admin-banner-item {
        grid-template-columns:68px 1fr;
    }

    .admin-banner-item img {
        width:68px;
        height:38px;
    }

    .admin-banner-actions {
        grid-column:1 / -1;
        justify-content:flex-end;
    }
}

/* BANNERS FULL WIDTH - ajuste responsive */
@media (max-width:520px) {
    #publicidad-section {
        padding-left:0;
        padding-right:0;
    }

    .banner-section-head {
        padding:0 16px;
    }

    .banner-section-head .admin-section-btn {
        right:16px;
    }

}

/* V5.7 - Página Instala Orienta Radio: estilos aislados */
.install-card {
    overflow: hidden;
}

.install-card strong {
    color: var(--text-primary);
}

#install-popup.active {
    display: flex;
}

#install-popup {
    display: none;
}

#install-popup .modal-window {
    animation: installPopupIn .28s ease;
}

@keyframes installPopupIn {
    from {
        opacity:0;
        transform:translateY(12px) scale(.98);
    }
    to {
        opacity:1;
        transform:translateY(0) scale(1);
    }
}

@media (max-width: 600px) {
    .install-card {
        padding: 22px 16px !important;
    }

    .install-steps {
        grid-template-columns: 1fr !important;
    }
}

/* =====================================================================
   V5.9 - Vista expandida de Aliados: interacción de presión prolongada
   ===================================================================== */
.ally-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    padding: clamp(16px, 4vw, 42px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .22s ease, visibility 0s linear .22s;
}

.ally-lightbox.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity .22s ease;
}

.ally-lightbox-backdrop {
    position:absolute;
    inset:0;
    background:rgba(5,7,9,.72);
    backdrop-filter:blur(14px) saturate(.8);
    -webkit-backdrop-filter:blur(14px) saturate(.8);
}

.ally-lightbox-card {
    position:relative;
    width:min(92vw, 980px);
    max-height:88vh;
    overflow:hidden;
    border-radius:30px;
    background:var(--bg-secondary,#151719);
    border:1px solid rgba(255,255,255,.18);
    box-shadow:0 35px 110px rgba(0,0,0,.65), 0 0 45px rgba(255,255,255,.08);
    transform:translateY(28px) scale(.84);
    opacity:.25;
    transition:transform .62s cubic-bezier(.22,1.35,.28,1), opacity .32s ease;
    display:grid;
    grid-template-columns:minmax(0,1.35fr) minmax(280px,.65fr);
}

.ally-lightbox.is-open .ally-lightbox-card {
    transform:translateY(0) scale(1);
    opacity:1;
}

.ally-lightbox-image {
    width:100%;
    height:100%;
    min-height:460px;
    max-height:88vh;
    object-fit:contain;
    background:#0d0f10;
    display:block;
}

.ally-lightbox-info {
    align-self:end;
    padding:32px;
    background:linear-gradient(180deg,rgba(18,20,22,.35),rgba(18,20,22,.96));
}

.ally-lightbox-tag {
    display:inline-block;
    padding:7px 11px;
    border-radius:99px;
    border:1px solid rgba(255,255,255,.18);
    background:rgba(255,255,255,.06);
    color:#fff;
    font-size:10px;
    letter-spacing:.12em;
    text-transform:uppercase;
}

.ally-lightbox-title {
    margin:12px 0 6px;
    color:#fff;
    font-size:clamp(26px,4vw,42px);
    letter-spacing:-.04em;
}

.ally-lightbox-desc {
    margin:0 0 20px;
    color:#c4c7c9;
    line-height:1.55;
}

.ally-lightbox-socials {
    display:flex;
    flex-wrap:wrap;
    gap:10px;
}

.ally-lightbox-socials .social-btn {
    pointer-events:auto;
}

.ally-lightbox-close {
    position:absolute;
    top:14px;
    right:14px;
    z-index:5;
    width:42px;
    height:42px;
    border-radius:50%;
    border:1px solid rgba(255,255,255,.18);
    background:rgba(15,17,19,.72);
    color:#fff;
    font-size:27px;
    line-height:1;
    cursor:pointer;
    backdrop-filter:blur(12px);
    transition:transform .25s ease, background .25s ease;
}

.ally-lightbox-close:hover {
    transform:scale(1.08);
    background:rgba(255,255,255,.12);
}

.alias-card.is-pressing {
    z-index:100;
}

.alias-card.is-pressing .floatLayer {
    transform:scale(1.055) translateY(-7px);
    filter:brightness(1.08);
    transition:transform .45s cubic-bezier(.22,1.35,.28,1), filter .3s ease;
}

@media (max-width:700px) {
    .ally-lightbox {
        padding:12px;
    }

    .ally-lightbox-card {
        width:96vw;
        max-height:92vh;
        grid-template-columns:1fr;
        grid-template-rows:minmax(0,1fr) auto;
        border-radius:24px;
    }

    .ally-lightbox-image {
        min-height:45vh;
        max-height:62vh;
    }

    .ally-lightbox-info {
        padding:20px;
    }

    .ally-lightbox-title {
        font-size:28px;
    }
}

@media (prefers-reduced-motion:reduce) {
    .ally-lightbox-card,
    .ally-lightbox,
    .ally-lightbox-close,
    .alias-card.is-pressing .floatLayer {
        transition:none !important;
    }
}
/* V6.0 PANEL / ADMIN UX */
.allies-section-head{display:flex;align-items:center;justify-content:space-between;gap:16px;}
.allies-section-head .aliados-title{margin-bottom:0;}
.news-admin-actions{position:absolute;top:-12px;left:20px;display:flex;gap:6px;z-index:20;}
.news-admin-actions button{width:38px;height:38px;border-radius:12px;border:1px solid var(--border-color);background:var(--bg-tertiary);box-shadow:var(--card-shadow);cursor:pointer;font-size:1rem;transition:.2s;}
.news-admin-actions .btn-edit-news{color:var(--accent-color);}
.news-admin-actions .btn-delete-news{position:static;padding:0;color:#FF3B30;font-size:1rem;font-weight:400;}
.news-admin-actions button:hover{transform:translateY(-2px);}
.news-admin-actions .btn-edit-news:hover{background:var(--accent-color);color:#fff;}
.news-admin-actions .btn-delete-news:hover{background:#FF3B30;color:#fff;}
.identity-image-wrap{border-radius:11px;box-shadow:0 5px 14px rgba(0,0,0,.16);border:1px solid rgba(0,0,0,.08);background:var(--bg-tertiary);}
.dark-mode .identity-image-wrap{box-shadow:0 5px 16px rgba(255,255,255,.14);border-color:rgba(255,255,255,.14);}
.logo-img{filter:drop-shadow(0 2px 2px rgba(0,0,0,.08));}
.dark-mode .logo-img{filter:drop-shadow(0 2px 3px rgba(255,255,255,.12));}
.noticias-aliados-section{margin-top:10px;}

@media(max-width:600px){
  .allies-section-head{align-items:flex-start;}
  .allies-section-head .admin-section-btn{font-size:12px;padding:8px 11px;white-space:nowrap;}
  .news-admin-actions{left:14px;top:-10px;}
  .news-admin-actions button{width:34px;height:34px;}
}

/* Formularios largos: el botón guardar permanece accesible en móvil. */
.banner-admin-form > div:last-child{position:sticky;bottom:-1px;padding:12px 0 2px;background:color-mix(in srgb,var(--bg-primary) 92%,transparent);backdrop-filter:blur(8px);z-index:5;}
@supports not (background:color-mix(in srgb,black,white)){.banner-admin-form > div:last-child{background:var(--bg-primary);}}
.identity-modal-window .identity-actions{position:sticky;bottom:0;padding-top:10px;background:var(--bg-primary);z-index:4;}
#phones-admin-modal .modal-window,#album-admin-modal .modal-window,#banner-admin-modal .modal-window{overscroll-behavior:contain;-webkit-overflow-scrolling:touch;}
@media(max-width:600px){
  #banner-admin-modal .modal-window,#phones-admin-modal .modal-window,#album-admin-modal .modal-window{max-height:calc(100dvh - 24px)!important;height:auto;overflow-y:auto;padding-bottom:calc(18px + env(safe-area-inset-bottom));}
  #banner-admin-modal .modal-window{margin-bottom:12px;}
  .banner-admin-form > div:last-child{padding-bottom:calc(8px + env(safe-area-inset-bottom));}
}


/* V8.0: los controles administrativos solo se muestran en modo edición.
   En móvil no se elimina el botón de identidad; JS controla su visibilidad. */
.admin-edit-mode .admin-section-btn,
.admin-edit-mode .admin-identity-btn,
.admin-edit-mode .cms-edit-button,
.admin-edit-mode #btn-add-news{display:inline-flex !important;visibility:visible !important;opacity:1 !important;}
.admin-edit-mode .admin-identity-btn{align-items:center;justify-content:center;flex:0 0 auto;}
.admin-edit-mode .cms-editable{position:relative;}

/* ================= V8.0 EDITOR VISUAL INTEGRADO ================= */
.cms-editor-toolbar{position:fixed;top:14px;left:50%;transform:translateX(-50%);z-index:3000;display:none;align-items:center;gap:8px;padding:9px 12px;border:1px solid rgba(0,102,204,.18);border-radius:16px;background:var(--modal-bg);backdrop-filter:blur(18px);-webkit-backdrop-filter:blur(18px);box-shadow:0 12px 35px rgba(0,0,0,.16);max-width:calc(100vw - 20px)}
.cms-editor-toolbar.active{display:flex}
.cms-editor-toolbar .cms-editor-badge{font-size:.78rem;font-weight:800;color:var(--accent-color);white-space:nowrap}
.cms-editor-toolbar .cms-editor-status{font-size:.72rem;color:var(--text-secondary);white-space:nowrap;max-width:180px;overflow:hidden;text-overflow:ellipsis}
.cms-editor-toolbar button{border:1px solid var(--border-color);background:var(--bg-primary);color:var(--text-primary);border-radius:11px;padding:8px 10px;font:inherit;font-size:.75rem;font-weight:700;cursor:pointer;white-space:nowrap}
.cms-editor-toolbar .cms-editor-save{background:var(--accent-color);color:#fff;border-color:transparent}
.cms-editor-toolbar .cms-editor-exit{color:#d92d20}
.admin-edit-mode .cms-editable{outline:1px dashed transparent;outline-offset:4px;transition:outline-color .15s,background .15s;cursor:text}
.admin-edit-mode .cms-editable:hover{outline-color:rgba(0,102,204,.28);background:rgba(0,102,204,.025)}
.admin-edit-mode .cms-editable:focus{outline:2px solid rgba(0,102,204,.45);background:rgba(0,102,204,.035)}
.cms-edit-button{border:1px solid rgba(0,102,204,.18)!important;background:var(--bg-primary)!important;color:var(--accent-color)!important;border-radius:999px!important;padding:7px 11px!important;font-size:.76rem!important;font-weight:800!important;cursor:pointer!important;box-shadow:0 4px 14px rgba(0,0,0,.08)!important;white-space:nowrap!important}
.cms-edit-button:hover{transform:translateY(-1px)}
.cms-footer-edit{position:absolute;right:18px;top:10px}
.main-footer{position:relative}
.cms-install-edit{position:absolute;right:18px;top:18px;z-index:5}
#cms-group-modal .modal-window{max-height:calc(100dvh - 24px);overflow-y:auto}
#cms-group-modal textarea{min-height:58px;resize:vertical}
.dark-mode .cms-editor-toolbar{box-shadow:0 14px 34px rgba(0,0,0,.48);border-color:rgba(41,151,255,.25)}
.dark-mode .admin-edit-mode .cms-editable:hover{outline-color:rgba(41,151,255,.5);background:rgba(41,151,255,.07)}
@media(max-width:700px){
 .cms-editor-toolbar{top:8px;left:8px;right:8px;transform:none;max-width:none;justify-content:center;flex-wrap:wrap;padding:7px;gap:5px;border-radius:14px}
 .cms-editor-toolbar .cms-editor-status{display:none}
 .cms-editor-toolbar button{padding:7px 8px;font-size:.69rem}
 .cms-editor-toolbar .cms-editor-badge{font-size:.7rem}
 .cms-footer-edit{right:10px;top:8px}
 .cms-install-edit{right:10px;top:10px}
}

/* V8.0 editor visual: modales y avisos */
.cms-toast{position:fixed;left:50%;bottom:24px;transform:translate(-50%,16px);opacity:0;pointer-events:none;z-index:5000;padding:11px 16px;border-radius:13px;background:var(--text-primary);color:var(--bg-primary);font-size:.86rem;font-weight:700;box-shadow:0 12px 30px rgba(0,0,0,.22);transition:opacity .2s,transform .2s;max-width:min(92vw,520px);text-align:center;}
.cms-toast.show{opacity:1;transform:translate(-50%,0);}
.cms-toast.is-error{background:#d92d20;color:#fff;}
.allies-admin-window{max-width:720px;max-height:calc(100dvh - 24px);overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;padding-bottom:calc(18px + env(safe-area-inset-bottom));}
.allies-admin-list{display:grid;gap:10px;margin:4px 0 20px;}
.admin-ally-item{display:grid;grid-template-columns:76px 1fr auto;gap:12px;align-items:center;padding:12px;border:1px solid var(--border-color);border-radius:16px;background:var(--bg-secondary);}
.admin-ally-item img{width:76px;height:58px;object-fit:cover;border-radius:11px;background:var(--bg-tertiary);}
.admin-ally-info{min-width:0;display:grid;gap:3px;}
.admin-ally-info strong,.admin-ally-info span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.admin-ally-info span,.admin-ally-info small{color:var(--text-secondary);font-size:.82rem;}
.admin-ally-actions{display:flex;gap:6px;}
.admin-ally-actions button{width:40px;height:40px;border-radius:12px;border:1px solid var(--border-color);background:var(--bg-primary);cursor:pointer;font-size:1rem;}
.admin-ally-actions .btn-ally-edit{color:var(--accent-color);}
.admin-ally-actions .btn-ally-del{color:#ff3b30;}
.allies-admin-form-wrap{border-top:1px solid var(--border-color);padding-top:18px;}
.ally-social-fields{display:grid;gap:9px;margin:8px 0 14px;}
.ally-social-row{display:grid;grid-template-columns:auto 1fr;gap:8px;align-items:center;padding:10px 12px;border:1px solid var(--border-color);border-radius:13px;background:var(--bg-secondary);font-weight:700;}
.ally-social-row input[type="url"]{grid-column:2;min-width:0;width:100%;padding:9px 11px;border:1px solid var(--border-color);border-radius:10px;background:var(--bg-primary);color:var(--text-primary);}
@media(max-width:600px){
 .admin-ally-item{grid-template-columns:62px 1fr auto;gap:9px;padding:10px;}
 .admin-ally-item img{width:62px;height:50px;}
 .admin-ally-actions button{width:36px;height:36px;}
 .cms-toast{bottom:calc(18px + env(safe-area-inset-bottom));}
}

/* V8.1 - Visor de noticias en modo normal */
.news-viewer-window {
    width: min(92vw, 850px);
    max-width: 850px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 30px;
}

.news-viewer-content {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.news-viewer-gallery {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    border-radius: var(--border-radius-sm);
}

.news-viewer-gallery::-webkit-scrollbar { display: none; }

.news-viewer-gallery img {
    flex: 0 0 100%;
    width: 100%;
    max-height: 52vh;
    object-fit: contain;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-sm);
    scroll-snap-align: center;
}

.news-viewer-meta {
    color: var(--text-secondary);
    font-size: .95rem;
}

.news-viewer-content h2 {
    margin: 0;
    color: var(--text-primary);
    font-size: clamp(1.5rem, 4vw, 2.2rem);
    line-height: 1.2;
}

.news-viewer-body {
    color: var(--text-primary);
    font-size: 1.05rem;
    line-height: 1.75;
    white-space: normal;
}

.news-viewer-socials {
    display: flex;
    gap: 10px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.card-noticia[role="button"] { cursor: pointer; }

@media (max-width: 600px) {
    .news-viewer-window {
        width: calc(100vw - 24px);
        max-height: 88vh;
        padding: 22px 18px;
        border-radius: var(--border-radius-lg);
    }
    .news-viewer-gallery img { max-height: 42vh; }
    .news-viewer-body { font-size: 1rem; }
}

/* V8.1 - Fuente de imagen para Noticias: controles táctiles y vista previa */
.news-image-source-options{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:8px;}
.news-image-option{display:flex;align-items:center;justify-content:center;gap:9px;min-height:52px;padding:10px 12px;border:1px solid var(--border-color);border-radius:14px;background:var(--bg-secondary);color:var(--text-primary);font-weight:700;cursor:pointer;touch-action:manipulation;}
.news-image-option:has(input:checked){border-color:var(--accent-color);box-shadow:0 0 0 2px color-mix(in srgb,var(--accent-color) 18%,transparent);background:color-mix(in srgb,var(--accent-color) 7%,var(--bg-secondary));}
.news-image-option input{width:20px;height:20px;min-width:20px;accent-color:var(--accent-color);}
.news-image-panel{margin-top:10px;}
.news-image-panel input[type=file]{display:block;width:100%;min-height:48px;padding:11px;border:1px solid var(--border-color);border-radius:12px;background:var(--bg-primary);color:var(--text-primary);cursor:pointer;}
.news-image-preview{margin-top:12px;min-height:90px;padding:10px;border:1px dashed var(--border-color);border-radius:14px;background:var(--bg-secondary);display:flex;align-items:center;justify-content:center;color:var(--text-secondary);text-align:center;overflow:hidden;}
.news-image-preview img{display:block;max-width:100%;max-height:240px;width:auto;height:auto;object-fit:contain;border-radius:10px;}
@media(max-width:600px){.news-image-source-options{grid-template-columns:1fr;}.news-image-option{min-height:56px;justify-content:flex-start;padding-left:16px;}.news-image-option input{width:22px;height:22px;min-width:22px;}}

/* V8.1 AJUSTE FINAL - LOGO RESPONSIVE Y FOTOS DE EMERGENCIAS
   El área de identidad funciona como un límite máximo, no como una caja fija.
   La imagen conserva su proporción y se adapta dentro de ese límite. */
.identity-image-wrap {
    width: fit-content;
    max-width: 118px;
    height: fit-content;
    max-height: 70px;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    flex: 0 1 auto;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.identity-image-wrap .logo-img {
    display: block;
    width: auto;
    height: auto;
    max-width: 118px;
    max-height: 70px;
    object-fit: contain;
    object-position: left center;
    flex: 0 1 auto;
}

/* La vista previa del editor usa exactamente el mismo concepto de límite. */
.identity-preview {
    display: inline-flex;
    width: fit-content;
    height: fit-content;
    max-width: 118px;
    max-height: 70px;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.identity-preview img {
    display: block;
    width: auto;
    height: auto;
    max-width: 118px;
    max-height: 70px;
    object-fit: contain;
}

/* Emergencias: la imagen aprovecha el ancho de la tarjeta sin deformarse. */
.phone-img-wrap {
    width: min(100%, 100%);
    max-width: 100%;
    height: fit-content;
    max-height: 240px;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    overflow: hidden;
    border-radius: 16px;
}

.phone-img-wrap img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 240px;
    object-fit: contain;
    border-radius: 16px;
}

/* Haz de luz sutil para ambas variantes de tema. */
.identity-image-wrap::after,
.phone-img-wrap::after {
    content: "";
    position: absolute;
    pointer-events: none;
    width: 45%;
    height: 180%;
    top: -40%;
    left: -70%;
    transform: rotate(18deg);
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.32), transparent);
    animation: imageLightSweep 5.5s ease-in-out infinite;
    opacity: .55;
}

.identity-image-wrap,
.phone-img-wrap {
    position: relative;
}

.dark-mode .identity-image-wrap::after,
.dark-mode .phone-img-wrap::after {
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.18), transparent);
    opacity: .42;
}

@keyframes imageLightSweep {
    0%, 55% { left: -70%; }
    100% { left: 130%; }
}

@media (max-width: 768px) {
    .identity-image-wrap {
        max-width: 88px;
        max-height: 60px;
    }
    .identity-image-wrap .logo-img {
        max-width: 88px;
        max-height: 60px;
    }
    .phone-img-wrap {
        max-height: 220px;
    }
    .phone-img-wrap img {
        max-height: 220px;
    }
}

@media (max-width: 520px) {
    .identity-image-wrap {
        max-width: 72px;
        max-height: 50px;
    }
    .identity-image-wrap .logo-img {
        max-width: 72px;
        max-height: 50px;
    }
    .phone-img-wrap {
        max-height: 200px;
    }
    .phone-img-wrap img {
        max-height: 200px;
    }
}


/* V8.1.2 - Administrador del Álbum: lista y acciones en móvil/PC */
.album-admin-list{display:grid;gap:10px;margin:4px 0 20px;max-height:310px;overflow-y:auto;padding:2px 4px 2px 0;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;}
.admin-album-item{display:grid;grid-template-columns:92px minmax(0,1fr) auto;gap:12px;align-items:center;padding:10px;border:1px solid var(--border-color);border-radius:12px;background:var(--bg-secondary);}
.admin-album-item img{width:92px;height:58px;object-fit:cover;border-radius:8px;background:var(--bg-primary);display:block;}
.admin-album-item-info{min-width:0;display:flex;flex-direction:column;gap:3px;}
.admin-album-item-info strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.admin-album-item-info span{color:var(--text-secondary);font-size:.76rem;}
.admin-album-actions{display:flex;gap:5px;align-items:center;justify-content:flex-end;}
.admin-album-actions button{min-width:32px;height:32px;padding:0 8px;border-radius:8px;border:1px solid var(--border-color);background:var(--bg-tertiary);color:var(--text-primary);cursor:pointer;font-size:.82rem;}
.admin-album-actions button:disabled{opacity:.25;cursor:not-allowed;}
.admin-album-actions .btn-album-edit{color:var(--accent-color);}
.admin-album-actions .btn-album-del{color:#ff3b30;}
.album-image-preview{margin:10px 0 16px;min-height:150px;border:1px dashed var(--border-color);border-radius:14px;background:var(--bg-secondary);display:flex;align-items:center;justify-content:center;overflow:hidden;color:var(--text-secondary);font-size:.86rem;text-align:center;padding:8px;}
.album-image-preview img{display:block;width:100%;max-height:260px;object-fit:contain;border-radius:10px;}
@media(max-width:600px){
 .admin-album-item{grid-template-columns:62px minmax(0,1fr);gap:9px;padding:10px;}
 .admin-album-item img{width:62px;height:50px;}
 .admin-album-actions{grid-column:1 / -1;justify-content:flex-end;flex-wrap:wrap;}
 .admin-album-actions button{min-width:36px;height:36px;}
 .album-admin-list{max-height:270px;}
}

/* =====================================================================
   V8.1.3 - Visor limpio de fotografías del Álbum
   ===================================================================== */
.album-card[role="button"] {
    cursor: zoom-in;
}

.album-card[role="button"]:focus-visible {
    outline:3px solid var(--accent-color);
    outline-offset:4px;
}

.album-lightbox {
    position:fixed;
    inset:0;
    z-index:10050;
    display:grid;
    place-items:center;
    box-sizing:border-box;
    width:100vw;
    height:100vh;
    height:100dvh;
    padding:max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    opacity:0;
    visibility:hidden;
    pointer-events:none;
    transition:opacity .2s ease, visibility 0s linear .2s;
}

.album-lightbox.is-open {
    opacity:1;
    visibility:visible;
    pointer-events:auto;
    transition:opacity .2s ease;
}

.album-lightbox-backdrop {
    position:absolute;
    inset:0;
    background:rgba(7,9,11,.78);
    backdrop-filter:blur(12px) saturate(.75);
    -webkit-backdrop-filter:blur(12px) saturate(.75);
}

.album-lightbox-card {
    position:relative;
    z-index:1;
    display:flex;
    align-items:center;
    justify-content:center;
    width:min(94vw, 1180px);
    height:min(92dvh, 900px);
    max-width:calc(100vw - 24px);
    max-height:calc(100dvh - 24px);
    box-sizing:border-box;
    padding:8px;
    border-radius:24px;
    background:rgba(18,20,22,.86);
    border:1px solid rgba(255,255,255,.16);
    box-shadow:0 28px 90px rgba(0,0,0,.6);
    transform:translateY(14px) scale(.97);
    opacity:.3;
    transition:transform .24s ease, opacity .2s ease;
    overflow:hidden;
}

.album-lightbox.is-open .album-lightbox-card {
    transform:translateY(0) scale(1);
    opacity:1;
}

.album-lightbox-image {
    display:block;
    width:auto;
    height:auto;
    max-width:100%;
    max-height:100%;
    object-fit:contain;
    border-radius:16px;
    user-select:none;
    -webkit-user-drag:none;
}

.album-lightbox-close {
    position:absolute;
    top:10px;
    right:10px;
    z-index:3;
    width:42px;
    height:42px;
    padding:0;
    border:1px solid rgba(255,255,255,.2);
    border-radius:50%;
    background:rgba(10,12,14,.66);
    color:#fff;
    font-size:28px;
    line-height:1;
    cursor:pointer;
    backdrop-filter:blur(10px);
    -webkit-backdrop-filter:blur(10px);
}

.album-lightbox-close:hover {
    background:rgba(255,255,255,.14);
    transform:scale(1.04);
}

@media (max-width:700px) {
    .album-lightbox {
        padding:max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    }

    .album-lightbox-card {
        width:calc(100vw - 16px);
        height:calc(100dvh - 16px);
        max-width:calc(100vw - 16px);
        max-height:calc(100dvh - 16px);
        padding:4px;
        border-radius:18px;
        background:rgba(12,14,16,.9);
    }

    .album-lightbox-image {
        max-width:100%;
        max-height:100%;
        border-radius:14px;
    }

    .album-lightbox-close {
        top:8px;
        right:8px;
        width:40px;
        height:40px;
    }
}

@media (prefers-reduced-motion:reduce) {
    .album-lightbox,
    .album-lightbox-card,
    .album-lightbox-close {
        transition:none !important;
    }
}
