body {
    font-family: Outfit;
}
:root {
    --primary-color: #8A70FF;
    --primary-soft: #f0edff;
    --bg-body: #F6F7FB;
    --bg-surface: #FFFFFF;
    --bg-glass: rgba(255, 255, 255, 0.9);
    --text-main: #1A1D23;
    --text-muted: #7E8594;
    --border-color: #E2E8F0;
    --radius-lg: 20px;
    --radius-md: 10px;
}

body.anime-theme {
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    -webkit-font-smoothing: antialiased;
} 

/* Navbar Refactoring */
.app-navbar {
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 0;
    margin-bottom: 2rem;
}

.navbar-logo {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-text {
    font-weight: 700;
    font-size: 1.4rem;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

/* Clean Search Form */
.search-form-clean {
    background: #EDF2F7;
    border-radius: 12px;
    padding: 6px 15px;
    display: flex;
    align-items: center;
    min-width: 320px;
}

.search-form-clean input {
    background: transparent;
    border: none;
    width: 100%;
    outline: none;
    font-size: 0.9rem;
    color: var(--text-main);
}

.search-form-clean button {
    background: transparent;
    border: none;
    color: var(--text-muted);
}

/* Layout Grid */
.layout-grid {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 991px) {
    .layout-grid { grid-template-columns: 1fr; }
}

/* Sidebar - Flat Design */
.side-nav {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding: 0 10px;
}

.nav-group-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 800;
    color: var(--text-muted);
    letter-spacing: 0.1em;
    display: block;
    margin-bottom: 12px;
}

.nav-item {
    display: block;
    padding: 10px 15px;
    border-radius: 12px;
    color: var(--text-main);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-item:hover {
    background: var(--primary-soft);
    color: var(--primary-color);
}

.nav-item.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(138, 112, 255, 0.3);
}

.fav-badge {
    background: rgba(0,0,0,0.06);
    padding: 0 8px;
    border-radius: 8px;
    font-size: 0.75rem;
}

.nav-item-small {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
    display: block;
    padding: 5px 15px;
}

/* Page Surface */
.page-surface {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 2rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 20px rgba(0,0,0,0.02);
}

/* Footer Clean up */
.app-site-footer {
    margin-top: 4rem;
    background: #fff;
    border-top: 1px solid var(--border-color);
    padding: 3rem 0;
}

/* Mobile Menu Toggle */
.mobile-toggle {
    background: var(--primary-soft);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
}

/* Стили для хлебных крошек (crumbs.php) */
.anime-crumbs-wrapper {
    margin-bottom: 1.5rem;
}

.anime-breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.crumb-item {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 500;
}

.crumb-item:not(:last-child)::after {
    content: '';
    display: inline-block;
    width: 4px;
    height: 4px;
    background: var(--text-muted);
    border-radius: 50%;
    margin-left: 10px;
    opacity: 0.4;
}

.crumb-link {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
}

.crumb-link:hover {
    color: var(--primary-color);
}

.crumb-text {
    color: var(--text-main);
}

.crumb-item.is-active .crumb-text {
    font-weight: 600;
    color: var(--primary-color);
}

/* Устаревшие стили Bootstrap Breadcrumbs */
nav.crumbs, .breadcrumb-item {
    display: none !important;
}

/* Footer */
.app-footer {
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    padding-top: 2rem;
    padding-bottom: 2rem;
}

.app-footer a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.app-footer a:hover {
    color: var(--primary-color);
}
    color: var(--text-muted);
    text-decoration: none;
}

nav.crumbs .breadcrumb-item a:hover {
    color: var(--primary-color);
}

nav.crumbs .breadcrumb-item.active {
    color: var(--text-main);
}

.breadcrumb-item + .breadcrumb-item::before {
    content: var(--bs-breadcrumb-divider, "/"); /* Используем стандартный разделитель Bootstrap */
    color: var(--text-muted) !important;
}

