﻿/* =====================================================
   Notacross — Панель шрифтов
   Стиль в духе q-login / hv-stickers (nota v3.2): стекло, blur, тема форума
   ===================================================== */
.font-global-overlay {
    position: absolute;
    z-index: 999999 !important;
    display: none;
    flex-direction: column;
    padding: 12px 12px 8px;
    background: rgb(var(--pun), .92);
    border: 1px solid rgb(var(--text), .10);
    border-radius: 14px;
    box-shadow: 0 5px 24px rgba(0, 0, 0, .28), 0 1px 0 rgb(var(--text), .05) inset;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    box-sizing: border-box;
    font-family: var(--font5);
    color: rgb(var(--text));
    margin-top: 30px;
    height: 160px;
    opacity: 0;
    transform: translateY(8px) scale(.98);
    pointer-events: none;
    transition: opacity .25s ease, transform .25s ease;
}

.font-global-overlay.panel-active {
    display: flex;
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Кнопка закрытия */
.font-overlay-close {
    position: absolute;
    top: 6px;
    right: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    color: rgb(var(--text), .5);
    transition: color .18s ease;
    user-select: none;
    z-index: 10;
}
.font-overlay-close:hover {
    color: rgb(var(--text));
}

/* Панель вкладок: категории и фильтр внутри в одну строку */
.font-tabs-nav {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    border-top: 1px solid rgb(var(--text), .08);
    padding-top: 8px;
    margin-top: auto;
    box-sizing: border-box;

    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.font-tabs-nav::-webkit-scrollbar {
    display: none;
}

/* Контейнер вкладок категорий, чтобы не сжимался */
.font-tabs-categories {
    display: flex;
    flex-direction: row;
    gap: 6px;
    flex-shrink: 0;
}

/* Вкладка категории */
.font-spoiler-head {
    background: rgb(var(--text), .06);
    border: 1px solid transparent;
    padding: 6px 12px;
    font-size: 11px;
    font-family: var(--font5);
    font-weight: bold;
    color: rgb(var(--text), .7);
    cursor: pointer;
    border-radius: 20px;
    transition: background .18s ease, color .18s ease;
    box-sizing: border-box;
    white-space: nowrap;
    flex-shrink: 0;
}

.font-spoiler-head:hover {
    background: rgb(var(--text), .10);
    color: rgb(var(--text));
}
.font-spoiler-head.active {
    background: rgb(var(--acc8), .5);
    color: #fff;
}

/* Внутренние фильтры: только для активной категории */
.font-inner-filters {
    display: none;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    border-left: 1px dashed rgb(var(--text), .15);
    padding-left: 8px;
    flex-shrink: 0;
}

.font-inner-filters.visible {
    display: flex;
}

.font-filter-btn {
    font-size: 10px;
    font-family: var(--font5);
    font-weight: bold;
    color: rgb(var(--text), .7);
    cursor: pointer;
    padding: 3px 9px;
    background: rgb(var(--text), .04);
    border: 1px solid rgb(var(--text), .10);
    border-radius: 20px;
    transition: background .18s ease, color .18s ease;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    white-space: nowrap;
    flex-shrink: 0;
}

.font-filter-btn:hover {
    background: rgb(var(--text), .10);
    color: rgb(var(--text));
}
.font-filter-btn.active {
    background: rgb(var(--acc8), .5);
    color: #fff;
    border-color: transparent;
}

/* Зона прокрутки содержимого текущей вкладки */
.font-tabs-content {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    max-height: 110px;
    padding-right: 2px;
    scrollbar-width: thin;
    scrollbar-color: rgb(var(--text), .2) transparent;
}
.font-tabs-content::-webkit-scrollbar {
    width: 4px;
}
.font-tabs-content::-webkit-scrollbar-thumb {
    background: rgb(var(--text), .2);
    border-radius: 4px;
}

.font-spoiler-body {
    display: none;
    flex-direction: column;
    gap: 6px;
    padding: 2px 2px 4px 2px;
}
.font-spoiler-body.visible {
    display: flex !important;
}

/* Сетка карточек шрифтов (130px) */
.font-grid-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 4px;
    width: 100%;
}

/* Карточка одного шрифта */
.font-inline-item {
    background: rgb(var(--text), .04);
    border: 1px solid rgb(var(--text), .08);
    border-radius: 8px;
    height: 24px;
    padding: 0 6px !important;
    cursor: pointer;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative !important;
    transition: background .15s ease, border-color .15s ease, transform .1s ease, opacity .2s ease;
}

.font-inline-item span {
    font-size: 11px;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    display: block;
    width: 100%;
    text-align: center;
    color: rgb(var(--text));
}

.font-inline-item:hover {
    background: rgb(var(--text), .10);
    border-color: rgb(var(--text), .18);
}

.font-inline-item.font-pressing {
    transform: scale(.96);
    background: rgb(var(--acc8), .5) !important;
    border-color: transparent !important;
    opacity: .8;
}

.font-inline-item.font-just-added {
    background: rgb(var(--acc8), .5) !important;
    border-color: transparent !important;
}
.font-inline-item.font-just-added span {
    color: #fff !important;
}

.font-inline-item.font-just-removed {
    opacity: 0;
    transform: scale(.8);
    background: rgb(var(--acc8), .5) !important;
    border-color: transparent !important;
}
.font-inline-item.font-just-removed span {
    color: #fff !important;
}

.font-inline-item.in-favorites {
    border-color: rgb(var(--acc8), .6);
}

/* Пояснительная плашка на вкладке избранного */
.font-fav-notice {
    grid-column: 1 / -1;
    font-size: 10px;
    color: rgb(var(--text), .4);
    text-align: center;
    padding: 2px 0 6px 0;
    font-style: italic;
    pointer-events: none;
    width: 100%;
}

.font-fav-empty-notice {
    grid-column: 1 / -1;
    font-size: 11px;
    line-height: 1.5;
    color: rgb(var(--text), .5);
    text-align: center;
    padding: 15px 10px;
    box-sizing: border-box;
    width: 100%;
    pointer-events: none;
}

.font-fav-empty-notice strong {
    color: rgb(var(--text), .9);
}

.font-inline-item.hidden {
    display: none !important;
}

/* Мобильная адаптация: закрепление снизу */
@media screen and (max-width: 768px) {
    .font-global-overlay {
        position: fixed !important;
        left: 10px !important;
        right: 10px !important;
        width: calc(100% - 20px) !important;
        bottom: 20px !important;
        top: auto !important;
        height: 180px;
        box-shadow: 0 -2px 20px rgba(0, 0, 0, .3);
    }

    .font-tabs-content {
        max-height: 115px;
    }

    .font-grid-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .font-inline-item {
        height: 30px;
    }

    .font-tabs-nav {
        padding-bottom: 4px;
    }
}
