/* ==========================================================================
   LAYOUT SYSTEM
   ========================================================================== */

/* Body background - handled in critical.css */

/* Layout - main content area */

/* Main content and aside */

@media (min-width: 769px) and (max-width: 991px) {
    aside .sidebar-container {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    aside .sidebar-block, aside .sidebar__block {
        margin-bottom: 0;
    }
}

@media (max-width: 991px) {
    .layout {
        flex-direction: column;
        gap: 25px;
        padding: 15px;
    }
    main {
        max-width: 100% !important;
        flex: 1 1 auto !important;
        min-width: 100% !important;
    }
    aside {
        flex: 0 0 auto;
        width: 100%;
        max-width: 100%;
    }
}

/* Sidebar blocks */
.sidebar-container, .sidebar {
    width: 100%;
}

/* ==========================================================================
   AUTH FORMS LAYOUT
   ========================================================================== */

.auth-container {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-wrapper {
    width: 100%;
    max-width: 400px;
    background-color: #161b22;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.auth-wrapper form label {
    display: block;
    margin-bottom: 6px;
    color: #fff;
    font-size: 0.95rem;
}

.auth-wrapper form input[type="text"],
.auth-wrapper form input[type="password"],
.auth-wrapper form input[type="email"] {
    width: 100%;
    background-color: #1c2128;
    border: 1px solid #232834;
    border-radius: .25rem;
    color: #fff;
    font-size: .95rem;
    outline: none;
    padding: .6rem .8rem;
    box-sizing: border-box;
}

.auth-wrapper form input[type="text"]:focus,
.auth-wrapper form input[type="password"]:focus,
.auth-wrapper form input[type="email"]:focus {
    border-color: var(--primary-red);
}

.auth-wrapper .mb-3 {
    margin-bottom: 1rem;
}

.auth-title {
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 1.75rem;
    color: #fff;
    font-weight: 700;
}

.auth-alert {
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border-radius: 0.25rem;
    border: 1px solid transparent;
    font-size: 0.9rem;
}

.auth-alert-danger {
    color: #ea868f;
    background-color: #2c0b0e;
    border-color: #842029;
}

.auth-form-group {
    margin-bottom: 1rem;
}

.auth-checkbox-group {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    gap: 0.5rem;
}

.auth-checkbox-group input[type="checkbox"] {
    margin: 0;
    width: auto;
    cursor: pointer;
}

.auth-checkbox-label {
    margin-bottom: 0;
    font-size: 0.9rem;
    cursor: pointer;
    display: inline-block;
}

.auth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    text-align: center;
    border: none;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    text-decoration: none;
    color: #fff;
}

.auth-btn-primary {
    background-color: var(--primary-red);
}

.auth-btn-primary:hover {
    background-color: var(--primary-red-darker);
}

.auth-links {
    margin-top: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.auth-link {
    color: #9ca3af;
    text-decoration: none;
    transition: color 0.2s;
}

.auth-link:hover {
    color: var(--primary-red);
}

.auth-actions {
    display: flex;
    gap: 1rem;
}

.auth-actions > * {
    flex: 1;
}

.auth-error-text {
    font-size: 0.85rem;
    color: var(--primary-red);
    margin-top: 0.25rem;
    display: block;
}

.auth-error-icon {
    margin-right: 0.25rem;
}

/* Medium screen adjustments */
@media (min-width: 769px) and (max-width: 1199px) {
    .auth-wrapper {
        max-width: 380px;
    }
}

/* Additional spacing for better mobile experience */
@media (max-width: 576px) {
    .auth-container {
        padding: 1rem;
    }
    
    .auth-wrapper {
        max-width: 100%;
    }
}

.sidebar-block .sidebar-list-item:first-child {
    padding-top: 12px;
}

.sidebar-block .sidebar-list-item:last-child {
    padding-bottom: 12px;
}

/* Sidebar list items */
.sidebar-list-item, .sidebar__item {
    padding: 10px 15px;
    border-bottom: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
    transition: background 0.2s;
    cursor: pointer;
    text-decoration: none;
    color: var(--text-secondary);
}

.sidebar-list-item:hover, .sidebar__item:hover { 
    background: rgba(255,255,255,0.05); 
    color: white;
}

.sidebar-list-item:last-child, .sidebar__item:last-child { border-bottom: none; }

/* Thumbnails */

.item-text-wrapper {
    flex-grow: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    overflow: hidden;
}

.item-title, .sidebar__item-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 8px;
    color: white;
}

.date-tag, .sidebar__item-badge {
    background: #c00000;
    font-size: 0.65rem;
    padding: 3px 8px;
    font-weight: 900;
    border-radius: 2px;
    font-family: 'Oswald', sans-serif;
    white-space: nowrap;
    color: white;
    flex-shrink: 0;
}

/* Navigation links */
.nav-link {
    font-family: 'Oswald', sans-serif;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}

.nav-link.active {
    color: var(--primary-red);
}

/* Sidebar header */
.sidebar-header, .sidebar__header {
    background: linear-gradient(135deg, var(--primary-red) 0%, #8b0000 100%);
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'Oswald', sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
    color: white;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    min-height: 44px;
}

.sidebar-header .switch-18, .sidebar-header .toggle {
    flex-shrink: 0;
    margin-left: auto;
}

.toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: #fff;
    cursor: pointer;
}

.toggle-bg, .toggle__bg {
    width: 34px;
    height: 18px;
    background: var(--gray-dark);
    border-radius: 10px;
    position: relative;
    cursor: pointer;
    transition: 0.3s;
}

.toggle-dot, .toggle__dot {
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: 0.2s;
}

.toggle-bg.active, .toggle__bg--active {
    background: var(--blue-primary);
}

.toggle-bg.active .toggle-dot, .toggle__bg--active .toggle__dot {
    left: 18px;
}

/* Visually hidden utility */
.visually-hidden {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

/* Top items */
.top-item, .sidebar__top-item {
    position: relative;
    height: 65px;
    border-bottom: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    padding: 0 15px;
    background-size: cover;
    background-position: center;
    overflow: hidden;
    text-decoration: none;
    background: #000 !important;
}

.top-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, rgba(0,0,0,0.9) 30%, rgba(0,0,0,0.4));
}

.top-item__rank, .sidebar__top-rank {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    border-radius: 50%;
}

.top-item__title, .sidebar__top-title {
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

.top-content {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
}

.top-bg-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.top-bg-fallback {
    position: absolute;
    inset: 0;
    background: var(--bg-card);
}

.rank-circle {
    width: 28px;
    height: 28px;
    background: var(--primary-red);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.top-info { 
    line-height: 1.3;
    overflow: hidden;
    flex: 1;
    min-width: 0;
}

.top-title { 
    font-weight: bold; 
    font-size: 0.9rem; 
    text-transform: uppercase; 
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.top-views { 
    font-size: 0.7rem;
    color: #8e99a7; 
    display: flex; 
    align-items: center; 
    gap: 4px; 
}

/* Avatar */
.sidebar-comment-avatar img { 
    width: 35px; 
    height: 35px; 
    object-fit: cover; 
}

/* Image wrappers */
.rec-image-wrapper img { 
    width: 100%; 
    height: auto; 
    object-fit: cover; 
}

.anime-details-grid__poster img { 
    width: 100%; 
    height: auto; 
    object-fit: cover; 
}

/* Empty state */
.empty-state {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: #444;
    font-style: italic;
    padding: 15px;
}

/* Footer */
