/* ===== CSS RESET & ROOT ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg-primary: #08080d;
    --bg-secondary: #0e0e16;
    --bg-card: #13131d;
    --bg-card-hover: #1a1a28;
    --bg-elevated: #1c1c2e;

    --text-primary: #eae8f4;
    --text-secondary: #9e9cb2;
    --text-muted: #5c5a70;

    --accent-purple: #a78bfa;
    --accent-purple-dim: #7c5fd4;
    --accent-violet: #8b5cf6;
    --accent-pink: #ec4899;
    --accent-cyan: #22d3ee;

    --gradient-primary: linear-gradient(135deg, #a78bfa 0%, #6d28d9 100%);
    
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-accent: rgba(167, 139, 250, 0.25);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 48px rgba(0, 0, 0, 0.6);
    --shadow-card-hover: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 30px rgba(139, 92, 246, 0.08);
    --transition-bounce: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);

    --bg-header: rgba(8, 8, 13, 0.75);
    --hover-bg: rgba(255, 255, 255, 0.05);

    --font-main: 'Inter', 'Noto Sans JP', sans-serif;
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

:root[data-theme="light"] {
    --bg-primary: #f8f9fa;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --bg-elevated: #ffffff;

    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;

    --accent-purple: #7c3aed;
    --accent-purple-dim: #8b5cf6;
    --accent-violet: #6d28d9;
    --accent-pink: #db2777;
    --accent-cyan: #0891b2;

    --gradient-primary: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
    
    --border-subtle: rgba(0, 0, 0, 0.08);
    --border-accent: rgba(139, 92, 246, 0.3);

    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.08);
    --shadow-card-hover: 0 12px 24px rgba(0, 0, 0, 0.08), 0 0 20px rgba(139, 92, 246, 0.15);

    --bg-header: rgba(255, 255, 255, 0.85);
    --hover-bg: rgba(0, 0, 0, 0.05);
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* Animations */
.bg-particles { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; overflow: hidden; }
.bg-particles::before {
    content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
    background: radial-gradient(ellipse at 20% 50%, rgba(139, 92, 246, 0.07) 0%, transparent 50%),
                radial-gradient(ellipse at 80% 20%, rgba(236, 72, 153, 0.05) 0%, transparent 50%);
    animation: bgFloat 25s ease-in-out infinite;
}
@keyframes bgFloat {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(30px, -20px) rotate(1deg); }
    66% { transform: translate(-20px, 15px) rotate(-1deg); }
}
.particle { position: absolute; border-radius: 50%; opacity: 0; animation: particleFade 6s ease-in-out infinite; }
@keyframes particleFade { 0%, 100% { opacity: 0; transform: translateY(0) scale(0.5); } 50% { opacity: 0.5; transform: translateY(-50px) scale(1); } }

