/* Универсальная система уведомлений для всего проекта.
   API: window.notify.show({...}) — см. /js/notifications.js
   Использует переменные из /styles/index.css, но fallback есть для standalone-страниц. */

#notify-root {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
    max-width: 380px;
    width: calc(100vw - 40px);
    font-family: Rubik, system-ui, -apple-system, sans-serif;
}
@media (max-width: 540px) {
    #notify-root {
        top: 12px;
        left: 12px;
        right: 12px;
        max-width: none;
        width: auto;
    }
}

.notify {
    pointer-events: auto;
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-gap: 12px;
    align-items: center;
    padding: 14px 38px 14px 14px;
    border-radius: 14px;
    background: rgba(30, 31, 33, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    color: #fff;
    backdrop-filter: blur(14px) saturate(160%);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    opacity: 0;
    transform: translate3d(120%, 0, 0);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s;
    overflow: hidden;
    will-change: transform, opacity;
}
.notify--in {
    opacity: 1;
    transform: translate3d(0, 0, 0);
}
.notify--out {
    opacity: 0;
    transform: translate3d(120%, 0, 0);
    transition: transform 0.3s ease-in, opacity 0.25s;
}
@media (max-width: 540px) {
    .notify {
        transform: translate3d(0, -120%, 0);
    }
    .notify--out {
        transform: translate3d(0, -120%, 0);
    }
}
.notify--clickable { cursor: pointer; }
.notify--clickable:hover {
    transform: translate3d(0, -2px, 0);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
}

/* === Icon === */
.notify__icon {
    width: 38px; height: 38px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
}
.notify__icon img,
.notify__icon svg { width: 22px; height: 22px; }
.notify__icon-emoji {
    font-size: 22px;
    font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
}

/* === Content === */
.notify__content { min-width: 0; overflow: hidden; }
.notify__title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 4px;
    min-height: 1.2em;
    letter-spacing: -0.1px;
}
.notify__body {
    font-size: 12.5px;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.8);
    min-height: 1em;
    word-break: break-word;
}
.notify__body:empty { display: none; }
/* В pompous-режиме тело ВСЕГДА занимает место — typewriter заполняет его постепенно. */
.notify--pompous .notify__body:empty { display: block; }

