:root {
--bg-color: #0B0C0F;
--primary-text-color: rgba(250, 250, 252, 0.92);
--secondary-text-color: rgba(235, 235, 245, 0.6);
--description-color: rgba(235, 235, 245, 0.48);
--accent: #9B87F5;
--accent-2: #A78BFA;
--glass-fill: hsla(0, 0%, 100%, 0.08);
--glass-stroke: hsla(0, 0%, 100%, 0.16);
--glass-shadow: 0 10px 35px rgba(0,0,0,0.45);
--blur: 20px;
--surface-color: var(--glass-fill);
--tag-bg-color: hsla(0, 0%, 100%, 0.06);
--border-color: var(--glass-stroke);
--hover-bg: hsla(0, 0%, 100%, 0.08);
--active-nav-bg: hsla(0, 0%, 100%, 0.1);
--active-nav-icon: #D7D1FF;
--radius-lg: 20px;
--radius-md: 14px;
--radius-sm: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body {
display: flex;
font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Roboto", "Segoe UI", system-ui, Arial, sans-serif;
color: var(--primary-text-color);
background-color: var(--bg-color);
position: relative;
}
body::before {
content: "";
position: fixed;
inset: -20% -10% -10% -10%;
z-index: -2;
background:
radial-gradient(900px 700px at 0% -10%, rgba(99,102,241,0.22), transparent 60%),
radial-gradient(800px 600px at 100% 10%, rgba(236,72,153,0.18), transparent 65%),
radial-gradient(700px 500px at 30% 100%, rgba(34,197,94,0.14), transparent 60%),
linear-gradient(180deg, #0B0C0F 0%, #0B0C0F 100%);
filter: saturate(130%);
}
body::after {
content: "";
position: fixed;
inset: 0;
pointer-events: none;
z-index: -1;
background-image:
radial-gradient(circle at 20% 20%, rgba(255,255,255,0.04) 0, transparent 40%),
radial-gradient(circle at 80% 80%, rgba(255,255,255,0.03) 0, transparent 40%);
}

.app-container { display: flex; width: 100%; height: 100%; }
.main-content { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; }

.top-panel-container {
    position: sticky;
    top: 0;
    z-index: 10;
    background: transparent;
    backdrop-filter: blur(calc(var(--blur) * 0.4));
    -webkit-backdrop-filter: blur(calc(var(--blur) * 0.4));
}

header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 12px;
    margin: 10px 12px 8px;
    border-radius: var(--radius-lg);
    background: var(--glass-fill);
    border: 1px solid var(--glass-stroke);
    box-shadow: var(--glass-shadow);
    transition: background 0.2s ease; /* УБРАЛИ transition для margin-top */
}

.back-button {
background: none;
border: none;
padding: 0;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
width: 0;
opacity: 0;
margin-right: 0;
transition: width 0.3s ease, opacity 0.3s ease, margin-right 0.3s ease;
flex-shrink: 0;
}
.back-button.show { width: 24px; opacity: 1; margin-right: 12px; }
.back-button svg { width: 24px; height: 24px; fill: var(--secondary-text-color); }

.search-bar {
flex-grow: 1;
display: flex;
align-items: center;
gap: 8px;
background: hsla(0,0%,100%,0.06);
border: 1px solid var(--glass-stroke);
border-radius: 999px;
padding: 10px 14px;
transition: transform 0.3s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
backdrop-filter: blur(calc(var(--blur) * 0.7)) saturate(160%);
-webkit-backdrop-filter: blur(calc(var(--blur) * 0.7)) saturate(160%);
}
.search-bar:hover {
background: hsla(0,0%,100%,0.08);
}
.search-bar:focus-within {
border-color: hsla(0,0%,100%,0.22);
box-shadow: 0 6px 20px rgba(0,0,0,0.35), 0 0 0 4px color-mix(in oklab, var(--accent) 30%, transparent);
}
.search-bar svg { width: 20px; height: 20px; fill: var(--secondary-text-color); }
.search-bar input {
background: none; border: none; outline: none;
color: var(--primary-text-color); font-size: 16px; width: 100%;
}
.search-bar input::placeholder { color: var(--secondary-text-color); }

.header-icons { display: flex; gap: 10px; }
.icon-button {
background: hsla(0,0%,100%,0.04);
border: 1px solid hsla(0,0%,100%,0.12);
padding: 8px;
cursor: pointer;
border-radius: 12px;
display: flex; align-items: center; justify-content: center;
transition: background-color 0.2s, transform 0.1s, border-color 0.2s;
backdrop-filter: blur(calc(var(--blur) * 0.5));
-webkit-backdrop-filter: blur(calc(var(--blur) * 0.5));
}
.icon-button:hover { background-color: hsla(0,0%,100%,0.08); border-color: hsla(0,0%,100%,0.18); }
.icon-button:active { transform: scale(0.96); }
.icon-button svg {
width: 22px; height: 22px; fill: var(--secondary-text-color);
transition: fill 0.2s;
}
.icon-button:hover svg { fill: var(--primary-text-color); }

.main-tabs {
position: relative;
overflow-x: auto; scrollbar-width: none;
background: transparent;
margin: 0 12px 10px;
border-radius: var(--radius-md);
border: 1px solid var(--glass-stroke);
background: hsla(0,0%,100%,0.06);
box-shadow: var(--glass-shadow);
transition: opacity 0.3s ease, transform 0.3s ease;
backdrop-filter: blur(calc(var(--blur) * 0.6)) saturate(140%);
-webkit-backdrop-filter: blur(calc(var(--blur) * 0.6)) saturate(140%);
}
.main-tabs.hidden {
opacity: 0;
transform: translateY(-20px);
pointer-events: none;
height: 0; overflow: hidden;
}
.main-tabs::-webkit-scrollbar { display: none; }
.tabs-container {
display: flex; gap: 6px;
padding: 6px;
position: relative;
}
.main-tabs a {
text-decoration: none;
color: var(--secondary-text-color);
font-size: 14px;
font-weight: 600;
padding: 10px 12px;
position: relative;
white-space: nowrap;
border-radius: 999px;
z-index: 1;
transition: color 0.2s ease;
}
.main-tabs a.active { color: var(--primary-text-color); }
.main-tabs a:not(.active):hover { color: #d1d1d6; }

.active-line {
position: absolute;
top: 6px;
height: 36px;
background: linear-gradient(180deg, hsla(0,0%,100%,0.16), hsla(0,0%,100%,0.08));
border: 1px solid var(--glass-stroke);
border-radius: 999px;
box-shadow: 0 6px 18px rgba(0,0,0,0.35),
inset 0 1px 0 hsla(0,0%,100%,0.25);
z-index: 0;
transition: transform 0.3s ease, width 0.3s ease;
}

main { flex-grow: 1; overflow: hidden; }
.swiper, .swiper-wrapper, .swiper-slide { height: 100%; }
.swiper-slide {
overflow-y: auto;
scrollbar-width: none;
padding-bottom: 20px;
}
.swiper-slide::-webkit-scrollbar { display: none; }

.anime-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 12px;
    padding-bottom: 20px;
}

.anime-card {
display: flex; gap: 14px; text-decoration: none; color: inherit;
background: hsla(0,0%,100%,0.06);
border: 1px solid var(--glass-stroke);
border-radius: var(--radius-md);
padding: 10px;
transition: transform 0.18s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
backdrop-filter: blur(calc(var(--blur) * 0.35)) saturate(140%);
-webkit-backdrop-filter: blur(calc(var(--blur) * 0.35)) saturate(140%);
box-shadow: 0 10px 28px rgba(0,0,0,0.35);
}
.anime-card:hover {
transform: translateY(-2px);
background: hsla(0,0%,100%,0.08);
border-color: hsla(0,0%,100%,0.2);
box-shadow: 0 16px 36px rgba(0,0,0,0.45);
}

.anime-card .poster img {
width: 110px; height: 155px; object-fit: cover; border-radius: 10px; flex-shrink: 0;
background-color: hsla(0,0%,100%,0.08);
box-shadow: 0 6px 18px rgba(0,0,0,0.35);
}

.anime-card .info { display: flex; flex-direction: column; gap: 8px; flex-grow: 1; overflow: hidden; }

.title-row {
display: flex; justify-content: space-between; align-items: flex-start; gap: 8px;
}
.title-row h3 {
font-size: 18px; font-weight: 700; line-height: 1.25; color: var(--primary-text-color);
display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.title-row .more-icon {
flex-shrink: 0; width: 24px; height: 24px; fill: var(--secondary-text-color);
cursor: pointer; transition: transform 0.15s ease, fill 0.2s ease;
}
.title-row .more-icon:hover { transform: scale(1.08); fill: var(--primary-text-color); }

.info .meta { font-size: 14px; color: var(--secondary-text-color); }
.info .meta .star { color: var(--secondary-text-color); font-weight: 700; }

.info .tag {
background-color: var(--tag-bg-color);
color: var(--secondary-text-color);
padding: 5px 9px; border-radius: 999px; font-size: 12px; align-self: flex-start;
border: 1px solid hsla(0,0%,100%,0.12);
backdrop-filter: blur(6px);
-webkit-backdrop-filter: blur(6px);
}

.info .description {
font-size: 13px; color: var(--description-color); line-height: 1.45;
display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}

.loader-initial, .loader-infinite {
text-align: center; padding: 40px; font-size: 16px; color: var(--secondary-text-color);
}
.loader-infinite { padding: 18px; }

.bottom-nav {
    position: fixed;
    bottom: 12px;
    left: 12px;
    right: 12px;
    display: flex;
    justify-content: space-around;
    padding: 8px 8px 10px;
    border-radius: 20px;
    border: 1px solid var(--glass-stroke);
    box-shadow: 0 8px 24px rgba(0,0,0,0.5),
                inset 0 1px 0 hsla(0,0%,100%,0.15);
    z-index: 20;
    /* Создаем собственный фон с цветными огнями как у страницы */
    background:
        radial-gradient(circle at 10% 20%, rgba(99,102,241,0.15), transparent 50%),
        radial-gradient(circle at 90% 60%, rgba(236,72,153,0.12), transparent 55%),
        radial-gradient(circle at 50% 100%, rgba(34,197,94,0.1), transparent 45%),
        #0B0C0F; /* Основной темный фон */
}

.bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    color: var(--secondary-text-color);
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 12px;
    position: relative;
    transition: color 0.2s, background 0.2s, transform 0.12s ease;
}

.bottom-nav a:hover {
    background: hsla(0,0%,100%,0.06);
}

.bottom-nav a:active {
    transform: scale(0.98);
}

.bottom-nav svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.bottom-nav a.active {
    color: var(--active-nav-icon);
    background: var(--active-nav-bg);
}

.bottom-nav a.active::before {
    display: none;
}
.sidebar {
display: none;
}
@media (min-width: 768px) and (hover: hover) and (pointer: fine) {
    .sidebar {
        border-top-right-radius: 40px;
        border-bottom-right-radius: 30px;
    }
}

@media (max-width: 380px) {
.anime-card .poster img { width: 100px; height: 141px; }
.title-row h3 { font-size: 16px; -webkit-line-clamp: 2; }
.info .meta { font-size: 13px; }
.info .description { font-size: 12px; line-height: 1.35; -webkit-line-clamp: 3; }
.info .tag { font-size: 12px; padding: 4px 8px; }
}
/* Адаптивные отступы под разные размеры экрана */
@media (max-width: 400px) {
    /* Маленькие телефоны */
    .swiper-slide { padding-bottom: 110px !important; }
    .anime-grid { padding-bottom: 58px !important; }
}

@media (min-width: 401px) and (max-width: 767px) {
    /* Средние телефоны */
    .swiper-slide { padding-bottom: 120px !important; }
    .anime-grid { padding-bottom: 68px !important; }
}

@media (min-width: 768px) and (max-width: 959px) and (hover: none) {
    /* Телефоны в landscape */
    .swiper-slide { padding-bottom: 130px !important; }
    .anime-grid { padding-bottom: 78px !important; }
}
@media (min-width: 768px) and (hover: hover) and (pointer: fine) {
.app-container { flex-direction: row; }
.bottom-nav { display: none; }

.sidebar {
display: flex; flex-direction: column; justify-content: center; flex-shrink: 0;
width: 96px; border-right: 1px solid var(--glass-stroke);
height: 100%; align-items: center; gap: 10px;
background: hsla(0,0%,100%,0.04);
backdrop-filter: blur(calc(var(--blur) * 0.4));
-webkit-backdrop-filter: blur(calc(var(--blur) * 0.4));
}
.sidebar a {
display: flex; flex-direction: column; align-items: center; gap: 6px;
font-size: 12px; width: 82px; padding: 10px 6px;
border-radius: 14px; color: var(--secondary-text-color); text-decoration: none;
transition: background 0.2s, color 0.2s, transform 0.12s ease;
}
.sidebar .icon-wrapper {
display: flex; align-items: center; justify-content: center;
width: 64px; height: 36px; border-radius: 16px;
background: hsla(0,0%,100%,0.06); border: 1px solid var(--glass-stroke);
transition: background-color 0.2s, border-color 0.2s;
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
}
.sidebar a svg { width: 22px; height: 22px; fill: currentColor; }
.sidebar a:hover .icon-wrapper { background-color: hsla(0,0%,100%,0.1); border-color: hsla(0,0%,100%,0.2); }
.sidebar a.active { color: var(--active-nav-icon); }
.sidebar a.active .icon-wrapper { background-color: var(--active-nav-bg); }

.tabs-container { justify-content: center; }

.anime-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
gap: 18px;
padding-bottom: 20px;
align-content: start;
}
.anime-card {
flex-direction: column; gap: 10px; padding: 12px;
border-radius: 16px;
}
.anime-card .poster img { width: 100%; height: auto; aspect-ratio: 2 / 3; border-radius: 14px; }
.anime-card .info { gap: 4px; }
.title-row h3 { font-size: 15px; line-height: 1.25; -webkit-line-clamp: 2; }
.info .meta { font-size: 12.5px; }
.title-row .more-icon, .info .description, .info .tag { display: none; }
}

