/*
 * Lanime visual layer
 *
 * This file sits after the legacy stylesheet so the redesign can be rolled out
 * without rewriting the established auth/player components. It owns the brand
 * shell, navigation, surfaces and shared card language.
 */

:root {
    --bg-primary: #08090b;
    --bg-secondary: #0d0f12;
    --bg-surface: #111419;
    --bg-surface-hover: #181b21;
    --bg-elevated: #1b1e24;
    --border-color: rgba(255, 255, 255, 0.09);
    --border-light: rgba(255, 255, 255, 0.16);
    --text-primary: #f7f7f4;
    --text-secondary: #aeb2bc;
    --text-muted: #717783;
    --accent: #ef4444;
    --accent-muted: #fb7185;
    --accent-glow: rgba(239, 68, 68, 0.18);
    --primary: #ef4444;
    --primary-hover: #f87171;
    --surface-1: #08090b;
    --surface-2: #111419;
    --surface-3: #181b21;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-size-body: 1rem;
    --line-height-body: 1.6;
    --navbar-height: 76px;
    --max-width: 1480px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --shadow-glow: 0 0 20px rgba(239, 68, 68, 0.12);
}

html {
    background: var(--bg-primary);
}

body {
    background:
        radial-gradient(circle at 82% -12%, rgba(239, 68, 68, 0.09), transparent 28rem),
        radial-gradient(circle at 10% 18%, rgba(79, 70, 229, 0.06), transparent 24rem),
        var(--bg-primary);
    font-size: var(--font-size-body);
    line-height: var(--line-height-body);
}

.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--accent-muted);
    outline-offset: 3px;
}

.navbar {
    height: var(--navbar-height);
    background: #0b0d10;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.navbar-container {
    max-width: var(--max-width);
    padding: 0 28px;
    gap: 18px;
}

.navbar-left {
    flex: 0 0 auto;
    gap: 12px;
}

.sidebar-toggle {
    width: 44px;
    height: 44px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.025);
    color: var(--text-secondary);
}

.sidebar-toggle:hover {
    border-color: rgba(239, 68, 68, 0.55);
    color: var(--text-primary);
    background: rgba(239, 68, 68, 0.1);
}

.navbar-brand {
    width: 146px;
    height: 56px;
    display: inline-flex;
    align-items: center;
    overflow: hidden;
}

.lanime-brand-logo {
    width: 146px;
    height: auto;
    max-height: 52px;
    object-fit: contain;
    object-position: left center;
    filter: drop-shadow(0 5px 14px rgba(0, 0, 0, 0.36));
}

.quick-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 44px;
    padding: 3px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.035);
    white-space: nowrap;
}

.navbar .quick-nav-link {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    padding: 0 14px;
    border-radius: 9px;
    color: #c0c4cc;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    transition: color 180ms ease, background 180ms ease, transform 180ms ease;
}

.navbar .quick-nav-link:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.055);
    transform: translateY(-1px);
}

.navbar .quick-nav-link.active {
    color: #0b0d10;
    background: rgba(244, 244, 241, 0.92);
    box-shadow: none;
}

.search-container {
    flex: 1 1 260px;
    max-width: 340px;
}

.search-input {
    height: 44px;
    padding-top: 0;
    padding-bottom: 0;
    background: rgba(255, 255, 255, 0.055);
    border-color: rgba(255, 255, 255, 0.1);
    font-size: 0.875rem;
}

.search-input:focus {
    border-color: rgba(239, 68, 68, 0.64);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.search-input::placeholder {
    color: #9da3ae;
}

.user-menu {
    flex: 0 0 auto;
    gap: 8px;
}

.main-content {
    padding-top: calc(var(--navbar-height) + 14px);
}

.container {
    max-width: var(--max-width);
    padding-inline: 28px;
}

.sidebar {
    background: rgba(11, 13, 16, 0.98);
}

.sidebar-header {
    padding: 18px 20px 14px;
}

.sidebar-brand {
    width: 138px;
    height: 52px;
}

.sidebar-brand .lanime-brand-logo {
    width: 138px;
    max-height: 48px;
}

.sidebar-link {
    margin: 2px 12px;
    border-radius: 10px;
    color: #a9adb7;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.sidebar-link.active {
    background: rgba(239, 68, 68, 0.13);
    color: #fff;
    box-shadow: inset 3px 0 0 var(--accent);
}

.section-header {
    margin-bottom: 18px;
}

.section-title {
    font-size: 1.35rem;
    letter-spacing: -0.04em;
}

.section-subtitle {
    color: var(--accent-muted);
    font-size: 0.67rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

/* Shared button contract: compact enough for navigation, generous enough for touch. */
.btn {
    min-height: 48px;
    padding: 0 22px;
    border: 1px solid transparent;
    border-radius: 11px;
    gap: 8px;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: color 180ms ease, background-color 180ms ease, border-color 180ms ease,
        box-shadow 180ms ease, transform 180ms ease, opacity 180ms ease;
}

.btn:disabled,
.btn[aria-disabled='true'] {
    cursor: not-allowed;
    opacity: 0.5;
    transform: none;
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    box-shadow: 0 6px 18px rgba(239, 68, 68, 0.14);
}

.btn-primary:hover {
    background: #f87171;
    border-color: #f87171;
    box-shadow: 0 8px 22px rgba(239, 68, 68, 0.22);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.88);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.24);
    color: #fff;
    transform: translateY(-1px);
}

