/* ==============================================================================
 * Mentifyll: értesítési központ (🔔 a fejlécben + lenyíló panel / mobil alsó „sheet”)
 * Z-sorrend: panel 9210 (a PWA-sávok [9000/9100] fölött, a toast [9999] alatt)
 * ============================================================================== */

/* ---------- Harang-gomb a fejlécben ---------- */
.notify-bell {
    position: relative;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    padding: 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    background: var(--color-surface-variant);
    color: var(--color-text-main);
    font-family: inherit;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s, transform 0.1s;
}

.notify-bell:hover {
    background: var(--color-border);
}

.notify-bell:active {
    transform: scale(0.96);
}

.notify-bell[aria-expanded="true"] {
    border-color: var(--color-primary);
}

.notify-bell-icon {
    display: inline-block;
    pointer-events: none;
    transform-origin: 50% 10%;
}

.notify-bell.is-ringing .notify-bell-icon {
    animation: notify-ring 0.9s ease-in-out 1;
}

@keyframes notify-ring {
    0%, 100% { transform: rotate(0); }
    15% { transform: rotate(16deg); }
    30% { transform: rotate(-14deg); }
    45% { transform: rotate(10deg); }
    60% { transform: rotate(-8deg); }
    75% { transform: rotate(4deg); }
}

.notify-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: var(--radius-full);
    background: #dc2626;
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 800;
    line-height: 20px;
    text-align: center;
    box-shadow: 0 0 0 2px var(--color-surface);
    pointer-events: none;
}

.notify-badge[hidden] {
    display: none;
}

.notify-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* Keskeny kijelzőn a fejléc nem fér ki: a „Kérdezz!” gomb csak az ikont mutatja */
@media (max-width: 600px) {
    .notify-bell {
        width: 40px;
        min-width: 40px;
    }
}

@media (max-width: 400px) {
    body.notify-bell-on .btn-header-tutor #header-tutor-btn-text {
        display: none;
    }
}

/* ---------- Panel ---------- */
.notify-overlay {
    position: fixed;
    inset: 0;
    z-index: 9200;
    background: transparent;
}

.notify-overlay.is-sheet {
    background: rgba(0, 0, 0, 0.6);
}

.notify-panel {
    position: fixed;
    z-index: 9210;
    display: flex;
    flex-direction: column;
    width: 392px;
    max-width: calc(100vw - 24px);
    max-height: min(74vh, 600px);
    background: var(--color-surface);
    color: var(--color-text-main);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.notify-panel:focus {
    outline: none;
}

.notify-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 10px 10px 16px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface);
}

.notify-title {
    flex: 1;
    min-width: 0;
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--color-heading);
}

.notify-head-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    background: var(--color-surface-variant);
    color: var(--color-text-main);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.notify-head-btn:hover:not(:disabled) {
    background: var(--color-border);
}

.notify-head-btn:disabled {
    opacity: 0.55;
    cursor: default;
}

.notify-head-btn[hidden] {
    display: none;
}

.notify-head-btn.is-icon {
    width: 44px;
    padding: 0;
    font-size: 1rem;
}

.notify-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.notify-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.notify-item {
    position: relative;
    display: flex;
    align-items: stretch;
    border-top: 1px solid var(--color-border);
    background: var(--color-surface);
    transition: opacity 0.2s, background-color 0.15s;
}

.notify-item:first-child {
    border-top: 0;
}

.notify-item.is-removing {
    opacity: 0;
}

.notify-item.is-unread::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--color-primary);
}

.notify-item-main {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-height: 56px;
    padding: 12px 6px 12px 16px;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.notify-item-main:hover {
    background: var(--color-surface-hover);
}

.notify-item-main[aria-disabled="true"] {
    cursor: default;
}

.notify-ico {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    font-size: 1.05rem;
    background: var(--info-bg);
    border: 1px solid var(--info-border);
}

.notify-ico.is-success {
    background: var(--success-bg);
    border-color: var(--success-border);
}

.notify-ico.is-warning {
    background: var(--warning-bg);
    border-color: var(--warning-border);
}

.notify-text {
    flex: 1;
    min-width: 0;
}

.notify-item-title {
    display: block;
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--color-heading);
    overflow-wrap: anywhere;
}

.notify-item.is-unread .notify-item-title {
    font-weight: 800;
}

.notify-item-body {
    display: block;
    margin-top: 2px;
    font-size: 0.82rem;
    line-height: 1.4;
    color: var(--color-card-text);
    overflow-wrap: anywhere;
}

.notify-item-time {
    display: block;
    margin-top: 4px;
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--color-text-muted);
}

.notify-item-time .notify-new {
    color: var(--color-primary);
    font-weight: 800;
}

.notify-item-del {
    flex: 0 0 44px;
    width: 44px;
    min-height: 56px;
    border: 0;
    background: transparent;
    color: var(--color-text-muted);
    font-size: 0.95rem;
    cursor: pointer;
}

.notify-item-del:hover:not(:disabled) {
    background: var(--danger-bg);
    color: var(--danger-fg);
}

.notify-item-del:disabled {
    opacity: 0.5;
    cursor: default;
}

.notify-state {
    padding: 36px 20px;
    text-align: center;
    color: var(--color-card-text);
    font-size: 0.95rem;
    line-height: 1.5;
}

.notify-state .notify-state-ico {
    display: block;
    margin-bottom: 8px;
    font-size: 2rem;
}

.notify-state-retry {
    margin-top: 12px;
    min-height: 44px;
    padding: 0 18px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    background: var(--color-surface-variant);
    color: var(--color-text-main);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.notify-sk {
    padding: 8px 16px 12px;
}

.notify-sk-row {
    height: 56px;
    margin-top: 10px;
    border-radius: var(--radius-md);
    background: linear-gradient(90deg, var(--color-surface-variant), var(--color-border), var(--color-surface-variant));
    background-size: 200% 100%;
    animation: notify-shimmer 1.2s linear infinite;
}

@keyframes notify-shimmer {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
}

/* ---------- Mobil: alsó „sheet” ---------- */
@media (max-width: 767px) {
    .notify-panel {
        left: 0;
        right: 0;
        bottom: 0;
        top: auto;
        width: 100%;
        max-width: none;
        max-height: 82vh;
        border-left: 0;
        border-right: 0;
        border-bottom: 0;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        animation: notify-sheet-up 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
    }
}

@keyframes notify-sheet-up {
    from { transform: translateY(40px); opacity: 0.6; }
    to { transform: translateY(0); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .notify-panel,
    .notify-bell.is-ringing .notify-bell-icon,
    .notify-sk-row {
        animation: none;
    }

    .notify-item {
        transition: none;
    }
}

/* A #avatar-studio értesítési hivatkozás ide görget: a ragadós fejléc alá ne csússzon */
#avatar-ai-root {
    scroll-margin-top: 76px;
}

@media print {
    .notify-bell,
    .notify-overlay,
    .notify-panel {
        display: none !important;
    }
}