.header-icons .settings-button,
.header-icons .notifications-button {
transition: opacity 0.3s ease, width 0.3s ease;
}
.header-icons.search-mode .settings-button,
.header-icons.search-mode .notifications-button {
opacity: 0; width: 0; pointer-events: none; overflow: hidden;
}

@media (min-width: 768px) and (hover: hover) and (pointer: fine) {
    @supports not ((-webkit-backdrop-filter: blur(10px)) or (backdrop-filter: blur(10px))) {
        header, .main-tabs, .search-bar, .icon-button, .anime-card, .sidebar .icon-wrapper, .sidebar {
            background: rgba(255,255,255,0.06);
        }
    }
}
/* === Модальное окно настроек === */
.settings-modal {
    position: fixed;
    inset: 0;
    z-index: 10001;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.settings-modal.active {
    display: flex;
    opacity: 1;
}

.settings-modal-content {
    background: var(--glass-fill);
    border: 1px solid var(--glass-stroke);
    border-radius: 20px;
    max-width: 600px;
    width: 100%;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.settings-main-screen,
.settings-appearance-screen {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--glass-stroke);
    position: relative;
}

.settings-back,
.settings-close {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--primary-text-color);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.settings-back:hover,
.settings-close:hover {
    color: var(--secondary-text-color);
}

.settings-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-text-color);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.settings-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.settings-body::-webkit-scrollbar {
    width: 8px;
}