/* General content elements within .serial-page, .person-page */
.serial-page h1, .person-page h1 {
    font-size: 2rem;
    color: var(--text-main);
    margin-bottom: 1.5rem;
}

.serial-page h2, .person-page h2 {
    font-size: 1.5rem;
    color: var(--text-main);
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.serial-page p, .person-page p {
    color: var(--text-main);
    line-height: 1.6;
    margin-bottom: 1rem;
}

/* Anime Card for listings (replaces serial-tile) */
.anime-card {
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    box-shadow: 0 4px 12px rgba(138, 112, 255, 0.05);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.anime-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(138, 112, 255, 0.1);
}

.anime-card-media {
    position: relative;
    overflow: hidden;
}

.anime-card-link {
    display: block;
}

.anime-card-img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    aspect-ratio: 2 / 3; /* Стандартное соотношение для постеров */
}

.anime-card-year, .anime-card-rating {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: var(--primary-color);
    color: white;
    padding: 4px 10px;
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.anime-card-rating {
    left: auto;
    right: 10px;
    background: #FFD700; /* Золотой цвет для рейтинга */
    color: var(--text-main);
}

.anime-card-body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.anime-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.2;
}

.anime-card-title a {
    color: var(--text-main);
    text-decoration: none;
}

.anime-card-title a:hover {
    color: var(--primary-color);
}

.anime-card-genre {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
    display: inline-block;
    margin-right: 0.5rem;
}

.anime-card-genre:hover {
    color: var(--primary-color);
}

/* Specific styles for serial/person pages (adapting from old style.css) */
.serial-hero {
    display: grid;
    grid-template-columns: minmax(200px, 300px) minmax(0, 1fr);
    gap: 1.5rem;
    align-items: flex-start;
}

.serial-hero-poster img {
    width: 100%;
    height: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 20px rgba(138, 112, 255, 0.1);
}

.serial-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.serial-meta-chip {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-body); /* Немного темнее фона, чтобы выделить */
    padding: 0.5rem 1rem;
    text-decoration: none;
    color: var(--text-main);
    gap: 1rem;
}

.serial-meta-chip span {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.serial-meta-chip strong {
    font-size: 1rem;
    font-weight: 600;
}

.serial-tag {
    text-decoration: none;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: rgba(138, 112, 255, 0.1); /* Легкий акцентный фон */
    color: var(--primary-color);
    padding: 0.3rem 0.8rem;
    font-size: 0.85rem;
    line-height: 1;
    transition: background-color 0.2s, color 0.2s;
}

.serial-tag:hover {
    background: var(--primary-color);
    color: white;
}

.serial-description p {
    color: var(--text-main);
}

.serial-facts dt {
    color: var(--text-muted);
}

.serial-facts dd {
    color: var(--text-main);
    font-weight: 500;
}

.serial-player-block .video-wrapper {
    background: #e0e6f0; /* Светлый фон для плеера */
}

/* Person Page specific styles */
.person-page {
    /* Основные стили уже определены выше, переопределяем специфичные */
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 15px rgba(138, 112, 255, 0.08);
    padding: 1.5rem;
}

.person-page::after {
    /* Убираем старый сложный фон, если он был */
    display: none;
}

.person-hero {
    grid-template-columns: minmax(180px, 250px) minmax(0, 1fr);
    gap: 1.5rem;
}

.person-photo-wrap {
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 20px rgba(138, 112, 255, 0.1);
    background: var(--bg-surface);
}

.person-accent {
    /* Убираем старый акцент, если он был */
    display: none;
}

.person-label {
    color: var(--text-muted);
    font-size: 0.7rem;
}

.person-title {
    color: var(--text-main);
    font-size: clamp(1.6rem, 2.5vw, 2.4rem);
}

.person-fact {
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-body); /* Немного темнее фона, чтобы выделить */
    padding: 0.7rem 1rem;
}