/* === Hero image (top of notification) === */
.notify--has-image { padding-top: 0; padding-left: 0; padding-right: 0; padding-bottom: 0; }
.notify--has-image .notify__image {
    grid-column: 1 / -1;
    height: 120px;
    overflow: hidden;
    background: #000;
}
.notify--has-image .notify__image img {
    width: 100%; height: 100%; object-fit: cover;
    display: block;
}
.notify--has-image .notify__icon { margin-left: 14px; margin-top: -28px; }
.notify--has-image .notify__content { padding: 12px 14px 14px 0; }
.notify--has-image .notify__close { top: 10px; right: 10px; background: rgba(0,0,0,0.5); color: #fff; }

/* === Close button === */
.notify__close {
    position: absolute;
    top: 8px; right: 8px;
    width: 24px; height: 24px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.6);
    border: none;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s, color 0.2s, transform 0.15s;
    padding: 0;
}
.notify__close:hover { background: rgba(255, 255, 255, 0.18); color: #fff; transform: scale(1.1); }

/* === Actions === */
.notify__actions {
    display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap;
}
.notify__action {
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
}
.notify__action:hover  { background: rgba(255, 255, 255, 0.24); }
.notify__action:active { transform: scale(0.96); }
.notify__action--primary { background: #fff; color: #1a1a1a; }
.notify__action--primary:hover { background: #f0f0f0; }

/* === Type colors === */
.notify--success .notify__icon { background: linear-gradient(135deg, #4DC167, #2a9d4c); }
.notify--success .notify__title { color: #4DC167; }

.notify--warning .notify__icon { background: linear-gradient(135deg, #FF8832, #c96a1a); }
.notify--warning .notify__title { color: #FF8832; }

.notify--error   .notify__icon { background: linear-gradient(135deg, #DF5A5A, #b03434); }
.notify--error   .notify__title { color: #DF5A5A; }

.notify--info    .notify__icon { background: linear-gradient(135deg, #5A9DDF, #2a6a9a); }
.notify--info    .notify__title { color: #5A9DDF; }

.notify--achievement .notify__icon {
    background: linear-gradient(135deg, #ffd60a, #ff9f0a);
    color: #1a1100;
    box-shadow: 0 0 16px rgba(255, 214, 10, 0.5);
}
.notify--achievement .notify__title {
    color: #ffd60a;
    text-shadow: 0 0 12px rgba(255, 214, 10, 0.3);
}

.notify--levelup .notify__icon {
    background: linear-gradient(135deg, #b794f6, #7c3aed);
    color: #fff;
    box-shadow: 0 0 16px rgba(167, 139, 250, 0.5);
}
.notify--levelup .notify__title { color: #c4b5fd; }

/* === Pompous style (большое появление) === */
.notify--pompous {
    transform: scale(0.5);
    transform-origin: center;
    border-width: 1.5px;
    padding: 18px 44px 18px 16px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6),
                0 0 40px rgba(255, 214, 10, 0.2);
}
.notify--pompous.notify--in {
    animation: pompousIn 0.65s cubic-bezier(0.34, 1.6, 0.64, 1) forwards;
}
.notify--pompous.notify--out {
    animation: pompousOut 0.4s ease-in forwards;
}
@keyframes pompousIn {
    0%   { transform: scale(0.45) rotate(-2deg); opacity: 0; }
    55%  { transform: scale(1.08) rotate(0.5deg); opacity: 1; }
    80%  { transform: scale(0.98) rotate(0); }
    100% { transform: scale(1)    rotate(0); opacity: 1; }
}
@keyframes pompousOut {
    0%   { transform: scale(1);    opacity: 1; }
    100% { transform: scale(0.88); opacity: 0; }
}
.notify--pompous .notify__title {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0;
}
.notify--pompous .notify__body {
    font-size: 13px;
}
.notify--pompous .notify__icon { width: 44px; height: 44px; font-size: 22px; }
.notify--pompous .notify__icon-emoji { font-size: 26px; }

.notify--pompous.notify--achievement,
.notify--pompous.notify--levelup {
    border-color: rgba(255, 214, 10, 0.45);
    background: linear-gradient(135deg, rgba(40, 30, 10, 0.96), rgba(30, 31, 33, 0.96));
}
.notify--pompous.notify--levelup {
    border-color: rgba(167, 139, 250, 0.45);
    background: linear-gradient(135deg, rgba(40, 30, 60, 0.96), rgba(30, 31, 33, 0.96));
}

/* === Typewriter cursor === */
.notify__title.typing::after,
.notify__body.typing::after {
    content: '▌';
    display: inline-block;
    margin-left: 2px;
    color: currentColor;
    opacity: 0.7;
    animation: typewriterCursor 0.7s infinite;
}
@keyframes typewriterCursor {
    50% { opacity: 0; }
}

/* === Sparkles (для pompous) === */
.notify__sparkles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    border-radius: inherit;
}
.notify__sparkle {
    position: absolute;
    width: 4px; height: 4px;
    background: #ffd60a;
    border-radius: 50%;
    box-shadow: 0 0 10px #ffd60a, 0 0 20px rgba(255, 214, 10, 0.6);
    opacity: 0;
    animation: sparkle 2.2s ease-in-out infinite;
}
.notify--levelup .notify__sparkle { background: #c4b5fd; box-shadow: 0 0 10px #b794f6, 0 0 20px rgba(167, 139, 250, 0.6); }
.notify__sparkle:nth-child(1) { top: 18%; left:  8%; animation-delay: 0.0s; }
.notify__sparkle:nth-child(2) { top: 62%; left: 82%; animation-delay: 0.3s; }
.notify__sparkle:nth-child(3) { top: 32%; left: 68%; animation-delay: 0.6s; }
.notify__sparkle:nth-child(4) { top: 78%; left: 22%; animation-delay: 0.9s; }
.notify__sparkle:nth-child(5) { top: 48%; left: 92%; animation-delay: 1.2s; }
.notify__sparkle:nth-child(6) { top: 8%;  left: 50%; animation-delay: 1.5s; }
@keyframes sparkle {
    0%, 100% { opacity: 0; transform: scale(0.4); }
    40%, 60% { opacity: 1; transform: scale(1.4); }
}

/* === Прогресс-полоска жизни уведомления (опционально) === */
.notify__progress {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 2px;
    background: rgba(255, 255, 255, 0.06);
    border-bottom-left-radius: 14px;
    border-bottom-right-radius: 14px;
    overflow: hidden;
}
.notify__progress-bar {
    height: 100%;
    background: currentColor;
    width: 100%;
    transform-origin: left;
    animation: notifyProgress linear forwards;
    opacity: 0.7;
}
@keyframes notifyProgress {
    to { transform: scaleX(0); }
}

/* === Light theme support === */
@media (prefers-color-scheme: light) {
    /* Опционально, если страница в light-теме */
}
