/* header.css */
.top-bar {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 28px;
}

.burger-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
}

.search-wrapper {
    flex: 1;
    background: var(--search-bg);
    border-radius: 60px;
    padding: 8px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--search-border);
    position: relative;
}
.search-wrapper i { color: var(--text-secondary); }
.search-wrapper input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 15px;
    width: 100%;
    outline: none;
}
.search-wrapper input::placeholder { color: var(--text-secondary); }

.search-results {
    position: absolute;
    top: 55px;
    left: 0;
    width: 100%;                  /* привязан к ширине родителя */
    background: var(--search-results-bg);
    border-radius: 20px;
    border: 1px solid var(--popup-border);
    box-shadow: 0 20px 30px var(--shadow-heavy);
    padding: 8px 0 0 0;
    z-index: 1000;
    display: none;
    max-height: 380px;
    overflow-y: auto;
}
.search-results.show { display: block; }
.search-loader { padding: 20px; text-align: center; color: var(--text-secondary); }
.search-section-title {
    padding: 8px 16px;
    font-size: 12px;
    color: var(--search-section-title);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 4px;
}
.search-track-item, .search-author-item {
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
    color: inherit;
}
.search-track-item:hover, .search-author-item:hover { background: var(--search-item-hover); }
.search-track-avatar {
    width: 40px; height: 40px;
    border-radius: 10px;
    background: var(--card-bg);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    overflow: hidden;
}
.search-track-avatar img { width: 100%; height: 100%; object-fit: cover; }
.search-track-info { flex: 1; min-width: 0; }
.search-track-title {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.search-track-meta {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 2px;
}
.search-track-artist { color: var(--text-secondary); }
.search-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex-shrink: 0;
}
.search-cover-badge {
    color: var(--accent);
    font-size: 14px;
    cursor: help;
    position: relative;
}
.search-cover-badge:hover::after {
    content: "Кавер";
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--dropdown-bg);
    color: var(--text-primary);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    white-space: nowrap;
    margin-bottom: 6px;
    pointer-events: none;
    border: 1px solid var(--popup-border);
}
.search-go-link { color: var(--text-secondary); font-size: 14px; transition: 0.2s; }
.search-go-link:hover { color: var(--accent); }
.search-footer {
    padding: 12px 16px;
    text-align: center;
    color: var(--accent);
    border-top: 1px solid var(--search-footer-border);
    font-weight: 500;
    cursor: pointer;
    background: var(--search-results-bg);
    position: sticky;
    bottom: 0;
    margin-top: 4px;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 24px;
    position: relative;
}

/* Иконка сообщений */
.messages-icon {
    position: relative;
    color: var(--text-secondary);
    font-size: 20px;
    text-decoration: none;
    transition: color 0.2s;
}
.messages-icon:hover {
    color: var(--accent);
}
.messages-icon .badge-count {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--accent);
    color: black;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 30px;
}

/* Кнопка входа */
.login-btn {
    background: var(--accent);
    color: black;
    padding: 8px 18px;
    border-radius: 40px;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    transition: 0.2s;
    white-space: nowrap;
}
.login-btn:hover {
    background: var(--accent-hover);
    transform: scale(1.02);
}

/* ---------- Уведомления: колокольчик ---------- */
.notification-bell { position: relative; }
.notif-bell-btn {
    position: relative;
    background: none; border: none; padding: 0;
    color: var(--text-secondary);
    font-size: 20px; line-height: 1;
    cursor: pointer;
    transition: color 0.2s;
}
.notif-bell-btn:hover, .notif-bell-btn[aria-expanded="true"] { color: var(--accent); }
.notif-bell-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 6px; }
.badge-count {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--accent);
    color: black;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 30px;
    min-width: 16px;
    text-align: center;
    line-height: 12px;
}
.notif-bell-btn .badge-count { animation: notif-pop 0.3s ease; }
@keyframes notif-pop { 0% { transform: scale(0.4); } 70% { transform: scale(1.2); } 100% { transform: scale(1); } }