.person-key {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.person-val {
    color: var(--text-main);
    font-weight: 500;
}

.person-section {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(138, 112, 255, 0.05);
    padding: 1.2rem;
    border-radius: var(--radius-lg);
}

.person-section-title {
    color: var(--text-main);
    font-size: 1rem;
}

.person-section-line {
    background: linear-gradient(90deg, var(--primary-color), transparent);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  html {
    /* Increases the base font size by exactly 20% (16px * 1.2 = 19.2px) */
    font-size: 120%; 
  }
    .serial-hero {
        grid-template-columns: 1fr;
    }
    .person-hero {
        grid-template-columns: 1fr;
    }
    .person-photo-wrap {
        max-width: 200px;
        margin-left: auto;
        margin-right: auto;
    }
}

/* Стили для нового заголовка страницы (favs.php) */
.anime-header-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0 2rem 0;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
    gap: 1.5rem;
}

.header-main-title {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    letter-spacing: -0.03em;
    color: var(--text-main);
}

.header-intro-text {
    color: var(--text-muted);
    margin: 0;
    font-size: 1.05rem;
    max-width: 550px;
}

.anime-fav-button {
    background: var(--primary-color);
    color: #fff !important;
    padding: 14px 28px;
    border-radius: var(--radius-lg);
    text-decoration: none !important;
    font-weight: 700;
    display: flex;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    box-shadow: 0 8px 20px rgba(138, 112, 255, 0.2);
}

.anime-fav-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 25px rgba(138, 112, 255, 0.3);
    filter: brightness(1.1);
}

@media (max-width: 991px) {
    .anime-header-box {
        flex-direction: column;
        align-items: flex-start;
        padding-bottom: 1.5rem;
    }
    .header-action-side {
        width: 100%;
    }
    .anime-fav-button {
        width: 100%;
        justify-content: center;
    }
}

/* Anime List Section (replaces serial-list) */
.anime-list-section {
    margin-bottom: 3rem;
}

.anime-list-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.anime-list-title {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-main);
    margin: 0;
    white-space: nowrap; /* Предотвращаем перенос заголовка */
}

.anime-list-divider {
    flex-grow: 1;
    height: 2px;
    background: linear-gradient(to right, var(--primary-color), transparent);
    border-radius: 1px;
}

/* Anime Card (replaces serial-tile) - already defined, just adding fav button */
.anime-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
}

.anime-card-fav-btn {
    background: var(--primary-soft);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.anime-card-fav-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 10px rgba(138, 112, 255, 0.2);
}

.anime-card-fav-btn svg {
    width: 18px;
    height: 18px;
}

.anime-card-genres {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Ensure old serial-list styles are completely overridden or removed if they conflict */
.serial-list, .serial-tile, .serial-grid {
    ~display: none !important; /* Скрываем старые элементы, чтобы избежать конфликтов */
}

/* Anime List Section (replaces serial-list) */
.anime-list-section {
    margin-bottom: 3rem;
}

.anime-list-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.anime-list-title {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-main);
    margin: 0;
    white-space: nowrap; /* Предотвращаем перенос заголовка */
}

.anime-list-divider {
    flex-grow: 1;
    height: 2px;
    background: linear-gradient(to right, var(--primary-color), transparent);
    border-radius: 1px;
}

/* Anime Card (replaces serial-tile) - already defined, just adding fav button */
.anime-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
}

.anime-card-fav-btn {
    background: var(--primary-soft);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    &.is-active {
        background: pink;
        color: white;
        border-color:rgb(250, 145, 163);
    }
}

.anime-card-fav-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 10px rgba(138, 112, 255, 0.2);
}

.anime-card-fav-btn svg {
    width: 18px;
    height: 18px;
}

.anime-card-genres {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Ensure old serial-list styles are completely overridden or removed if they conflict */
.serial-list, .serial-tile, .serial-grid {
    ~display: none !important; /* Скрываем старые элементы, чтобы избежать конфликтов */
}

.anime-list-section {
    margin-bottom: 3rem;
}

.anime-list-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.anime-list-title {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-main);
    margin: 0;
    white-space: nowrap; /* Предотвращаем перенос заголовка */
}