.settings-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.settings-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.settings-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.settings-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: transparent;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s ease;
    text-align: left;
    width: 100%;
}

.settings-item:hover {
    background: var(--hover-bg);
}

.settings-item-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--tag-bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.settings-item-icon svg {
    width: 22px;
    height: 22px;
    color: var(--primary-text-color);
}

.settings-item-content {
    flex: 1;
}

.settings-item-title {
    font-size: 1rem;
    font-weight: 500;
    color: var(--primary-text-color);
    margin-bottom: 2px;
}

.settings-item-subtitle {
    font-size: 0.875rem;
    color: var(--secondary-text-color);
}

.settings-item-arrow {
    color: var(--secondary-text-color);
    flex-shrink: 0;
}

/* Секция настроек */
.settings-section {
    margin-bottom: 32px;
}

.settings-section-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--secondary-text-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
}

/* Опции тем */
.theme-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
}

.theme-option {
    background: transparent;
    border: 2px solid var(--glass-stroke);
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.theme-option:hover {
    border-color: hsla(0, 0%, 100%, 0.25);
    transform: translateY(-2px);
}

.theme-option.active {
    border-color: var(--accent);
}

.theme-preview {
    width: 100%;
    aspect-ratio: 16 / 10;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
}

.theme-preview-header {
    height: 20%;
    border-bottom: 1px solid;
}

.theme-preview-content {
    flex: 1;
    padding: 8px;
    display: flex;
    gap: 6px;
}

.theme-preview-card {
    flex: 1;
    border-radius: 4px;
}

/* Превью темной темы */
.theme-preview-dark {
    background: #1a1a1a;
}

.theme-preview-dark .theme-preview-header {
    background: #2a2a2a;
    border-color: #3a3a3a;
}

.theme-preview-dark .theme-preview-card {
    background: #2a2a2a;
}

/* Превью светлой темы */
.theme-preview-light {
    background: #f5f5f5;
}

.theme-preview-light .theme-preview-header {
    background: #ffffff;
    border-color: #e0e0e0;
}

.theme-preview-light .theme-preview-card {
    background: #ffffff;
}

/* Превью стеклянной темы */
.theme-preview-glass {
    background: linear-gradient(135deg, rgba(99,102,241,0.2), rgba(236,72,153,0.15));
}

.theme-preview-glass .theme-preview-header {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
}

.theme-preview-glass .theme-preview-card {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.theme-option-name {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--primary-text-color);
    text-align: center;
    margin-bottom: 8px;
}

.theme-check {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent);
    display: none;
    align-items: center;
    justify-content: center;
}

