/* ===== AniAni - Global Styles & Themes ===== */

/* Dark Theme (default) */
[data-theme="dark"] {
    --bg-primary: #0b1622;
    --bg-secondary: #151f2e;
    --bg-tertiary: #1a2436;
    --bg-card: #1f2937;
    --bg-card-hover: #263244;
    --bg-overlay: rgba(0, 0, 0, 0.75);
    --text-primary: #edf1f5;
    --text-secondary: #8ba0b2;
    --text-muted: #5c7185;
    --text-bright: #ffffff;
    --border: #2a3a4e;
    --border-light: #344a60;
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-heavy: rgba(0, 0, 0, 0.5);
    --navbar-bg: rgba(21, 31, 46, 0.95);
}

/* Light Theme */
[data-theme="light"] {
    --bg-primary: #f0f2f5;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e8ecf0;
    --bg-card: #ffffff;
    --bg-card-hover: #f5f7fa;
    --bg-overlay: rgba(0, 0, 0, 0.5);
    --text-primary: #1a1a2e;
    --text-secondary: #5a6577;
    --text-muted: #8a95a5;
    --text-bright: #ffffff;
    --border: #dce1e8;
    --border-light: #c8d0da;
    --shadow: rgba(0, 0, 0, 0.08);
    --shadow-heavy: rgba(0, 0, 0, 0.15);
    --navbar-bg: rgba(255, 255, 255, 0.95);
}

:root {
    /* Accent colors (shared) */
    --accent: #3db4f2;
    --accent-hover: #59c3f7;
    --accent-dim: rgba(61, 180, 242, 0.15);
    --accent-green: #4caf50;
    --accent-orange: #ff9800;
    --accent-red: #f44336;
    --accent-purple: #9c27b0;
    --accent-yellow: #ffc107;
    --accent-pink: #e91e63;

    /* Scoring colors */
    --score-great: #4caf50;
    --score-good: #8bc34a;
    --score-average: #ffc107;
    --score-bad: #ff9800;
    --score-terrible: #f44336;

    /* Status colors */
    --status-watching: #3db4f2;
    --status-completed: #4caf50;
    --status-planning: #9c27b0;
    --status-onhold: #ff9800;
    --status-dropped: #f44336;

    /* Dimensions */
    --navbar-height: 60px;
    --mobile-nav-height: 56px;
    --card-radius: 6px;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition: 0.25s ease;
    --transition-slow: 0.4s ease;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color var(--transition), color var(--transition);
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover { color: var(--accent-hover); }

img {
    display: block;
    max-width: 100%;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
    font-size: inherit;
}

input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ===== Navbar ===== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--navbar-height);
    background: var(--navbar-bg, var(--bg-secondary));
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 1000;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 8px var(--shadow);
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo {
    font-size: 24px;
    font-weight: 800;
    text-decoration: none;
    display: flex;
    cursor: pointer;
    letter-spacing: -0.5px;
}

.logo-ani { color: var(--accent); }
.logo-ani2 { color: var(--text-primary); }

.nav-links {
    display: flex;
    align-items: center;
    gap: 2px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.nav-link:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

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

.nav-link .material-symbols-rounded {
    font-size: 18px;
}

.nav-center {
    display: flex;
    align-items: center;
}

.nav-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-tertiary);
    padding: 4px;
    border-radius: var(--radius-lg);
}

.nav-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.nav-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.nav-tab.active {
    background: var(--accent);
    color: var(--text-bright);
    box-shadow: 0 2px 8px rgba(61, 180, 242, 0.3);
}

.nav-tab .material-symbols-rounded { font-size: 18px; }

.nav-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Search */
.search-container {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
    font-size: 20px;
    pointer-events: none;
}

.search-input {
    width: 260px;
    padding: 8px 40px 8px 40px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: all var(--transition);
}

