/* =====================================================================
   Notificaciones · Dr. Notes. Prefijo: notif-
   ===================================================================== */
.notif-anclaje { position: relative; display: inline-flex; }
.btn-notificaciones { position: relative; padding: 8px 9px; }
.btn-notificaciones.con-nuevas svg { animation: notif-campana 1.2s ease 1; transform-origin: top center; }
@keyframes notif-campana { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(14deg); } 40% { transform: rotate(-12deg); } 60% { transform: rotate(8deg); } 80% { transform: rotate(-4deg); } }
.notif-contador { position: absolute; top: -5px; right: -5px; min-width: 17px; height: 17px; padding: 0 4px; display: grid; place-items: center; border-radius: 999px; background: var(--bad-solido); color: #fff; font: 700 10px var(--f-cuerpo); box-shadow: 0 0 0 2px var(--superficie); font-style: normal; }

.notif-panel {
    position: absolute; top: calc(100% + 8px); right: 0; z-index: 320;
    width: min(380px, calc(100vw - 24px));
    max-height: min(560px, calc(100dvh - 90px));
    display: flex; flex-direction: column;
    border: 1px solid var(--linea); border-radius: 18px; background: var(--superficie);
    box-shadow: var(--sombra-flotante), 0 0 0 1px rgba(15,23,42,.02);
    animation: notif-abrir .18s ease both; overflow: hidden;
}
@keyframes notif-abrir { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.notif-cab { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 6px; }
.notif-cab b { font: 600 15px var(--f-titulo); color: var(--text-main); }
.notif-cerrar { width: 28px; height: 28px; border: 0; border-radius: 50%; background: var(--superficie-2); color: var(--text-2); font-size: 18px; line-height: 1; cursor: pointer; }
.notif-tabs { display: flex; gap: 4px; padding: 6px 12px 10px; border-bottom: 1px solid var(--linea-suave); }
.notif-tabs button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 999px; padding: 8px 10px; background: transparent; color: var(--text-3); font: 500 12.5px var(--f-cuerpo); cursor: pointer; }
.notif-tabs button.activo { background: var(--azul-suave); color: var(--azul-oscuro); font-weight: 600; }
.notif-tabs button i { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--azul-oscuro); color: #fff; font: 700 10px var(--f-cuerpo); font-style: normal; }

.notif-lista { list-style: none; margin: 0; padding: 6px; overflow-y: auto; display: grid; gap: 2px; }
.notif-item { position: relative; display: flex; align-items: flex-start; gap: 10px; padding: 10px 10px; border-radius: 12px; }
.notif-item.nueva { background: var(--azul-suave); }
.notif-item:hover { background: var(--superficie-2); }
.notif-item-icono { flex: 0 0 34px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--superficie-2); color: var(--azul); }
.notif-item-icono svg, .notif-toast-icono svg, .notif-vacio svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.notif-item.tipo-examen .notif-item-icono { background: var(--ok-bg); color: var(--ok); }
.notif-item.tipo-atraso .notif-item-icono { background: var(--bad-bg); color: var(--bad); }
.notif-item.tipo-logro .notif-item-icono { background: var(--warn-bg); color: var(--warn); }
.notif-item-cuerpo { flex: 1; min-width: 0; display: grid; gap: 2px; border: 0; background: none; padding: 0; text-align: left; cursor: pointer; font-family: var(--f-cuerpo); }
.notif-item-cuerpo b { font: 600 13px var(--f-cuerpo); color: var(--text-main); }
.notif-item-cuerpo span { font-size: 12.5px; color: var(--text-2); line-height: 1.4; }
.notif-item-cuerpo small { font-size: 11px; color: var(--text-3); }
.notif-punto { position: absolute; top: 12px; right: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--azul); }
.notif-acciones { display: flex; justify-content: space-between; gap: 8px; padding: 8px 14px 12px; border-top: 1px solid var(--linea-suave); }
.notif-link { border: 0; background: none; padding: 4px 2px; color: var(--azul); font: 600 12px var(--f-cuerpo); cursor: pointer; }
.notif-link:hover { text-decoration: underline; }
.notif-btn { border: 0; border-radius: 10px; padding: 9px 14px; background: var(--azul-oscuro); color: #fff; font: 600 12.5px var(--f-cuerpo); cursor: pointer; justify-self: start; }
.notif-btn:hover { background: #16304F; }
.notif-vacio { display: grid; justify-items: center; gap: 6px; padding: 34px 24px; text-align: center; color: var(--text-3); }
.notif-vacio svg { width: 30px; height: 30px; color: var(--azul-borde); margin-bottom: 4px; }
.notif-vacio b { font: 600 14px var(--f-cuerpo); color: var(--text-main); }
.notif-vacio span { font-size: 12.5px; line-height: 1.45; }
.notif-vacio .notif-btn { margin-top: 8px; justify-self: center; }

.notif-ajustes { display: grid; gap: 8px; padding: 12px; overflow-y: auto; }
.notif-estado { display: grid; gap: 4px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--linea); background: var(--superficie-2); }
.notif-estado b { font: 600 13px var(--f-cuerpo); color: var(--text-main); }
.notif-estado span { font-size: 12.5px; line-height: 1.45; color: var(--text-2); }
.notif-estado .notif-btn, .notif-estado .notif-link { margin-top: 6px; justify-self: start; }
.notif-estado.azul { background: var(--azul-suave); border-color: var(--azul-borde); }
.notif-estado.verde { background: var(--ok-bg); border-color: var(--ok-borde); }
.notif-estado.verde b { color: var(--ok); }
.notif-estado.rojo { background: var(--bad-bg); border-color: var(--bad-borde); }
.notif-estado.rojo b { color: var(--bad); }
.notif-fila { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--linea-suave); cursor: pointer; }
.notif-fila span { display: grid; gap: 1px; }
.notif-fila b { font: 600 13px var(--f-cuerpo); color: var(--text-main); }
.notif-fila small { font-size: 12px; color: var(--text-3); line-height: 1.4; }
.notif-fila input[type=checkbox] { flex: 0 0 auto; width: 40px; height: 22px; margin: 0; appearance: none; border-radius: 999px; background: var(--linea); position: relative; cursor: pointer; transition: background .2s; }
.notif-fila input[type=checkbox]::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.notif-fila input[type=checkbox]:checked { background: var(--azul); }
.notif-fila input[type=checkbox]:checked::after { transform: translateX(18px); }
.notif-fila input[type=time] { border: 1px solid var(--linea); border-radius: 8px; padding: 6px 8px; font: 500 13px var(--f-cuerpo); color: var(--text-main); }
.notif-fila.deshabilitada { opacity: .55; cursor: default; }
.notif-pie { margin: 2px 4px 0; font-size: 11.5px; color: var(--text-3); line-height: 1.45; }