.theme-check svg {
    color: white;
}

.theme-option.active .theme-check {
    display: flex;
}

/* Модальное окно предупреждения */
.glass-warning-modal {
    position: fixed;
    inset: 0;
    z-index: 10002;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.glass-warning-modal.active {
    display: flex;
    opacity: 1;
}

.glass-warning-content {
    background: var(--glass-fill);
    border: 1px solid var(--glass-stroke);
    border-radius: 20px;
    padding: 32px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.glass-warning-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    color: #FFA726;
}

.glass-warning-icon svg {
    width: 100%;
    height: 100%;
}

.glass-warning-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-text-color);
    margin-bottom: 12px;
}

.glass-warning-text {
    font-size: 0.9375rem;
    color: var(--secondary-text-color);
    line-height: 1.5;
    margin-bottom: 24px;
}

.glass-warning-btn {
    width: 100%;
    padding: 12px 24px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.glass-warning-btn:hover {
    background: var(--accent-2);
    transform: translateY(-2px);
}

@media (max-width: 767px) {
    .settings-modal,
    .glass-warning-modal {
        padding: 0;
    }
    
    .settings-modal-content {
        max-width: 100%;
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    
    .theme-options {
        grid-template-columns: 1fr;
    }
    
    .glass-warning-content {
        margin: 20px;
    }
}

/* === Темы === */
/* Темная тема */
body[data-theme="dark"] {
    --bg-color: #0f0f0f;
    --primary-text-color: rgba(255, 255, 255, 0.95);
    --secondary-text-color: rgba(255, 255, 255, 0.6);
    --description-color: rgba(255, 255, 255, 0.45);
    --glass-fill: rgba(30, 30, 30, 0.95);
    --glass-stroke: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    --tag-bg-color: rgba(255, 255, 255, 0.08);
    --hover-bg: rgba(255, 255, 255, 0.1);
    --active-nav-bg: rgba(255, 255, 255, 0.15);
}

body[data-theme="dark"]::before {
    background: linear-gradient(180deg, #0f0f0f 0%, #0f0f0f 100%);
    filter: none;
}

body[data-theme="dark"]::after {
    display: none;
}

body[data-theme="dark"] .anime-card,
body[data-theme="dark"] header,
body[data-theme="dark"] .main-tabs,
body[data-theme="dark"] .search-bar,
body[data-theme="dark"] .icon-button,
body[data-theme="dark"] .sidebar .icon-wrapper,
body[data-theme="dark"] .sidebar,
body[data-theme="dark"] .bottom-nav {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

/* Светлая тема */
body[data-theme="light"] {
    --bg-color: #f5f5f5;
    --primary-text-color: rgba(0, 0, 0, 0.9);
    --secondary-text-color: rgba(0, 0, 0, 0.6);
    --description-color: rgba(0, 0, 0, 0.5);
    --glass-fill: rgba(255, 255, 255, 0.95);
    --glass-stroke: rgba(0, 0, 0, 0.1);
    --glass-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    --tag-bg-color: rgba(0, 0, 0, 0.05);
    --hover-bg: rgba(0, 0, 0, 0.05);
    --active-nav-bg: rgba(0, 0, 0, 0.1);
    --active-nav-icon: #6366f1;
}

body[data-theme="light"]::before {
    background: linear-gradient(180deg, #f5f5f5 0%, #e8e8e8 100%);
    filter: none;
}

body[data-theme="light"]::after {
    display: none;
}

body[data-theme="light"] .anime-card,
body[data-theme="light"] header,
body[data-theme="light"] .main-tabs,
body[data-theme="light"] .search-bar,
body[data-theme="light"] .icon-button,
body[data-theme="light"] .sidebar .icon-wrapper,
body[data-theme="light"] .sidebar,
body[data-theme="light"] .bottom-nav {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

body[data-theme="light"] .bottom-nav {
    background: rgba(255, 255, 255, 0.95);
}

body[data-theme="light"] .sidebar {
    background: rgba(255, 255, 255, 0.95);
}
/* Темная тема */
body[data-theme="dark"] {
    --bg-color: #0f0f0f;
    --primary-text-color: rgba(255, 255, 255, 0.95);
    --secondary-text-color: rgba(255, 255, 255, 0.6);
    --description-color: rgba(255, 255, 255, 0.45);
    --glass-fill: rgba(30, 30, 30, 0.95);
    --glass-stroke: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    --tag-bg-color: rgba(255, 255, 255, 0.08);
    --hover-bg: rgba(255, 255, 255, 0.1);
    --active-nav-bg: rgba(255, 255, 255, 0.15);
}

body[data-theme="dark"]::before {
    background: linear-gradient(180deg, #0f0f0f 0%, #0f0f0f 100%);
    filter: none;
}

body[data-theme="dark"]::after {
    display: none;
}

body[data-theme="dark"] .anime-card,
body[data-theme="dark"] header,
body[data-theme="dark"] .main-tabs,
body[data-theme="dark"] .search-bar,
body[data-theme="dark"] .icon-button,
body[data-theme="dark"] .sidebar .icon-wrapper,
body[data-theme="dark"] .sidebar,
body[data-theme="dark"] .bottom-nav {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

/* Добавляем это для bottom-nav в темной теме */
body[data-theme="dark"] .bottom-nav {
    background: rgba(30, 30, 30, 0.95);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

body[data-theme="dark"] .sidebar {
    background: rgba(30, 30, 30, 0.95);
}
/* ===================================== */
/* === МОДАЛЬНОЕ ОКНО ФИЛЬТРОВ === */
/* ===================================== */

.filter-modal {
    position: fixed;
    inset: 0;
    z-index: 10001;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.filter-modal.active {
    display: flex;
    opacity: 1;
}

/* Исправление структуры модального окна фильтров */
.filter-modal-content {
    background: var(--glass-fill);
    border: 1px solid var(--glass-stroke);
    border-radius: 20px;
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--glass-shadow);
}

/* Заголовок - фиксированный */
.filter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--glass-stroke);
    gap: 16px;
    flex-shrink: 0; /* Не сжимается */
}



.filter-close {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--primary-text-color);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
    flex-shrink: 0;
}

.filter-close:hover {
    color: var(--secondary-text-color);
}

.filter-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-text-color);
    margin: 0;
    flex: 1;
}

.filter-header-actions {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}

.filter-reset-btn,
.filter-apply-btn {
    padding: 8px 16px;
    border-radius: 12px;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.filter-reset-btn {
    background: var(--glass-fill);
    border: 1px solid var(--glass-stroke);
    color: var(--secondary-text-color);
}

.filter-reset-btn:hover {
    background: var(--hover-bg);
    color: var(--primary-text-color);
}

.filter-apply-btn {
    background: var(--accent);
    border: 1px solid var(--accent);
    color: white;
}

.filter-apply-btn:hover {
    background: var(--accent-2);
    transform: translateY(-1px);
}

.filter-tabs {
    display: flex;
    gap: 8px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--glass-stroke);
    overflow-x: auto;
    scrollbar-width: none;
    flex-shrink: 0; /* Не сжимается */
}

.filter-tabs::-webkit-scrollbar {
    display: none;
}

.filter-tab {
    flex: 1;
    min-width: fit-content;
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    background: transparent;
    border: 1px solid var(--glass-stroke);
    color: var(--secondary-text-color);
}

.filter-tab:hover {
    background: var(--hover-bg);
    border-color: hsla(0, 0%, 100%, 0.2);
}

.filter-tab.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.filter-body {
    flex: 1; /* Занимает оставшееся место */
    overflow-y: auto;
    padding: 20px;
    min-height: 0; /* Важно для работы flex */
}

.filter-body::-webkit-scrollbar {
    width: 8px;
}

.filter-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.filter-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.filter-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.filter-tab-content {
    display: none;
}

.filter-tab-content.active {
    display: block;
}

/* Секции фильтров */
.filter-section {
    margin-bottom: 16px;
}

.filter-section:last-child {
    margin-bottom: 0;
}

.filter-section-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 14px 16px;
    background: var(--glass-fill);
    border: 1px solid var(--glass-stroke);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1rem;
    font-weight: 500;
    color: var(--primary-text-color);
}

.filter-section-toggle:hover:not(:disabled) {
    background: var(--hover-bg);
    border-color: hsla(0, 0%, 100%, 0.2);
}

.filter-section-toggle .chevron {
    transition: transform 0.3s ease;
    stroke: var(--secondary-text-color);
}

.filter-section-toggle.active .chevron {
    transform: rotate(180deg);
}

.filter-section-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.1s ease;
    padding: 0 16px;
}

.filter-section-content.open {
    max-height: 2000px;
    padding: 16px;
}

/* Чекбоксы */
.filter-checkbox {
    display: flex;
    align-items: center;
    padding: 10px 0;
    cursor: pointer;
    user-select: none;
    position: relative;
}

.filter-checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.filter-checkbox .checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid var(--glass-stroke);
    border-radius: 6px;
    margin-right: 12px;
    flex-shrink: 0;
    position: relative;
    transition: all 0.2s ease;
    display: flex; /* Добавлено */
    align-items: center; /* Добавлено */
    justify-content: center; /* Добавлено */
}

.filter-checkbox:hover .checkmark {
    border-color: hsla(0, 0%, 100%, 0.3);
}

.filter-checkbox input[type="checkbox"]:checked ~ .checkmark {
    background: var(--accent);
    border-color: var(--accent);
}

.filter-checkbox input[type="checkbox"]:checked ~ .checkmark::after {
    content: '';
    position: absolute;
    left: 50%; /* Центрируем по горизонтали */
    top: 50%; /* Центрируем по вертикали */
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: translate(-50%, -60%) rotate(45deg); /* Центрирование + поворот */
}

.filter-checkbox .label-text {
    font-size: 0.9375rem;
    color: var(--primary-text-color);
    line-height: 1.4;
}

/* Радиокнопки */
.filter-radio {
    display: flex;
    align-items: center;
    padding: 10px 0;
    cursor: pointer;
    user-select: none;
    position: relative;
}

.filter-radio input[type="radio"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.filter-radio .radiomark {
    width: 20px;
    height: 20px;
    border: 2px solid var(--glass-stroke);
    border-radius: 50%;
    margin-right: 12px;
    flex-shrink: 0;
    position: relative;
    transition: all 0.2s ease;
}

.filter-radio:hover .radiomark {
    border-color: hsla(0, 0%, 100%, 0.3);
}

.filter-radio input[type="radio"]:checked ~ .radiomark {
    border-color: var(--accent);
}

.filter-radio input[type="radio"]:checked ~ .radiomark::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
}

.filter-radio .label-text {
    font-size: 0.9375rem;
    color: var(--primary-text-color);
    line-height: 1.4;
}

/* Текстовые поля */
.filter-text-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--glass-fill);
    border: 1px solid var(--glass-stroke);
    border-radius: 12px;
    font-size: 0.9375rem;
    color: var(--primary-text-color);
    outline: none;
    transition: all 0.2s ease;
}

