/* ============================================================
   NOTIFICACIONES — botón flotante + panel lateral
   ============================================================ */

/* ── Botón flotante ─────────────────────────────────────── */
.notif-fab {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--color-primary);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(31, 79, 216, 0.35);
    z-index: 900;
    transition: transform 0.15s, box-shadow 0.15s;
}

.notif-fab:hover {
    transform: scale(1.06);
    box-shadow: 0 6px 22px rgba(31, 79, 216, 0.45);
}

.notif-fab svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: #fff;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #fff;
    color: var(--color-primary);
    font-size: 0.68rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.18);
    line-height: 1;
}

/* ── Overlay ────────────────────────────────────────────── */
.notif-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.32);
    z-index: 950;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.notif-overlay.is-open {
    opacity: 1;
    pointer-events: all;
}

/* ── Panel lateral ──────────────────────────────────────── */
.notif-panel {
    position: fixed;
    top: 0;
    right: 0;
    height: 100dvh;
    width: 380px;
    max-width: 100vw;
    background: var(--color-card);
    box-shadow: -4px 0 32px rgba(15, 23, 42, 0.12);
    z-index: 960;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.notif-panel.is-open {
    transform: translateX(0);
}

.notif-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.notif-panel__title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.notif-panel__close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--color-card-soft);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-muted);
    font-size: 1rem;
    transition: background 0.15s;
    line-height: 1;
}

.notif-panel__close:hover {
    background: var(--color-border);
}

.notif-panel__body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ── Card de notificación ───────────────────────────────── */
.notif-card {
    background: var(--color-card-soft);
    border: 1px solid var(--color-border);
    border-left-width: 3px;
    border-radius: var(--radius-md);
    padding: 14px 16px 14px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: opacity 0.2s;
}

.notif-card--lentillas            { border-left-color: var(--color-primary); }
.notif-card--lentillas_anticipada { border-left-color: #f59e0b; }
.notif-card--revision             { border-left-color: #16a34a; }

.notif-card__top {
    display: flex;
    align-items: center;
    gap: 10px;
}

.notif-card__icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}

.notif-card__icon--lentillas           { background: var(--color-primary-light); }
.notif-card__icon--lentillas_anticipada { background: #fef9c3; }
.notif-card__icon--revision             { background: var(--color-success-soft); }

.notif-card__info {
    flex: 1;
    min-width: 0;
}

.notif-card__nombre {
    font-size: .88rem;
    font-weight: 600;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-card__tipo {
    font-size: .76rem;
    color: var(--color-muted);
    margin-top: 2px;
}

.notif-card__footer {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.notif-card__fecha {
    font-size: .72rem;
    color: var(--color-muted);
    white-space: nowrap;
}

.notif-btn-atender {
    background: transparent;
    color: var(--color-primary);
    border: 1.5px solid var(--color-primary);
    border-radius: var(--radius-sm);
    padding: 5px 12px;
    font-size: .78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.notif-btn-atender:hover {
    background: var(--color-primary);
    color: #fff;
}

/* ── Estado vacío ───────────────────────────────────────── */
.notif-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--color-muted);
    padding: 40px 20px;
    text-align: center;
}

.notif-empty__icon {
    font-size: 2.4rem;
    opacity: .35;
}

.notif-empty__text {
    font-size: .86rem;
}

/* ── Badge suscripción ──────────────────────────────────── */
.notif-card__suscrito {
    display: inline-block;
    font-size: .72rem;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: 999px;
    margin-bottom: 2px;
}

.es-suscrito  { background: #d1fae5; color: #065f46; }
.no-suscrito  { background: #fee2e2; color: #991b1b; }

/* ============================================================
   FRANJA DE AVISO — bajo el header
   Solo visible cuando hay notificaciones pendientes.
   ============================================================ */
.notif-banner {
    display: none;
    align-items: center;
    gap: 12px;
    /* Alineada al milímetro con .app-container: 90% del ancho que queda
       tras el padding de 18px de .app-main. */
    width: calc(0.9 * (100% - 36px));
    margin: 18px auto 0;
    padding: 12px 14px 12px 16px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-left: 4px solid var(--color-warning);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xs);
}

.notif-banner.is-visible {
    display: flex;
    animation: notif-banner-in .28s ease-out;
}

@keyframes notif-banner-in {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0);    }
}

.notif-banner__icon {
    font-size: 1.15rem;
    line-height: 1;
    flex-shrink: 0;
}

.notif-banner__text {
    flex: 1;
    min-width: 0;
    font-size: .88rem;
    color: #78350f;
}

.notif-banner__text strong {
    font-weight: 700;
}

.notif-banner__cta {
    background: var(--color-warning);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 6px 14px;
    font-family: inherit;
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s;
    flex-shrink: 0;
}

.notif-banner__cta:hover { background: #d97706; }

.notif-banner__close {
    width: 26px;
    height: 26px;
    border: none;
    background: transparent;
    border-radius: var(--radius-xs);
    color: #92400e;
    font-size: .85rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
    flex-shrink: 0;
}

.notif-banner__close:hover { background: #fde68a; }

@media (max-width: 600px) {
    .notif-banner       { width: calc(100% - 24px); flex-wrap: wrap; }
    .notif-banner__text { flex-basis: calc(100% - 80px); }
}

/* ============================================================
   BADGE DEL FAB — contraste de alerta (rojo + aro) y pulso
   ============================================================ */
.notif-badge {
    top: -5px;
    right: -5px;
    background: var(--color-danger);
    color: #fff;
    font-size: .72rem;
    min-width: 21px;
    height: 21px;
    box-shadow: 0 0 0 2px #fff, 0 1px 4px rgba(15, 23, 42, .25);
}

/* Anillo de pulso: late sin parar mientras haya notificaciones pendientes (se quita la clase al llegar a 0) */
.notif-fab.has-notifs::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid var(--color-danger);
    animation: notif-ping 1.6s ease-out infinite;
    pointer-events: none;
}

@keyframes notif-ping {
    0%   { opacity: .7; transform: scale(1);    }
    100% { opacity: 0;  transform: scale(1.55); }
}

@media (prefers-reduced-motion: reduce) {
    .notif-fab.has-notifs::after { animation: none; }
    .notif-banner.is-visible     { animation: none; }
}
