/*
 * avisos-publicos.css — Campanita de notificaciones en el header.
 */

/* Legado: el div root ya no se usa */
#avisos-publicos-root { display: none !important; }

/* ── Wrapper: hermano de ul.nav dentro de nav.main-nav ───────────────────── */

/*
 * Mobile (default): el hamburger está en right:40px + width:32px = ocupa hasta 72px
 * desde el borde derecho. El bell va a right:82px para dejar 10px de margen.
 * top:20px y height:40px coinciden exactamente con el hamburger.
 */
.avisos-bell-wrap {
    position: absolute;
    right: 82px;
    top: 20px;
    height: 40px;
    display: flex;
    align-items: center;
    z-index: 200;
}

/*
 * Desktop (≥1024px): el ul.nav tiene float:right; margin-top:35px; height:40px.
 * Al insertar el wrap ANTES del ul.nav en el DOM y también con float:right,
 * el wrap toma la posición más a la derecha y el ul.nav queda a su izquierda.
 */
@media (min-width: 1024px) {
    .avisos-bell-wrap {
        position: relative;
        float: right;
        top: auto;
        right: auto;
        margin-top: 35px;
        height: 40px;
        display: flex;
        align-items: center;
        z-index: auto;
    }
}

/* Dentro de .oa-topbar (verificar.html) */
.oa-topbar .avisos-bell-wrap {
    position: relative;
    top: auto;
    right: auto;
    height: auto;
    margin-left: 12px;
    flex-shrink: 0;
}

/* ── Botón campanita ─────────────────────────────────────────────────────── */
.avisos-bell-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.85);
    font-size: 17px;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    position: relative;
    font-weight: 500;
    line-height: 1;
    border-radius: 6px;
}

.avisos-bell-btn:hover,
.avisos-bell-btn:focus-visible {
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
    outline: none;
}

/* Animación ring cuando hay no leídos */
.avisos-bell-btn.has-unread .fa-bell {
    animation: bell-ring 0.9s ease 0.5s 2;
    transform-origin: top center;
    display: inline-block;
}

@keyframes bell-ring {
    0%,  100% { transform: rotate(0deg); }
    15%        { transform: rotate(18deg); }
    35%        { transform: rotate(-14deg); }
    55%        { transform: rotate(9deg); }
    75%        { transform: rotate(-7deg); }
}

/* ── Badge rojo ───────────────────────────────────────────────────────────── */
.avisos-bell-badge {
    position: absolute;
    top: 0px;
    right: 4px;
    background: #ef4444;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    min-width: 15px;
    height: 15px;
    border-radius: 8px;
    padding: 0 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    pointer-events: none;
    border: 1.5px solid rgba(255,255,255,0.25);
}

/* Estado de carga: spinner semitransparente en lugar del conteo */
.avisos-bell-badge.avisos-bell-loading {
    background: rgba(255, 255, 255, 0.25);
    border-color: transparent;
    font-size: 7px;
    min-width: 14px;
    height: 14px;
    top: 1px;
    right: 5px;
}

/* ── Dropdown ────────────────────────────────────────────────────────────── */
.avisos-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 12px);
    width: 320px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.16), 0 2px 8px rgba(0,0,0,0.07);
    z-index: 9999;
    overflow: hidden;
    max-height: 480px;
    overflow-y: auto;
    text-align: left;
}

.avisos-dropdown.open {
    display: block;
    animation: avisos-in 0.18s ease;
}

@keyframes avisos-in {
    from { opacity: 0; transform: translateY(-8px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* En mobile el dropdown se ancla al viewport para no salirse de pantalla */
@media (max-width: 1023px) {
    .avisos-dropdown {
        position: fixed;
        top: 62px;
        right: 10px;
        left: 10px;
        width: auto;
        border-radius: 12px;
        max-height: 70vh;
    }
}

/* Header del panel */
.avisos-dropdown-header {
    padding: 14px 18px 12px;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #1B396A;
    border-bottom: 1px solid #eef2f7;
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #f0f5ff 0%, #f8fafc 100%);
    position: sticky;
    top: 0;
    z-index: 1;
}

/* Botón marcar todo */
.avisos-mark-all {
    display: block;
    width: 100%;
    background: none;
    border: none;
    border-bottom: 1px solid #f1f5f9;
    padding: 9px 18px;
    text-align: right;
    font-size: 11px;
    font-weight: 600;
    color: #1B396A;
    cursor: pointer;
    letter-spacing: 0.2px;
}
.avisos-mark-all:hover { background: #f0f5ff; }

/* Estado vacío */
.avisos-dropdown-empty {
    padding: 26px 18px;
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* ── Items ────────────────────────────────────────────────────────────────── */
.aviso-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid #f1f5f9;
    border-left: 4px solid transparent;
}
.aviso-item:last-child { border-bottom: none; }
.aviso-item:hover      { background: #f8fafc; }

.aviso-item-info    { border-left-color: #1B396A; }
.aviso-item-warning { border-left-color: #f59e0b; }
.aviso-item-success { border-left-color: #10b981; }
.aviso-item-danger  { border-left-color: #ef4444; }

/* Ya leídos */
.aviso-item-leido { opacity: 0.5; border-left-color: #d1d5db !important; }
.aviso-item-leido:hover { opacity: 0.7; background: #f8fafc; }
.aviso-item-leido .aviso-item-icon { color: #9ca3af !important; }

.aviso-item-icon { font-size: 15px; margin-top: 1px; flex-shrink: 0; }
.aviso-item-info    .aviso-item-icon { color: #1B396A; }
.aviso-item-warning .aviso-item-icon { color: #d97706; }
.aviso-item-success .aviso-item-icon { color: #059669; }
.aviso-item-danger  .aviso-item-icon { color: #dc2626; }

.aviso-item-body { flex: 1; min-width: 0; }

.aviso-item-titulo {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 3px;
    line-height: 1.4;
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
}

.aviso-item-contenido {
    font-size: 12px;
    color: #64748b;
    margin: 0;
    line-height: 1.55;
}

/* Chip "leído" */
.aviso-leido-chip {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: #9ca3af;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 1px 5px;
    flex-shrink: 0;
}

.aviso-item-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #cbd5e1;
    font-size: 18px;
    padding: 0 2px;
    line-height: 1;
    flex-shrink: 0;
}
.aviso-item-close:hover { color: #64748b; }

/* ── Ajustes cuando el header se colapsa al hacer scroll (.background-header) ── */



/* Desktop: ul.nav pasa de margin-top:35px a margin-top:20px */
@media (min-width: 1024px) {
    .background-header .avisos-bell-wrap {
        top: auto;
        margin-top: 20px;
    }
}