.filter-text-input::placeholder {
    color: var(--secondary-text-color);
}

.filter-text-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px color-mix(in oklab, var(--accent) 20%, transparent);
}

/* Диапазон (годы) */
.filter-range {
    display: flex;
    gap: 12px;
}

.filter-input-group {
    flex: 1;
}

.filter-input-group label {
    display: block;
    font-size: 0.875rem;
    color: var(--secondary-text-color);
    margin-bottom: 8px;
}

.filter-input-group input[type="number"] {
    width: 100%;
    padding: 12px 16px;
    background: var(--glass-fill);
    border: 1px solid var(--glass-stroke);
    border-radius: 12px;
    font-size: 0.9375rem;
    color: var(--primary-text-color);
    outline: none;
    transition: all 0.2s ease;
}

.filter-input-group input[type="number"]::placeholder {
    color: var(--secondary-text-color);
}

.filter-input-group input[type="number"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px color-mix(in oklab, var(--accent) 20%, transparent);
}

/* Переключатель режима исключения жанров */
.filter-mode-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--glass-fill);
    border: 1px solid var(--glass-stroke);
    border-radius: 12px;
    margin-bottom: 16px;
}

.filter-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 28px;
    flex-shrink: 0;
}

.filter-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.filter-switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--glass-fill);
    border: 2px solid var(--glass-stroke);
    transition: all 0.3s ease;
    border-radius: 28px;
}