/* ---------- Попап последних уведомлений ---------- */
.notifications-popup {
    position: absolute;
    top: 42px;
    right: -12px;
    width: 360px;
    /* не выше 440px и всегда над плеером (он занимает ~100px снизу) */
    max-height: min(440px, calc(100vh - 100px));
    background: var(--notif-popup-bg);
    border-radius: 20px;
    border: 1px solid var(--popup-border);
    box-shadow: 0 20px 40px var(--shadow-heavy);
    z-index: 60;
    display: none;
    overflow: hidden;
}
.notifications-popup.show { display: flex; flex-direction: column; animation: notif-in 0.15s ease; }
@keyframes notif-in { from { opacity: 0; transform: translateY(-6px); } }
.notif-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--popup-border);
    font-weight: 700; font-size: 15px;
    color: var(--text-primary);
}
.notif-read-all {
    background: none; border: none;
    color: var(--accent);
    font: inherit; font-size: 13px; font-weight: 600;
    cursor: pointer; padding: 4px 8px; border-radius: 8px;
}
.notif-read-all:hover { background: var(--notif-unread-bg); }
.notif-read-all:disabled { color: var(--text-secondary); opacity: 0.5; cursor: default; background: none; }
.notif-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.notif-header, .notif-footer { flex: none; }
body.player-active .notifications-popup { max-height: min(440px, calc(100vh - 200px)); }
.notifications-popup .notif-item { padding: 10px 32px 10px 14px; gap: 10px; }
.notifications-popup .notif-avatar { width: 38px; height: 38px; }
.notifications-popup .notif-text { font-size: 13.5px; }
.notifications-popup .notif-preview { -webkit-line-clamp: 1; }
.notif-footer {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 13px;
    border-top: 1px solid var(--popup-border);
    color: var(--accent);
    font-size: 14px; font-weight: 600;
    text-decoration: none;
}
.notif-footer:hover { background: var(--notif-unread-bg); }
.notif-empty {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 36px 16px;
    color: var(--text-secondary); font-size: 14px;
}
.notif-empty i { font-size: 26px; opacity: 0.6; }

/* ---------- Одна запись (попап, тосты, страница) ---------- */
.notif-item {
    position: relative;
    display: flex; align-items: flex-start; gap: 12px;
    padding: 12px 34px 12px 16px;
    border-bottom: 1px solid var(--notif-item-border);
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: background 0.15s;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--dropdown-item-hover); }
.notif-item.unread { background: var(--notif-unread-bg); }
.notif-item.unread:hover { background: var(--dropdown-item-hover); }