.navbar .btn-signin {
    min-height: 44px;
    padding-inline: 16px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.14);
    color: var(--text-primary);
    font-size: 0.875rem;
    box-shadow: none;
}

.navbar .btn-signin:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.24);
    color: var(--text-primary);
    transform: translateY(-1px);
    box-shadow: none;
}

.btn-lg {
    min-height: 50px;
    padding-inline: 24px;
    font-size: 0.9375rem;
}

.btn-sm {
    min-height: 36px;
    padding-inline: 14px;
    font-size: 0.8125rem;
}

.btn-ghost {
    min-height: 36px;
    padding-inline: 12px;
}

.btn-icon {
    min-width: 40px;
    min-height: 40px;
    padding: 8px;
}

.btn-xs {
    min-height: 32px;
    padding-inline: 10px;
    font-size: 0.75rem;
}

.anime-card,
.manga-card {
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.025);
    overflow: hidden;
    transition: transform 220ms ease, border-color 220ms ease, background 220ms ease, box-shadow 220ms ease;
}

.anime-card::before,
.manga-card::before {
    content: '';
    position: absolute;
    z-index: 3;
    left: 14px;
    right: 14px;
    bottom: 0;
    height: 2px;
    border-radius: 999px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0;
    transform: scaleX(.35);
    transition: opacity 220ms ease, transform 220ms ease;
    pointer-events: none;
}

.anime-card:hover,
.manga-card:hover {
    transform: translateY(-5px);
    border-color: rgba(239, 68, 68, 0.48);
    background: rgba(255, 255, 255, 0.055);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.32);
}

.anime-card:hover::before,
.manga-card:hover::before,
.anime-card:focus-visible::before,
.manga-card:focus-visible::before {
    opacity: .9;
    transform: scaleX(1);
}

.anime-card img,
.manga-card img {
    transition: transform 320ms cubic-bezier(.2,.7,.2,1), filter 320ms ease;
}

.anime-card:hover img,
.manga-card:hover img,
.anime-card:focus-visible img,
.manga-card:focus-visible img {
    transform: scale(1.045);
    filter: saturate(1.06) contrast(1.02);
}

.anime-card-info,
.manga-card-info {
    padding: 11px 12px 13px;
}

.anime-card-title,
.manga-card-title {
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.35;
}

.anime-card-meta,
.manga-card-meta {
    color: #9da3ae;
    font-size: 0.78125rem;
    line-height: 1.45;
}

.footer {
    background: #0b0d10;
    border-top-color: rgba(255, 255, 255, 0.07);
}

@media (prefers-reduced-motion: reduce) {
    .anime-card,
    .manga-card,
    .anime-card::before,
    .manga-card::before,
    .anime-card img,
    .manga-card img {
        transition-duration: .01ms !important;
    }
}

@media (max-width: 1180px) {
    .quick-nav {
        display: none;
    }

    .search-container {
        max-width: 440px;
    }
}

@media (max-width: 720px) {
    :root {
        --navbar-height: 64px;
    }

    .navbar-container {
        padding: 0 14px;
        gap: 8px;
    }

    .navbar-brand {
        width: 112px;
        height: 48px;
    }

    .lanime-brand-logo {
        width: 112px;
        max-height: 42px;
    }

    .search-container {
        display: none;
    }

    .mobile-search-toggle {
        width: 44px;
        height: 44px;
        border: 1px solid var(--border-color);
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.04);
    }

    .container {
        padding-inline: 14px;
    }

    .main-content {
        padding-top: calc(var(--navbar-height) + 8px);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