.filter-switch .slider::before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background-color: var(--secondary-text-color);
    transition: all 0.3s ease;
    border-radius: 50%;
}

.filter-switch input:checked + .slider {
    background-color: var(--accent);
    border-color: var(--accent);
}

.filter-switch input:checked + .slider::before {
    transform: translateX(20px);
    background-color: white;
}

.mode-label {
    font-size: 0.9375rem;
    color: var(--primary-text-color);
    line-height: 1.4;
}

/* Заглушка "Скоро" */
.filter-section-disabled {
    opacity: 0.5;
    pointer-events: none;
    position: relative;
    z-index: 1; /* Низкий z-index */
}
.filter-section:has(.custom-studio-select) {
    position: relative;
    z-index: 10000; /* Высокий z-index когда селект открыт */
}

.coming-soon-badge {
    font-size: 0.75rem;
    padding: 4px 10px;
    background: var(--accent);
    color: white;
    border-radius: 12px;
    font-weight: 600;
}

/* Адаптив */
@media (max-width: 767px) {
    .filter-modal {
        padding: 0;
    }
    
    .filter-modal-content {
        max-width: 100%;
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    
    .filter-header {
        padding: 12px 16px;
    }
    
    .filter-title {
        font-size: 1.125rem;
    }
    
    .filter-header-actions {
        gap: 8px;
    }
    
    .filter-reset-btn,
    .filter-apply-btn {
        padding: 8px 14px;
        font-size: 0.875rem;
    }
    
    .filter-tabs {
        padding: 12px 16px;
        gap: 6px;
    }
    
    .filter-tab {
        font-size: 0.875rem;
        padding: 8px 12px;
    }
    
    .filter-body {
        padding: 16px;
    }
}

/* Поддержка тем */
body[data-theme="dark"] .filter-modal-content {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(30, 30, 30, 0.95);
}

body[data-theme="light"] .filter-modal-content {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(255, 255, 255, 0.95);
}

body[data-theme="light"] .filter-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
}