.notif-avatar { position: relative; flex: none; width: 42px; height: 42px; }
.notif-avatar > img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.notif-avatar.is-icon {
    display: grid; place-items: center;
    border-radius: 50%;
    background: var(--dropdown-item-hover);
    font-size: 17px;
}
.notif-verb {
    position: absolute; right: -3px; bottom: -3px;
    width: 20px; height: 20px;
    display: grid; place-items: center;
    border-radius: 50%;
    font-size: 10px; color: #fff;
    border: 2px solid var(--notif-popup-bg);
}
.tone-red { --tone: #ef4444; }
.tone-blue { --tone: #3b82f6; }
.tone-green { --tone: #22c55e; }
.tone-gold { --tone: #f5a524; }
.tone-accent { --tone: var(--accent); }
.notif-verb { background: var(--tone); }
.notif-avatar.is-icon { color: var(--tone); }

.notif-content { flex: 1; min-width: 0; }
.notif-text { font-size: 14px; line-height: 1.4; color: var(--text-secondary); }
.notif-text b { color: var(--text-primary); font-weight: 600; }
.notif-item.unread .notif-text { color: var(--text-primary); }
.notif-item.unread .notif-text b { font-weight: 700; }
.notif-preview {
    margin-top: 4px;
    font-size: 13px; color: var(--text-secondary);
    overflow: hidden; text-overflow: ellipsis;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.notif-preview::before { content: '«'; }
.notif-preview::after { content: '»'; }
.notif-time { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.notif-item.unread .notif-time { color: var(--accent); font-weight: 600; }
.notif-item.is-read .notif-avatar { opacity: 0.75; }

/* Точка «не прочитано»; у прочитанных — пустое кольцо */
.notif-dot {
    position: absolute; right: 14px; top: 50%;
    width: 9px; height: 9px; margin-top: -4px;
    border-radius: 50%;
    border: 2px solid transparent;
}
.notif-item.unread .notif-dot { background: var(--accent); box-shadow: 0 0 0 3px var(--notif-unread-bg); }

/* ---------- Всплывающие уведомления ---------- */
.notif-toasts {
    position: fixed; right: 20px; top: 20px; z-index: 1100;
    display: flex; flex-direction: column; gap: 10px;
    width: 360px; max-width: calc(100vw - 32px);
    pointer-events: none;
}
.notif-item.notif-toast {
    pointer-events: auto;
    border: 1px solid var(--popup-border);
    border-radius: 16px;
    background: var(--notif-popup-bg);
    box-shadow: 0 16px 40px var(--shadow-heavy);
    opacity: 0; transform: translateY(-16px);
    transition: opacity 0.25s, transform 0.25s;
}
.notif-item.notif-toast.show { opacity: 1; transform: none; }
.notif-item.notif-toast.unread { background: var(--notif-popup-bg); }

.balance-widget {
    display: flex;
    align-items: center;
    background: var(--balance-bg);
    border-radius: 40px;
    padding: 5px 10px 5px 16px;
    gap: 8px;
    border: 1px solid var(--balance-border);
}
.balance-amount { font-weight: 700; font-size: 18px; color: var(--text-primary); }
.btn-sm {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 6px 14px;
    border-radius: 40px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: 0.2s;
}
.btn-sm:hover { background: var(--accent); color: black; }

.user-mini { display: flex; align-items: center; gap: 12px; position: relative; }
.avatar-mini {
    width: 42px; height: 42px;
    background-color: var(--avatar-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    font-weight: 600;
    font-size: 16px;
    border: 1.5px solid var(--avatar-border);
    cursor: pointer;
    background-size: cover;
    background-position: center;
}
.avatar-mini:hover { border-color: var(--accent); }

.avatar-dropdown {
    position: absolute;
    top: 55px;
    right: 0;
    background: var(--avatar-dropdown-bg);
    border-radius: 16px;
    box-shadow: 0 12px 28px var(--shadow-heavy);
    min-width: 220px;
    padding: 8px 0;
    border: 1px solid var(--popup-border);
    display: none;
    z-index: 100;
}
.avatar-dropdown.show { display: block; }

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.2s;
}
.dropdown-item:hover {
    background: var(--dropdown-item-hover);
}
.dropdown-divider {
    height: 1px;
    background: var(--border-light);
    margin: 6px 0;
}

@media (max-width: 1135px) {
    /* На планшетах и мобильных попап поиска привязываем к ширине экрана */
    .search-results {
        position: fixed;
        top: 70px;
        left: 50%;
        transform: translateX(-50%);
        width: 90vw;
        max-width: 90vw;
        border-radius: 20px;
        padding: 12px 0 0 0;
        max-height: 70vh;
    }
}

@media (max-width: 768px) {
    .burger-btn { display: block; }
    .search-wrapper { padding: 8px 16px; }
    .search-section-title { font-size: 13px; padding: 10px 16px; }
    .search-track-item, .search-author-item { padding: 12px 16px; gap: 14px; }
    .search-track-avatar { width: 48px; height: 48px; }
    .search-track-title { font-size: 15px; }
    .search-track-meta { font-size: 13px; gap: 16px; }
    .top-bar .balance-widget { display: none; }
    .notifications-popup { position: fixed; top: 64px; left: 12px; right: 12px; width: auto; max-height: calc(100vh - 80px); }
    body.player-active .notifications-popup { max-height: calc(100vh - 190px); }
    .notif-toasts { right: 12px; left: 12px; width: auto; top: calc(12px + env(safe-area-inset-top)); }
    .avatar-dropdown { right: -10px; }
}

.balance-widget .btn-sm {
    text-decoration: none;
}

/* Иконка верификации для авторов в поиске (хедере) – синий круг + белая галочка */
.header-artist-verified,
.header-author-verified {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
}
.header-artist-verified {
    margin-left: 4px;
}
.header-author-verified {
    margin-left: 0px;
}
.header-artist-verified .fa-circle,
.header-author-verified .fa-circle {
    color: #1d9bf0 !important;
}
.header-artist-verified .check-mark,
.header-author-verified .check-mark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.55em;
    color: #ffffff !important;
}