/* Toast dentro del sistema */
.notif-toast {
    position: fixed; right: 18px; top: 18px; z-index: 440; width: min(360px, calc(100vw - 28px));
    display: flex; align-items: flex-start; gap: 10px; padding: 12px 12px 12px 14px;
    border: 1px solid var(--linea); border-radius: 16px; background: var(--superficie); box-shadow: var(--sombra-flotante);
    cursor: pointer; animation: notif-entrar .3s cubic-bezier(.22, 1, .36, 1) both;
}
.notif-toast.saliendo { animation: notif-salir .3s ease both; }
@keyframes notif-entrar { from { opacity: 0; transform: translateY(-12px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes notif-salir { to { opacity: 0; transform: translateY(-8px); } }
.notif-toast-icono { flex: 0 0 34px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--azul-suave); color: var(--azul); }
.notif-toast.tipo-examen .notif-toast-icono { background: var(--ok-bg); color: var(--ok); }
.notif-toast.tipo-atraso .notif-toast-icono { background: var(--bad-bg); color: var(--bad); }
.notif-toast.tipo-logro .notif-toast-icono { background: var(--warn-bg); color: var(--warn); }
.notif-toast-texto { flex: 1; min-width: 0; display: grid; gap: 2px; }
.notif-toast-texto b { font: 600 13px var(--f-cuerpo); color: var(--text-main); }
.notif-toast-texto span { font-size: 12.5px; color: var(--text-2); line-height: 1.4; }
.notif-toast-cerrar { border: 0; background: none; color: var(--text-3); font-size: 18px; line-height: 1; cursor: pointer; padding: 0 2px; }

@media (max-width: 720px) {
    .notif-panel { position: fixed; top: calc(66px + env(safe-area-inset-top, 0px)); bottom: auto; left: 12px; right: 12px; width: auto; max-height: calc(100dvh - 66px - var(--nav-movil-h) - 24px - env(safe-area-inset-bottom, 0px)); border-radius: 20px; transform-origin: top center; }
    .notif-toast { top: calc(66px + env(safe-area-inset-top, 0px)); left: 14px; right: 14px; width: auto; }
}
@media (prefers-reduced-motion: reduce) {
    .notif-panel, .notif-toast, .btn-notificaciones.con-nuevas svg { animation: none; }
}

/* Despliegue de arriba hacia abajo + tarjetas en cascada */
@keyframes notif-baja { from { opacity: 0; transform: translateY(-18px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes notif-carta { from { opacity: 0; transform: translateY(-22px) scale(.95); } to { opacity: 1; transform: none; } }
html .notif-panel:not(.oculto) { animation: notif-baja .32s cubic-bezier(.2,.8,.2,1) both; transform-origin: top right; }
.notif-panel.notif-entra .notif-item, .notif-panel.notif-entra .notif-vacio, .notif-panel.notif-entra .notif-acciones { animation: notif-carta .44s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--i, 0) * 60ms + 120ms); }
.notif-panel.notif-entra .notif-vacio, .notif-panel.notif-entra .notif-acciones { animation-delay: 200ms; }
@media (prefers-reduced-motion: reduce) { html .notif-panel:not(.oculto), .notif-panel.notif-entra .notif-item, .notif-panel.notif-entra .notif-vacio, .notif-panel.notif-entra .notif-acciones { animation: none; } }