body[data-theme="light"] .filter-body::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
}

body[data-theme="light"] .filter-body::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}
/* Стили для выпадающего списка */
.filter-select {
    width: 100%;
    padding: 12px 16px;
    background: var(--glass-fill);
    border: 1px solid var(--glass-stroke);
    border-radius: 12px;
    font-size: 0.9375rem;
    color: var(--primary-text-color);
    outline: none;
    transition: all 0.2s ease;
    cursor: pointer;
    font-family: inherit;
}

.filter-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px color-mix(in oklab, var(--accent) 20%, transparent);
}

.filter-select option {
    background: var(--bg-color);
    color: var(--primary-text-color);
    padding: 8px;
}
/* === Кастомный селект студий === */
/* === Кастомный селект студий === */
.custom-studio-select {
    position: relative;
    width: 100%;
}

.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 16px;
    background: var(--glass-fill);
    border: 1px solid var(--glass-stroke);
    border-radius: 12px;
    font-size: 0.9375rem;
    color: var(--primary-text-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.custom-select-trigger:hover {
    background: var(--hover-bg);
    border-color: hsla(0, 0%, 100%, 0.2);
}

.custom-select-trigger .select-arrow {
    transition: transform 0.3s ease;
    stroke: var(--secondary-text-color);
    flex-shrink: 0;
}

.custom-select-dropdown.open ~ .custom-select-trigger .select-arrow {
    transform: rotate(180deg);
}

.custom-select-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--glass-fill);
    border: 1px solid var(--glass-stroke);
    border-radius: 12px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(calc(var(--blur) * 0.5));
    -webkit-backdrop-filter: blur(calc(var(--blur) * 0.5));
    box-shadow: var(--glass-shadow);
    z-index: 100000; /* Очень высокий z-index */
}

.custom-select-dropdown.open {
    max-height: 400px;
    opacity: 1;
    visibility: visible;
}

.studio-search-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border-bottom: 1px solid var(--glass-stroke);
    position: sticky;
    top: 0;
    background: var(--glass-fill);
    backdrop-filter: blur(calc(var(--blur) * 0.7));
    -webkit-backdrop-filter: blur(calc(var(--blur) * 0.7));
    z-index: 1;
}

.studio-search-wrapper .search-icon {
    width: 18px;
    height: 18px;
    fill: var(--secondary-text-color);
    flex-shrink: 0;
}

.studio-search {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--primary-text-color);
    font-size: 0.9375rem;
    font-family: inherit;
}

.studio-search::placeholder {
    color: var(--secondary-text-color);
}

.studio-list {
    max-height: 320px;
    overflow-y: auto;
    padding: 8px;
}

.studio-list::-webkit-scrollbar {
    width: 8px;
}

.studio-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.studio-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.studio-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.studio-option {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.9375rem;
    color: var(--primary-text-color);
    cursor: pointer;
    transition: background 0.2s ease;
}

.studio-option:hover {
    background: var(--hover-bg);
}

.studio-option:active {
    transform: scale(0.98);
}

/* Адаптив */
@media (max-width: 767px) {
    .custom-select-dropdown.open {
        max-height: 300px;
    }
    
    .studio-list {
        max-height: 220px;
    }
}

/* Поддержка тем */
body[data-theme="dark"] .custom-select-dropdown,
body[data-theme="dark"] .custom-select-trigger {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

body[data-theme="light"] .custom-select-dropdown,
body[data-theme="light"] .custom-select-trigger {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

body[data-theme="light"] .studio-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
}

body[data-theme="light"] .studio-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
}

body[data-theme="light"] .studio-list::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}
/* Исправляем позиционирование dropdown для студий */
.custom-select-dropdown {
    position: fixed; /* Было absolute, теперь fixed */
    top: auto;
    left: auto;
    right: auto;
    background: var(--glass-fill);
    border: 1px solid var(--glass-stroke);
    border-radius: 12px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(calc(var(--blur) * 0.5));
    -webkit-backdrop-filter: blur(calc(var(--blur) * 0.5));
    box-shadow: var(--glass-shadow);
    z-index: 100000;
    width: 300px; /* Фиксированная ширина */
}