/* Header */
.site-header { position: sticky; top: 0; z-index: 100; background: var(--bg-header); backdrop-filter: blur(24px); border-bottom: 1px solid var(--border-subtle); padding: 16px 24px; transition: var(--transition-smooth); }
.header-inner { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.logo-group { display: flex; align-items: center; gap: 14px; flex: 1; justify-content: flex-start; }
.logo-icon { width: 44px; height: 44px; }
.logo-text { font-size: 1.5rem; font-weight: 800; background: var(--gradient-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.logo-sub { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; }
.header-nav { display: flex; gap: 20px; justify-content: center; }
.nav-link { color: var(--text-secondary); text-decoration: none; font-weight: 500; transition: var(--transition-fast); }
.nav-link:hover, .nav-link.active { color: var(--text-primary); }
.header-user { display: flex; align-items: center; gap: 10px; flex: 1; justify-content: flex-end; }

/* Buttons */
.btn { padding: 10px 20px; border: none; border-radius: var(--radius-md); font-family: var(--font-main); font-weight: 600; cursor: pointer; transition: var(--transition-fast); }
.btn.primary { background: var(--gradient-primary); color: white; }
.btn.primary:hover { opacity: 0.9; box-shadow: 0 0 15px rgba(167,139,250,0.4); }
.btn.full-width { width: 100%; }
.dropdown-menu { position: relative; }
.dropdown-content { display: none; position: absolute; right: 0; top: 100%; background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 8px 0; min-width: 150px; z-index: 10; }
.dropdown-menu:hover .dropdown-content { display: block; }
.dropdown-content button { display: block; width: 100%; padding: 8px 16px; text-align: left; background: none; border: none; color: var(--text-primary); cursor: pointer; }
.dropdown-content button:hover { background: var(--hover-bg); }
.header-user-btn { background: var(--hover-bg); color: var(--text-primary); }

/* Main */
.main-content { position: relative; z-index: 1; max-width: 1200px; margin: 0 auto; padding: 28px 24px 60px; }
.view { display: none; }
.view.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Cards & Grid */
.anime-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; }
.anime-card { background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-xl); overflow: hidden; transition: var(--transition-smooth); position: relative; }
.anime-card:hover { transform: translateY(-4px); border-color: var(--border-accent); box-shadow: var(--shadow-card-hover); }
.card-poster-wrapper { width: 100%; aspect-ratio: 3/4; position: relative; overflow: hidden; }
.card-poster { width: 100%; height: 100%; object-fit: cover; transition: 0.3s; }
.anime-card:hover .card-poster { transform: scale(1.05); }
.card-rating-badge { position: absolute; top: 10px; right: 10px; background: rgba(0,0,0,0.7); color: white; padding: 4px 8px; border-radius: var(--radius-sm); font-weight: bold; font-size: 0.9rem; backdrop-filter: blur(4px); }
.card-body { padding: 16px; }
.card-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-title-jp { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-rating-grid { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
.card-rating-btn { width: calc(20% - 4px); padding: 4px 0; background: rgba(255,255,255,0.05); border: 1px solid var(--border-subtle); border-radius: 4px; color: var(--text-primary); cursor: pointer; transition: 0.2s; }
.card-rating-btn:hover { background: rgba(255,255,255,0.1); }
.card-rating-btn.selected { background: var(--accent-purple); color: white; border-color: var(--accent-purple); }
.card-actions { display: flex; justify-content: space-between; }
.card-btn { background: none; border: 1px solid var(--border-subtle); color: var(--text-muted); padding: 4px 8px; border-radius: var(--radius-sm); cursor: pointer; font-size: 0.8rem; transition: var(--transition-fast); }
.card-btn:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }
.card-btn.active { color: var(--accent-cyan); border-color: var(--accent-cyan); }
.card-delete { position: absolute; top: 10px; left: 10px; z-index: 30; background: rgba(0,0,0,0.6); color: #ef4444; border-color: rgba(239,68,68,0.3); opacity: 0; font-size: 0.9rem; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; padding: 0; backdrop-filter: blur(4px); }
.anime-card:hover .card-delete { opacity: 1; }
.card-delete:hover { background: rgba(239,68,68,0.7); color: white; border-color: #ef4444; }
.card-poster-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, rgba(139,92,246,0.08), rgba(236,72,153,0.05)); color: var(--text-muted); font-size: 3rem; }
.card-poster-wrapper::after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 60px; background: linear-gradient(to top, var(--bg-card) 0%, transparent 100%); pointer-events: none; z-index: 5; }
.card-watch-overlay { position: absolute; inset: 0; background: rgba(8, 8, 13, 0.85); backdrop-filter: blur(4px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; opacity: 0; transition: var(--transition-smooth); z-index: 20; padding: 20px; }
.anime-card:hover .card-watch-overlay { opacity: 1; }
.watch-link { width: 100%; text-align: center; padding: 8px; border-radius: var(--radius-md); font-weight: 600; font-size: 0.85rem; color: white; text-decoration: none; transition: 0.2s; border: 1px solid transparent; }
.watch-link.google-search { background: rgba(66, 133, 244, 0.15); border-color: rgba(66, 133, 244, 0.3); color: #8ab4f8; margin-top: auto; margin-bottom: auto; }
.watch-link.google-search:hover { background: rgba(66, 133, 244, 0.3); box-shadow: 0 0 15px rgba(66, 133, 244, 0.4); }
.anime-card.not-watched { opacity: 0.5; }
.anime-card.not-watched:hover { opacity: 0.8; }
.anime-card.rated-high { border-color: rgba(250,204,21,0.15); }
.anime-card.rated-high:hover { border-color: rgba(250,204,21,0.3); box-shadow: 0 12px 40px rgba(0,0,0,0.5), 0 0 30px rgba(250,204,21,0.06); }

/* Accordion for Others */
.anime-accordion { background: var(--bg-card); border: 1px solid var(--border-accent); border-radius: var(--radius-lg); padding: 10px 20px; }
.anime-accordion summary { cursor: pointer; font-size: 1.1rem; font-weight: 600; color: var(--accent-cyan); list-style: none; display: flex; justify-content: space-between; align-items: center; padding: 10px 0; outline: none; }
.anime-accordion summary::-webkit-details-marker { display: none; }
.anime-accordion summary::after { content: '▼'; font-size: 0.9rem; transition: 0.2s; }
.anime-accordion[open] summary::after { transform: rotate(180deg); }
.anime-accordion[open] summary { border-bottom: 1px solid var(--border-subtle); margin-bottom: 15px; }

/* Rating button colors */
.card-rating-btn.selected[data-rating="1"], .card-rating-btn.selected[data-rating="2"] { background: linear-gradient(135deg, #ef4444, #dc2626); color: white; border-color: transparent; box-shadow: 0 2px 10px rgba(239,68,68,0.3); }
.card-rating-btn.selected[data-rating="3"], .card-rating-btn.selected[data-rating="4"] { background: linear-gradient(135deg, #f97316, #ea580c); color: white; border-color: transparent; box-shadow: 0 2px 10px rgba(249,115,22,0.3); }
.card-rating-btn.selected[data-rating="5"], .card-rating-btn.selected[data-rating="6"] { background: linear-gradient(135deg, #3b82f6, #2563eb); color: white; border-color: transparent; box-shadow: 0 2px 10px rgba(59,130,246,0.3); }
.card-rating-btn.selected[data-rating="7"], .card-rating-btn.selected[data-rating="8"] { background: linear-gradient(135deg, #22c55e, #16a34a); color: white; border-color: transparent; box-shadow: 0 2px 10px rgba(34,197,94,0.3); }
.card-rating-btn.selected[data-rating="9"], .card-rating-btn.selected[data-rating="10"] { background: linear-gradient(135deg, #facc15, #eab308); color: #1a1a2e; border-color: transparent; box-shadow: 0 2px 10px rgba(250,204,21,0.35); }

/* Add Anime */
.add-anime-card { background: var(--bg-card); border: 1px solid var(--border-accent); border-radius: var(--radius-xl); padding: 24px; margin-bottom: 24px; }
.add-header { margin-bottom: 16px; }
.autocomplete-wrapper { position: relative; }
.add-input { width: 100%; padding: 14px 14px 14px 40px; background: var(--bg-secondary); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); color: white; }
.autocomplete-dropdown { display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--bg-elevated); border: 1px solid var(--border-accent); border-radius: var(--radius-lg); max-height: 300px; overflow-y: auto; z-index: 50; }
.autocomplete-dropdown.visible { display: block; }
.autocomplete-item { display: flex; gap: 10px; padding: 10px; cursor: pointer; border-bottom: 1px solid var(--border-subtle); }
.autocomplete-item:hover { background: rgba(255,255,255,0.05); }
.autocomplete-thumb { width: 40px; height: 60px; object-fit: cover; border-radius: 4px; }
.autocomplete-info { display: flex; flex-direction: column; justify-content: center; }

/* Members & Profile */
.members-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; }
.member-card { background: var(--bg-card); padding: 20px; border-radius: var(--radius-lg); text-align: center; border: 1px solid var(--border-subtle); cursor: pointer; transition: 0.2s; }
.member-card:hover { border-color: var(--accent-purple); transform: translateY(-2px); }
.member-avatar { width: 80px; height: 80px; background: var(--gradient-primary); border-radius: 50%; margin: 0 auto 15px; display: flex; align-items: center; justify-content: center; font-size: 2rem; font-weight: bold; color: white; }
.profile-header { display: flex; align-items: center; gap: 30px; margin-bottom: 30px; background: var(--bg-card); padding: 30px; border-radius: var(--radius-xl); }
.profile-stats { display: flex; gap: 20px; margin-bottom: 30px; }
.stat-box { flex: 1; background: var(--bg-card); padding: 20px; border-radius: var(--radius-lg); text-align: center; border: 1px solid var(--border-subtle); }
.stat-box .value { font-size: 2rem; font-weight: bold; color: var(--accent-purple); }
.stat-box .label { color: var(--text-muted); font-size: 0.9rem; }

/* Admin Table */
.admin-table { width: 100%; border-collapse: collapse; min-width: 600px; text-align: left; }
.admin-table th, .admin-table td { padding: 12px 16px; border-bottom: 1px solid var(--border-subtle); color: var(--text-primary); }
.admin-table th { background: rgba(255,255,255,0.02); font-weight: 600; color: var(--accent-cyan); text-transform: uppercase; font-size: 0.85rem; letter-spacing: 0.5px; }
.admin-table tr:hover td { background: rgba(255,255,255,0.03); }

/* Controls */
.controls-bar { display: flex; gap: 16px; margin-bottom: 20px; }
.search-input { width: 100%; box-sizing: border-box; padding: 10px 15px 10px 40px; border-radius: var(--radius-md); background: var(--bg-card); border: 1px solid var(--border-subtle); color: white; }
.filter-group { display: flex; gap: 8px; }
.filter-btn { padding: 8px 16px; background: var(--bg-card); border: 1px solid var(--border-subtle); color: var(--text-secondary); border-radius: var(--radius-full); cursor: pointer; }
.filter-btn.active { background: var(--accent-purple); color: white; border-color: var(--accent-purple); }

/* Chat Widget */
.chat-widget-container { position: fixed; bottom: 30px; right: 30px; z-index: 1000; }
.chat-toggle-btn { width: 60px; height: 60px; border-radius: 50%; background: var(--gradient-primary); color: white; border: none; box-shadow: var(--shadow-md); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.chat-toggle-btn svg { width: 28px; height: 28px; }
.chat-panel { display: none; position: absolute; bottom: 80px; right: 0; width: 350px; height: 500px; background: var(--bg-card); border: 1px solid var(--border-accent); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); flex-direction: column; overflow: hidden; }
.member-avatar { width: 60px; height: 60px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border-accent); display:flex; align-items:center; justify-content:center; background:var(--gradient-primary); font-size:1.5rem; font-weight:bold; color:white; flex-shrink:0; }
.status-dot { position: absolute; bottom: 0; right: 0; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--bg-card); }
.status-dot.online { background: #10b981; box-shadow: 0 0 8px rgba(16, 185, 129, 0.5); }
.status-dot.offline { background: #6b7280; }
.member-info { flex: 1; overflow: hidden; }
.chat-panel.open { display: flex; }
.chat-header { padding: 15px; background: var(--bg-secondary); border-bottom: 1px solid var(--border-subtle); display: flex; justify-content: space-between; align-items: center; }
.chat-messages { flex: 1; padding: 15px; overflow-y: auto; display: flex; flex-direction: column; gap: 15px; }
.chat-message { display: flex; gap: 10px; max-width: 85%; }
.chat-message.own { align-self: flex-end; flex-direction: row-reverse; }
.chat-avatar { width: 32px; height: 32px; background: var(--accent-purple); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.8rem; font-weight: bold; flex-shrink: 0; }
.chat-bubble { background: var(--bg-secondary); padding: 10px 15px; border-radius: 15px; border-top-left-radius: 4px; font-size: 0.9rem; word-break: break-word; overflow-wrap: break-word; white-space: pre-wrap; }
.chat-message.own .chat-bubble { background: var(--accent-purple); color: white; border-radius: 15px; border-top-right-radius: 4px; }
.chat-sender { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 4px; }
.chat-message.own .chat-sender { text-align: right; color: rgba(255,255,255,0.7); }
.chat-input-area { padding: 15px; background: rgba(0,0,0,0.2); border-top: 1px solid var(--border-subtle); display: flex; gap: 10px; }
.chat-input-area input { flex: 1; padding: 10px; border-radius: var(--radius-md); border: 1px solid var(--border-subtle); background: var(--bg-card); color: white; }
.chat-input-area button { padding: 10px 20px; background: var(--accent-purple); color: white; border: none; border-radius: var(--radius-md); font-weight: bold; cursor: pointer; }
.chat-tool-btn { padding: 10px !important; background: rgba(255,255,255,0.1) !important; border: 1px solid var(--border-subtle) !important; color: white !important; cursor: pointer; transition: 0.2s; }
.chat-tool-btn:hover:not(:disabled) { background: rgba(255,255,255,0.2) !important; }
.chat-input-area button:disabled { opacity: 0.5; cursor: not-allowed; }
.chat-seen { font-size: 0.75rem; color: rgba(255,255,255,0.6); text-align: right; margin-top: 4px; }
.typing-dots::after { content: ''; animation: typingDots 1.5s infinite step-end; }
@keyframes typingDots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } 100% { content: ''; } }

/* Auth Modal */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(5px); z-index: 2000; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal-content { background: var(--bg-card); padding: 30px; border-radius: var(--radius-xl); width: 100%; max-width: 400px; border: 1px solid var(--border-accent); position: relative; }
.modal-close { position: absolute; top: 15px; right: 15px; background: none; border: none; color: var(--text-muted); font-size: 1.5rem; cursor: pointer; }
.auth-tabs { display: flex; border-bottom: 1px solid var(--border-subtle); margin-bottom: 20px; }
.auth-tab { flex: 1; padding: 10px; background: none; border: none; color: var(--text-muted); cursor: pointer; font-weight: 600; border-bottom: 2px solid transparent; }
.auth-tab.active { color: var(--accent-purple); border-bottom-color: var(--accent-purple); }
.auth-form { display: none; }
.auth-form.active { display: block; }
.input-group { margin-bottom: 15px; }
.input-group label { display: block; margin-bottom: 5px; font-size: 0.9rem; color: var(--text-secondary); }
.input-group input { width: 100%; padding: 12px; background: var(--bg-secondary); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); color: white; }
.form-error { color: #ef4444; font-size: 0.85rem; margin-bottom: 15px; text-align: center; }

/* Toast */
.toast { position: fixed; bottom: -100px; left: 50%; transform: translateX(-50%); background: rgba(19, 19, 29, 0.9); backdrop-filter: blur(12px); padding: 12px 24px; border-radius: var(--radius-full); border: 1px solid var(--border-accent); display: flex; align-items: center; gap: 10px; z-index: 9999; transition: var(--transition-bounce); box-shadow: var(--shadow-md); }
.toast.show { bottom: 30px; }

/* Footer */
.site-footer { text-align: center; padding: 30px; color: var(--text-muted); font-size: 0.9rem; border-top: 1px solid var(--border-subtle); }

/* Sort bar */
.sort-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 24px; flex-wrap: wrap; }
.sort-label { font-size: 0.82rem; color: var(--text-muted); font-weight: 500; margin-right: 4px; }
.sort-btn { padding: 6px 14px; background: transparent; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); color: var(--text-muted); font-family: var(--font-main); font-size: 0.78rem; font-weight: 500; cursor: pointer; transition: var(--transition-fast); }
.sort-btn:hover { color: var(--text-secondary); border-color: rgba(255,255,255,0.1); }
.sort-btn.active { background: rgba(167,139,250,0.1); border-color: var(--border-accent); color: var(--accent-purple); }

/* Section title */
.section-title { font-size: 1.3rem; font-weight: 700; margin-bottom: 20px; background: var(--gradient-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

/* Search icon in add section */
.add-search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--text-muted); pointer-events: none; z-index: 2; }
.add-title-group { display: flex; align-items: center; gap: 10px; }
.add-title-icon { width: 20px; height: 20px; color: var(--accent-purple); }
.add-title { font-size: 1.05rem; font-weight: 700; }
.add-subtitle { font-size: 0.78rem; color: var(--text-muted); }
.autocomplete-spinner { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); display: none; z-index: 2; }
.autocomplete-spinner.visible { display: block; }
.spinner { width: 20px; height: 20px; border: 2px solid rgba(167,139,250,0.2); border-top-color: var(--accent-purple); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--text-muted); pointer-events: none; }
.search-wrapper { position: relative; flex: 1; }
.welcome-message { grid-column: 1/-1; text-align: center; padding: 40px; color: var(--text-muted); font-size: 1.1rem; }

/* Settings Form Specific */
[data-theme="light"] { --bg-primary: #ffffff; --bg-secondary: #f3f4f6; --bg-card: #ffffff; --text-primary: #111827; --text-secondary: #4b5563; --text-muted: #6b7280; --border-subtle: #e5e7eb; --border-accent: #d1d5db; --gradient-primary: linear-gradient(135deg, #7c3aed, #db2777); --accent-purple: #7c3aed; --accent-cyan: #0891b2; }
.settings-section { margin-bottom: 25px; padding-bottom: 15px; border-bottom: 1px solid var(--border-subtle); }
.settings-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.settings-section h3 { margin-bottom: 15px; font-size: 1.1rem; color: var(--accent-purple); }
.avatar-preview { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; background: var(--bg-primary); display: flex; align-items: center; justify-content: center; font-size: 2rem; color: var(--text-muted); border: 2px solid var(--border-accent); flex-shrink: 0; }
.avatar-upload-group { display: flex; align-items: center; gap: 15px; margin-bottom: 15px; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(167,139,250,0.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(167,139,250,0.4); }

/* Actions Bar */
.actions-bar { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; padding-top: 20px; border-top: 1px solid var(--border-subtle); justify-content: center; }
.action-btn { display: flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: var(--radius-md); font-family: var(--font-main); font-weight: 600; font-size: 0.85rem; cursor: pointer; transition: var(--transition-fast); border: 1px solid transparent; }
.action-btn svg { width: 18px; height: 18px; }
.action-btn.primary { background: rgba(167, 139, 250, 0.1); color: var(--accent-purple); border-color: rgba(167, 139, 250, 0.2); }
.action-btn.primary:hover { background: rgba(167, 139, 250, 0.2); }
.action-btn.save-btn { background: rgba(59, 130, 246, 0.1); color: #60a5fa; border-color: rgba(59, 130, 246, 0.2); }
.action-btn.save-btn:hover { background: rgba(59, 130, 246, 0.2); }
.action-btn.export-btn { background: rgba(34, 197, 94, 0.1); color: #4ade80; border-color: rgba(34, 197, 94, 0.2); }
.action-btn.export-btn:hover { background: rgba(34, 197, 94, 0.2); }
.action-btn.import-btn { background: rgba(249, 115, 22, 0.1); color: #fb923c; border-color: rgba(249, 115, 22, 0.2); }
.action-btn.import-btn:hover { background: rgba(249, 115, 22, 0.2); }
.action-btn.enrich-btn { background: rgba(236, 72, 153, 0.1); color: #f472b6; border-color: rgba(236, 72, 153, 0.2); }
.action-btn.enrich-btn:hover { background: rgba(236, 72, 153, 0.2); }
.action-btn.enrich-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.action-btn.secondary { background: rgba(239, 68, 68, 0.1); color: #f87171; border-color: rgba(239, 68, 68, 0.2); }
.action-btn.secondary:hover { background: rgba(239, 68, 68, 0.2); }

/* Responsive */
/* Genre Filters */
.genre-filter-container { margin-top: 15px; margin-bottom: 20px; }
.toggle-genres-btn {
    background: rgba(34, 211, 238, 0.15);
    color: var(--accent-cyan);
    border: 1px solid rgba(34, 211, 238, 0.3);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    transition: all 0.2s;
    font-size: 0.85rem;
}
.toggle-genres-btn:hover { background: rgba(34, 211, 238, 0.25); }
.genre-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    transition: all 0.3s ease;
}
.genre-filters.hidden { display: none; }
.genre-filter-btn {
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s;
    font-family: inherit;
}
.genre-filter-btn:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}
.genre-filter-btn.active {
    background: var(--accent-cyan);
    color: #000;
    border-color: var(--accent-cyan);
    font-weight: bold;
}

@media (max-width: 768px) {
    .header-inner { flex-direction: column; gap: 16px; }
    .header-nav { width: 100%; justify-content: center; flex-wrap: wrap; gap: 10px 15px; }
    .logo-group, .header-user { justify-content: center; flex: unset; }
    .controls-bar { flex-direction: column; }
    .search-wrapper { width: 100%; }
    .filter-group { width: 100%; overflow-x: auto; }
    .anime-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
    .profile-header { flex-direction: column; text-align: center; }
    .profile-stats { flex-direction: column; }
    .chat-panel { 
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: auto;
        max-height: none;
        border-radius: 0;
        border: none;
        z-index: 2000;
    }
    .members-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
    .actions-bar { flex-direction: column; }
    .action-btn { justify-content: center; width: 100%; }
}
@media (max-width: 480px) {
    .main-content { padding: 16px 12px 40px; }
    .anime-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .avatar-upload-group { flex-direction: column; align-items: flex-start; text-align: center; }
    .avatar-preview { align-self: center; margin-bottom: 5px; }
    #avatarUploadForm, #avatarUrlForm { flex-direction: column; width: 100%; box-sizing: border-box; }
    .modal-content { padding: 20px 15px; margin: 15px; border-radius: var(--radius-lg); width: calc(100% - 30px); box-sizing: border-box; }
    .settings-section { margin-bottom: 20px; }
}

/* Anime Detail Modal */
.anime-detail-header {
    position: relative;
    height: 200px;
    overflow: hidden;
    background: var(--bg-secondary);
}
.anime-detail-header img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.4) blur(2px);
}
.anime-detail-header .detail-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    display: flex;
    gap: 15px;
    align-items: flex-end;
    background: linear-gradient(transparent, rgba(0,0,0,0.9));
}
.anime-detail-header .detail-poster {
    width: 100px;
    height: 140px;
    border-radius: 8px;
    object-fit: cover;
    border: 2px solid var(--accent-purple);
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}
.anime-detail-header .detail-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: white;
    line-height: 1.3;
}
.anime-detail-header .detail-title-jp {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 4px;
}
.anime-detail-body {
    padding: 20px;
}
.anime-detail-genres {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 15px;
}
.anime-detail-genres .genre-tag {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    background: rgba(139, 92, 246, 0.15);
    color: var(--accent-purple);
    border: 1px solid rgba(139, 92, 246, 0.3);
}
.anime-detail-scores {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}
.anime-detail-scores .score-box {
    flex: 1;
    text-align: center;
    padding: 10px;
    border-radius: 10px;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border-subtle);
}
.anime-detail-scores .score-box .score-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 4px;
}
.anime-detail-scores .score-box .score-value {
    font-size: 1.1rem;
    font-weight: 700;
}
.anime-detail-synopsis {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
    max-height: 150px;
    overflow-y: auto;
    margin-bottom: 15px;
    padding-right: 5px;
}
.anime-detail-synopsis::-webkit-scrollbar { width: 4px; }
.anime-detail-synopsis::-webkit-scrollbar-thumb { background: var(--accent-purple-dim); border-radius: 4px; }
.anime-detail-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 15px;
    font-size: 0.8rem;
}
.anime-detail-info .info-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 10px;
    background: rgba(0,0,0,0.15);
    border-radius: 6px;
}
.anime-detail-info .info-label { color: var(--text-muted); }
.anime-detail-info .info-value { color: var(--text-primary); font-weight: 600; }
.anime-detail-actions {
    display: flex;
    gap: 8px;
}
.anime-detail-actions .detail-btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s;
}
.anime-detail-actions .detail-btn:hover { transform: translateY(-2px); }
.anime-detail-actions .detail-btn.google { background: rgba(66,133,244,0.2); color: #4285f4; border: 1px solid rgba(66,133,244,0.3); }
.anime-detail-actions .detail-btn.mal { background: rgba(46,81,162,0.2); color: #2e51a2; border: 1px solid rgba(46,81,162,0.3); }
.anime-detail-actions .detail-btn.close-btn { background: rgba(255,255,255,0.05); color: var(--text-secondary); border: 1px solid var(--border-subtle); }