.search-input:focus {
    border-color: var(--accent);
    width: 340px;
    background: var(--bg-card);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

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

.search-kbd {
    position: absolute;
    right: 10px;
    padding: 1px 6px;
    font-size: 11px;
    font-family: monospace;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    pointer-events: none;
}

.search-input:focus ~ .search-kbd {
    display: none;
}

.search-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 380px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    max-height: 450px;
    overflow-y: auto;
    display: none;
    z-index: 1001;
    box-shadow: 0 12px 32px var(--shadow-heavy);
}

.search-dropdown.active { display: block; }

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background var(--transition-fast);
    border-bottom: 1px solid var(--border);
}

.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--bg-card-hover); }

.search-result-img {
    width: 40px;
    height: 56px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.search-result-info { flex: 1; min-width: 0; }

.search-result-title {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-meta {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.search-result-score {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 12px;
    color: var(--accent-yellow);
    font-weight: 600;
}

.search-no-results {
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

.search-section-label {
    padding: 8px 14px;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    background: var(--bg-tertiary);
}

/* Nav icon buttons */
.nav-icon-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.nav-icon-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-icon-btn.active { color: var(--accent); }

/* ===== Mobile Nav ===== */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--mobile-nav-height);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(12px);
}

.mobile-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 12px;
    color: var(--text-muted);
    font-size: 10px;
    transition: color var(--transition-fast);
}

.mobile-nav-btn .material-symbols-rounded { font-size: 24px; }
.mobile-nav-btn.active { color: var(--accent); }

/* ===== Main Content ===== */
.main-content {
    margin-top: var(--navbar-height);
    min-height: calc(100vh - var(--navbar-height));
    padding: 24px;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
    animation: pageIn 0.3s ease;
}

@keyframes pageIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== Toast Notifications ===== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 16px var(--shadow-heavy);
    font-size: 14px;
    color: var(--text-primary);
    animation: toastSlideIn 0.3s ease, toastSlideOut 0.3s ease 2.7s forwards;
    max-width: 360px;
}

.toast.success { border-left: 3px solid var(--accent-green); }
.toast.error { border-left: 3px solid var(--accent-red); }
.toast.info { border-left: 3px solid var(--accent); }
.toast .material-symbols-rounded { font-size: 20px; }
.toast.success .material-symbols-rounded { color: var(--accent-green); }
.toast.error .material-symbols-rounded { color: var(--accent-red); }
.toast.info .material-symbols-rounded { color: var(--accent); }

@keyframes toastSlideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes toastSlideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* ===== Detail Overlay ===== */
.detail-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--bg-overlay);
    z-index: 2000;
    display: none;
    overflow-y: auto;
}

.detail-overlay.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

.detail-content {
    max-width: 1100px;
    margin: 0 auto;
    background: var(--bg-primary);
    min-height: 100vh;
    animation: slideUp 0.3s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== Loading Skeleton ===== */
.skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-card) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-card { border-radius: var(--card-radius); overflow: hidden; }
.skeleton-card .skeleton-img { width: 100%; aspect-ratio: 2/3; }
.skeleton-card .skeleton-text { height: 14px; margin: 10px 8px 6px; width: 80%; }
.skeleton-card .skeleton-text-sm { height: 10px; margin: 0 8px 10px; width: 50%; }

/* ===== Page Transition ===== */
.page-transition {
    animation: pageIn 0.25s ease;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .nav-links { display: none; }
}

@media (max-width: 768px) {
    .navbar { padding: 0 12px; }
    .nav-center { display: none; }
    .search-container { display: none; }
    .nav-right .nav-icon-btn { display: none; }
    .nav-links { display: none; }
    .mobile-nav { display: flex; }
    .main-content {
        padding: 16px;
        margin-bottom: var(--mobile-nav-height);
    }
    .toast-container {
        bottom: calc(var(--mobile-nav-height) + 12px);
        right: 12px;
        left: 12px;
    }
}

@media (max-width: 480px) {
    .main-content { padding: 12px; }
}