.custom-select-dropdown.open {
    max-height: 400px;
    opacity: 1;
    visibility: visible;
}

/* Позиционирование dropdown под триггером */
.custom-studio-select {
    position: relative;
    width: 100%;
}

/* Обновленная логика открытия */
/* === Упрощенный список студий === */
.studio-search-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border-bottom: 1px solid var(--glass-stroke);
    position: sticky;
    top: 0;
    background: var(--glass-fill);
    backdrop-filter: blur(calc(var(--blur) * 0.7));
    -webkit-backdrop-filter: blur(calc(var(--blur) * 0.7));
    z-index: 1;
    margin: -16px -16px 0 -16px;
}

.studio-search-wrapper .search-icon {
    width: 18px;
    height: 18px;
    fill: var(--secondary-text-color);
    flex-shrink: 0;
}

.studio-search-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--primary-text-color);
    font-size: 0.9375rem;
    font-family: inherit;
}

.studio-search-input::placeholder {
    color: var(--secondary-text-color);
}

.studio-simple-list {
    max-height: 300px;
    overflow-y: auto;
    margin-top: 16px;
}

.studio-simple-list::-webkit-scrollbar {
    width: 8px;
}

.studio-simple-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.studio-simple-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.studio-simple-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.studio-item {
    display: flex;
    align-items: center;
    padding: 10px 0;
    cursor: pointer;
    user-select: none;
    position: relative;
}

/* Поддержка тем */
body[data-theme="light"] .studio-simple-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
}

body[data-theme="light"] .studio-simple-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
}

body[data-theme="light"] .studio-simple-list::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}
/* === ОБНОВЛЕННЫЕ ЗАГРУЗЧИКИ === */
.loader-initial, 
.loader-infinite {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

.loader-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--glass-stroke);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Сообщения об ошибках/пустых результатах */
.no-results-message {
    text-align: center;
    padding: 60px 20px;
    font-size: 16px;
    color: var(--secondary-text-color);
    line-height: 1.5;
}

/* Для мобильных уменьшаем размеры */
@media (max-width: 767px) {
    .loader-initial, 
    .loader-infinite {
        padding: 40px 20px;
    }
    
    .loader-spinner {
        width: 36px;
        height: 36px;
        border-width: 2px;
    }
    
    .no-results-message {
        padding: 40px 20px;
        font-size: 15px;
    }
}

/* Бесконечный загрузчик внизу списка */
.loader-infinite {
    padding: 24px 20px;
}

.loader-infinite .loader-spinner {
    width: 32px;
    height: 32px;
    border-width: 2px;
}
/* === ЦЕНТРИРОВАНИЕ ЗАГРУЗЧИКОВ И СООБЩЕНИЙ === */
.anime-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 12px;
    padding-bottom: 20px;
    min-height: 300px; /* Минимальная высота для центрирования */
}

/* Когда в grid только загрузчик или сообщение - центрируем */
.anime-grid:has(> .loader-initial:only-child),
.anime-grid:has(> .no-results-message:only-child) {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 200px); /* Высота экрана минус header и tabs */
}

/* Загрузчики */
.loader-initial {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    width: 100%;
}

.loader-infinite {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 20px;
    width: 100%;
}

.loader-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--glass-stroke);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Сообщения об ошибках/пустых результатах */
.no-results-message {
    text-align: center;
    padding: 60px 20px;
    font-size: 16px;
    color: var(--secondary-text-color);
    line-height: 1.5;
    width: 100%;
}

/* Для мобильных уменьшаем размеры */
@media (max-width: 767px) {
    .anime-grid:has(> .loader-initial:only-child),
    .anime-grid:has(> .no-results-message:only-child) {
        min-height: calc(100vh - 180px);
    }
    
    .loader-initial, 
    .loader-infinite {
        padding: 40px 20px;
    }
    
    .loader-spinner {
        width: 40px;
        height: 40px;
        border-width: 2.5px;
    }
    
    .no-results-message {
        padding: 40px 20px;
        font-size: 15px;
    }
}

/* Для десктопа с grid */
@media (min-width: 768px) and (hover: hover) and (pointer: fine) {
    .anime-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
        gap: 18px;
        padding-bottom: 20px;
        align-content: start;
    }
    
    /* Когда grid пустой или с одним элементом - делаем flex для центрирования */
    .anime-grid:has(> .loader-initial:only-child),
    .anime-grid:has(> .no-results-message:only-child) {
        display: flex !important;
        justify-content: center;
        align-items: center;
        min-height: calc(100vh - 200px);
    }
}

/* Бесконечный загрузчик всегда занимает всю ширину grid */
@media (min-width: 768px) and (hover: hover) and (pointer: fine) {
    .loader-infinite {
        grid-column: 1 / -1; /* Занимает все колонки */
    }
}
.loader-initial,
.loader-infinite {
    pointer-events: none !important;
}
.back-button,
.search-bar,
.main-tabs {
    pointer-events: auto;
}

.back-button:not(.show) {
    pointer-events: none;
}