.anime-list-divider {
    flex-grow: 1;
    height: 2px;
    background: linear-gradient(to right, var(--primary-color), transparent);
    border-radius: 1px;
}

/* Anime Card (replaces serial-tile) - already defined, just adding fav button */
.anime-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
}

.anime-card-fav-btn {
    background: var(--primary-soft);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.anime-card-fav-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 10px rgba(138, 112, 255, 0.2);
}

.anime-card-fav-btn svg {
    width: 18px;
    height: 18px;
}

.anime-card-genres {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    line-height: 1.2;    
}

/* Ensure old serial-list styles are completely overridden or removed if they conflict */
.serial-list, .serial-tile, .serial-grid {
    ~display: none !important; /* Скрываем старые элементы, чтобы избежать конфликтов */
}

/* Error Page Styles (404) */
.error-page-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px; /* Ensures content has some vertical space within page-surface */
    padding: 2rem; /* Internal padding within the page-surface */
}

.error-code {
    font-size: 6rem; /* Very large, impactful 404 number */
    font-weight: 900; /* Extra bold */
    color: var(--primary-color); /* Uses the theme's primary color */
    margin-bottom: 1rem;
    letter-spacing: -0.05em;
    line-height: 1; /* Prevents extra line height for the large number */
}

.error-title {
    font-size: 2.5rem; /* Main title for the error page */
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 1rem;
}

.error-description {
    max-width: 600px; /* Limits width for better readability */
    font-size: 1.15rem;
    line-height: 1.6;
    color: var(--text-muted);
    margin-bottom: 2rem; /* Space before the button */
}

/* Favorites Page Redesign */
.favs-wrapper {
    padding: 10px 0;
}

.favs-hero {
    margin-bottom: 3rem;
    border-left: 5px solid var(--primary-color);
    padding-left: 20px;
}

.favs-main-title {
    font-size: 2.8rem;
    font-weight: 900;
    letter-spacing: -0.04em;
    margin: 0;
    color: var(--text-main);
}

.favs-lead {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-top: 5px;
}

.favs-empty-box {
    padding: 5rem 2rem;
    background: var(--bg-body);
    border-radius: var(--radius-lg);
    text-align: center;
    border: 2px dashed var(--border-color);
}

.empty-status-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
}

.empty-status-text {
    font-size: 1.2rem;
    color: var(--text-muted);
    max-width: 400px;
    margin: 0 auto 2rem;
}

.anime-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 2rem;
}

@media (max-width: 576px) {
    .anime-cards-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    .favs-main-title { font-size: 2rem; }
}

/* Styles for general text content blocks (e.g., About, Contact, Rights pages) */
.text-content {
    /* The outer container might already have background/padding from .tv-card or Bootstrap */
    /* This block focuses on internal typography and spacing */
}

.text-content h1,
.text-content h2,
.text-content h3,
.text-content h4,
.text-content h5,
.text-content h6 {
    color: var(--text-main);
    margin-top: 2rem; /* Space above headings */
    margin-bottom: 1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.text-content h1 {
    font-size: 2.2rem;
    /* For the very first h1 in the section, remove top margin if it's the first child */
}

.text-content h1:first-child {
    margin-top: 0;
}

.text-content h2 {
    font-size: 1.8rem;
}

.text-content h3 {
    font-size: 1.4rem;
}

.text-content p {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-main);
    margin-bottom: 1rem;
}

.text-content a {
    color: var(--primary-color);
    text-decoration: underline;
    transition: color 0.2s ease;
}

.text-content a:hover {
    color: var(--primary-color);
    text-decoration: none;
}

.text-content ul,
.text-content ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
    color: var(--text-main);
}

.text-content ul li,
.text-content ol li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.text-content strong {
    font-weight: 600;
    color: var(--text-main);
}

/* Search Results Styling */
.person-search-card .anime-card-title {
    margin-bottom: 0;
    font-size: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
