/* === Reset & Base === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-card: #16213e;
    --bg-hover: #1f3056;
    --accent: #e94560;
    --accent-hover: #ff6b81;
    --text-primary: #eee;
    --text-secondary: #aab;
    --text-muted: #667;
    --border: #2a2a4a;
    --success: #2ed573;
    --warning: #ffa502;
    --info: #1e90ff;
    --radius: 12px;
    --shadow: 0 4px 20px rgba(0,0,0,0.4);
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* === Header === */
header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
}

nav {
    display: flex;
    gap: 0.5rem;
}

.nav-btn {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 0.5rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.nav-btn:hover {
    color: var(--text-primary);
    border-color: var(--accent);
}

.nav-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* === Main === */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.page { display: none; }
.page.active { display: block; }

/* === Search Bar === */
.search-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

#search-input {
    flex: 1;
    padding: 0.8rem 1.2rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

#search-input:focus {
    border-color: var(--accent);
}

#search-input::placeholder {
    color: var(--text-muted);
}

#search-btn {
    padding: 0.8rem 1.5rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: background 0.2s;
}

#search-btn:hover {
    background: var(--accent-hover);
}

/* === List Header & Controls === */
.list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.list-header h2 {
    font-size: 1.3rem;
    color: var(--text-primary);
}

.list-controls {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.list-controls select {
    padding: 0.5rem 0.8rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    outline: none;
}

.list-controls select:focus {
    border-color: var(--accent);
}

/* === Anime Grid === */
.anime-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.5rem;
}

/* === Anime Card === */
.anime-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}

.anime-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.6);
}

.anime-card .cover {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    display: block;
    background: var(--bg-secondary);
}

.anime-card .card-body {
    padding: 0.8rem;
    flex: 1;
}

.anime-card .card-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.anime-card .card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.anime-card .card-score {
    color: #ffd700;
    font-weight: 600;
}

.anime-card .card-type {
    background: var(--bg-hover);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
}

.anime-card .card-genres {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* === Card Badges === */
.anime-card .card-badges {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-end;
}

.status-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-badge.Watching { background: var(--info); color: #fff; }
.status-badge.Completed { background: var(--success); color: #000; }
.status-badge.PlanToWatch { background: var(--warning); color: #000; }
.status-badge.OnHold { background: #a0a0a0; color: #000; }
.status-badge.Dropped { background: #ff4757; color: #fff; }

.card-rating {
    font-size: 0.7rem;
    color: #ffd700;
    background: rgba(0,0,0,0.6);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
}

/* === Viewed Button on Card === */
.viewed-toggle {
    width: 100%;
    padding: 0.5rem;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: background 0.2s;
}

.viewed-toggle.add {
    background: var(--accent);
    color: white;
}

.viewed-toggle.add:hover {
    background: var(--accent-hover);
}

.viewed-toggle.remove {
    background: var(--success);
    color: #000;
}

.viewed-toggle.remove:hover {
    background: #ff4757;
    color: white;
}

/* === Modal === */
.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.7);
}

.modal-content {
    position: relative;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    max-width: 750px;
    width: 92%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}

.modal-close {
    position: absolute;
    top: 0.5rem;
    right: 0.8rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.8rem;
    cursor: pointer;
    z-index: 10;
    line-height: 1;
}

.modal-close:hover {
    color: var(--accent);
}

/* === Modal Detail === */
.detail-header {
    display: flex;
    gap: 1.5rem;
    padding: 1.5rem;
}

.detail-cover {
    width: 200px;
    min-width: 200px;
    border-radius: 8px;
    object-fit: cover;
}

.detail-info {
    flex: 1;
}

.detail-info h2 {
    font-size: 1.4rem;
    margin-bottom: 0.2rem;
}

.detail-info .japanese-title {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.8rem;
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.detail-meta .tag {
    background: var(--bg-card);
    padding: 0.3rem 0.7rem;
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.detail-meta .tag.score {
    color: #ffd700;
    border: 1px solid #ffd700;
}

.detail-synopsis {
    padding: 0 1.5rem 1.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.8;
}

/* === Trailer === */
.detail-trailer {
    padding: 0 1.5rem 1.5rem;
}

.detail-trailer h3 {
    font-size: 1rem;
    margin-bottom: 0.8rem;
    color: var(--text-primary);
}

.trailer-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
}

.trailer-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* === Detail User Section (status, rating, notes) === */
.detail-user-section {
    padding: 0 1.5rem 1.5rem;
    border-top: 1px solid var(--border);
    margin-top: 0.5rem;
    padding-top: 1.5rem;
}

.detail-user-section h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.user-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.control-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.control-row label {
    min-width: 80px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.control-row select {
    padding: 0.5rem 0.8rem;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    outline: none;
}

.control-row select:focus {
    border-color: var(--accent);
}

/* === Star Rating === */
.star-rating {
    display: flex;
    gap: 2px;
    direction: rtl;
}

.star-rating input {
    display: none;
}

.star-rating label {
    cursor: pointer;
    font-size: 1.4rem;
    color: var(--border);
    transition: color 0.15s;
    min-width: auto;
}

.star-rating label:hover,
.star-rating label:hover ~ label,
.star-rating input:checked ~ label {
    color: #ffd700;
}

/* === Notes === */
.notes-area {
    width: 100%;
}

.notes-area textarea {
    width: 100%;
    min-height: 80px;
    padding: 0.8rem;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.85rem;
    font-family: inherit;
    resize: vertical;
    outline: none;
}

.notes-area textarea:focus {
    border-color: var(--accent);
}

.notes-area textarea::placeholder {
    color: var(--text-muted);
}

/* === Detail Actions === */
.detail-actions {
    padding: 0 1.5rem 1.5rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.detail-actions .btn {
    padding: 0.7rem 1.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background 0.2s;
}

.detail-actions .btn-add {
    background: var(--accent);
    color: white;
}

.detail-actions .btn-add:hover {
    background: var(--accent-hover);
}

.detail-actions .btn-save {
    background: var(--info);
    color: white;
}

.detail-actions .btn-save:hover {
    background: #3aa0ff;
}

.detail-actions .btn-remove {
    background: transparent;
    color: #ff4757;
    border: 1px solid #ff4757;
}

.detail-actions .btn-remove:hover {
    background: #ff4757;
    color: white;
}

/* === Empty State & Loading === */
.empty-state {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--text-muted);
    font-size: 1.1rem;
}

.loading {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* === Responsive === */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    main {
        padding: 1rem;
    }
    
    .anime-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
    }
    
    .list-header {
        flex-direction: column;
        align-items: stretch;
    }

    .list-controls {
        flex-direction: column;
    }

    .detail-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .detail-cover {
        width: 160px;
        min-width: auto;
    }

    .control-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.3rem;
    }

    .star-rating label {
        font-size: 1.6rem;
    }
}

/* === Episode Progress === */
.card-progress {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.3rem;
}

.progress-bar {
    flex: 1;
    height: 6px;
    background: #1a1a2e;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #e94560, #0f3460);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.7rem;
    color: #8892b0;
    white-space: nowrap;
}

.episode-progress-control {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.episode-progress-control input[type="number"] {
    width: 60px;
    padding: 0.3rem;
    background: #1a1a2e;
    border: 1px solid #2a2a4e;
    border-radius: 4px;
    color: #e6e6e6;
    text-align: center;
    font-size: 0.9rem;
}

.episode-progress-control span {
    color: #8892b0;
    font-size: 0.9rem;
}

.ep-btn {
    width: 28px;
    height: 28px;
    border: 1px solid #2a2a4e;
    background: #16213e;
    color: #e6e6e6;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.ep-btn:hover {
    background: #0f3460;
}

.ep-btn-all {
    width: auto;
    padding: 0 8px;
    font-size: 0.75rem;
}

.detail-progress-bar {
    height: 8px;
    background: #1a1a2e;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 0.3rem;
}

.detail-progress-bar .progress-fill {
    height: 100%;
}

/* === Tags === */
.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem;
    margin-top: 0.3rem;
}

.card-tag {
    font-size: 0.65rem;
    padding: 1px 6px;
    background: #e94560;
    color: white;
    border-radius: 8px;
}

.detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
}

.detail-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 2px 10px;
    border-radius: 12px;
    color: white;
    font-size: 0.8rem;
}

.detail-tag button {
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    font-size: 1rem;
    padding: 0;
    line-height: 1;
}

.detail-tag button:hover {
    color: white;
}

.tag-add-row {
    display: flex;
    gap: 0.3rem;
    align-items: center;
}

.tag-add-row input[type="text"] {
    flex: 1;
    padding: 0.3rem 0.5rem;
    background: #1a1a2e;
    border: 1px solid #2a2a4e;
    border-radius: 4px;
    color: #e6e6e6;
    font-size: 0.85rem;
}

.tag-add-row input[type="color"] {
    width: 30px;
    height: 28px;
    border: 1px solid #2a2a4e;
    border-radius: 4px;
    background: none;
    cursor: pointer;
    padding: 0;
}

.tags-area {
    flex-direction: column !important;
    align-items: stretch !important;
}

/* === Statistics === */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: #16213e;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    border: 1px solid #1a1a3e;
}

.stat-number {
    font-size: 2.2rem;
    font-weight: 700;
    color: #e94560;
}

.stat-label {
    font-size: 0.85rem;
    color: #8892b0;
    margin-top: 0.3rem;
}

.stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.stats-section {
    background: #16213e;
    border-radius: 12px;
    padding: 1.2rem;
    border: 1px solid #1a1a3e;
}

.stats-section h3 {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    color: #e6e6e6;
}

.bar-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.bar-label {
    width: 100px;
    font-size: 0.8rem;
    color: #8892b0;
    text-align: right;
    flex-shrink: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bar-track {
    flex: 1;
    height: 14px;
    background: #1a1a2e;
    border-radius: 7px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 7px;
    background: #e94560;
    transition: width 0.6s ease;
}

.bar-value {
    width: 30px;
    font-size: 0.8rem;
    color: #e6e6e6;
    font-weight: 600;
}

.stats-empty {
    color: #8892b0;
    font-size: 0.85rem;
    font-style: italic;
}

/* === News Page === */
.page-subtitle {
    color: #8892b0;
    margin: -0.5rem 0 1.5rem 0;
    font-size: 0.9rem;
}

.news-card {
    display: flex;
    gap: 1rem;
    background: #16213e;
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    border: 1px solid #1a1a3e;
}

.news-card:hover {
    background: #1a2848;
    transform: translateY(-2px);
}

.news-cover {
    width: 80px;
    height: 110px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.news-info h3 {
    margin: 0 0 0.4rem 0;
    font-size: 1rem;
    color: #e6e6e6;
}

.news-meta {
    display: flex;
    gap: 0.8rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 0.4rem;
}

.news-status {
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
}

.news-status.airing {
    background: #2ecc71;
    color: #0a0a0a;
}

.news-status.upcoming {
    background: #9b59b6;
    color: white;
}

.news-relation {
    font-size: 0.8rem;
    color: #8892b0;
}

.news-synopsis {
    font-size: 0.8rem;
    color: #8892b0;
    line-height: 1.4;
    margin: 0.3rem 0 0 0;
}

/* === New Episodes Page === */
.new-episode-card {
    display: flex;
    gap: 1rem;
    background: var(--bg-card);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
    transition: background 0.2s, transform 0.2s;
    border: 1px solid var(--border);
}

.new-episode-card:hover {
    background: var(--bg-hover);
    transform: translateY(-2px);
}

.new-episode-card.in-my-list {
    border-color: var(--accent);
    box-shadow: 0 0 12px rgba(233, 69, 96, 0.15);
}

.new-episode-thumb {
    width: 160px;
    height: 90px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.new-episode-info {
    flex: 1;
    min-width: 0;
}

.new-episode-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-bottom: 0.3rem;
}

.new-episode-header h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--text-primary);
}

.new-episode-mylist-badge {
    padding: 2px 10px;
    border-radius: 8px;
    font-size: 0.72rem;
    font-weight: 700;
    background: var(--accent);
    color: #fff;
    white-space: nowrap;
}

.new-episode-count {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.new-episode-watched-info {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0 0 0.4rem 0;
}

.ep-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.ep-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.5rem;
    border-radius: 6px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.82rem;
    transition: background 0.15s;
}

.ep-row:hover {
    background: rgba(233, 69, 96, 0.1);
    color: var(--text-primary);
}

.ep-label {
    font-weight: 700;
    color: var(--accent);
    white-space: nowrap;
    min-width: 50px;
}

.ep-time {
    margin-left: auto;
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.ep-more {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0.3rem 0 0 0.5rem;
    font-style: italic;
}

.new-episodes-day-header {
    font-size: 1rem;
    color: var(--accent);
    margin: 1.5rem 0 0.6rem 0;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--border);
}

.new-episodes-day-header:first-child {
    margin-top: 0;
}

#new-episodes-pagination {
    margin-top: 1.5rem;
}

#new-episodes-pagination .pagination button {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem 1.2rem;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

#new-episodes-pagination .pagination button:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--accent);
}

#new-episodes-pagination .pagination button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* === Import Page === */
.import-section {
    max-width: 600px;
    background: #16213e;
    border-radius: 12px;
    padding: 2rem;
    border: 1px solid #1a1a3e;
    margin-bottom: 1.5rem;
}

.import-section h3 {
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.import-section a {
    color: #e94560;
}

.export-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.btn-secondary {
    padding: 0.5rem 1.5rem;
    background: transparent;
    color: var(--accent);
    border: 2px solid var(--accent);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--accent);
    color: white;
}

.import-upload {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-top: 1rem;
}

.import-upload input[type="file"] {
    flex: 1;
    padding: 0.5rem;
    background: #1a1a2e;
    border: 1px solid #2a2a4e;
    border-radius: 6px;
    color: #e6e6e6;
}

.btn-primary {
    padding: 0.5rem 1.5rem;
    background: #e94560;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #d63851;
}

.import-result {
    margin-top: 1.5rem;
    padding: 1rem;
    border-radius: 8px;
}

.import-result.success {
    background: rgba(46, 204, 113, 0.1);
    border: 1px solid #2ecc71;
}

.import-result.error {
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid #e74c3c;
}

.import-result h3 {
    margin: 0 0 0.5rem 0;
}

.import-result p {
    margin: 0.3rem 0;
    color: #ccd6f6;
}

/* === Recommendations === */
.recs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.8rem;
    margin-top: 0.8rem;
}

.rec-card {
    background: #1a1a2e;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

.rec-card:hover {
    transform: translateY(-3px);
    background: #222248;
}

.rec-card img {
    width: 100%;
    height: 160px;
    object-fit: cover;
}

.rec-info {
    padding: 0.5rem;
}

.rec-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #e6e6e6;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rec-votes {
    font-size: 0.7rem;
    color: #8892b0;
    margin-top: 0.2rem;
}

.recs-empty {
    color: #8892b0;
    font-style: italic;
    text-align: center;
    padding: 1rem;
}

.btn-recommend {
    background: #0f3460 !important;
}

.btn-recommend:hover {
    background: #1a4570 !important;
}

/* === Pagination === */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.5rem 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.pagination-info {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.pagination-nav {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.pagination-btn {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.4rem 0.75rem;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
    min-width: 2.2rem;
    text-align: center;
}

.pagination-btn:hover:not(:disabled):not(.active) {
    background: var(--bg-hover);
    border-color: var(--accent);
}

.pagination-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    font-weight: 600;
}

.pagination-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.pagination-ellipsis {
    color: var(--text-muted);
    padding: 0 0.25rem;
}

/* === Toast Container === */
#toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: #16213e;
    color: #e6e6e6;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    border-left: 4px solid #e94560;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

/* === Responsive: Stats === */
@media (max-width: 768px) {
    .stats-row {
        grid-template-columns: 1fr;
    }

    .bar-label {
        width: 70px;
        font-size: 0.7rem;
    }

    .news-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .news-cover {
        width: 120px;
        height: 160px;
    }

    .new-episode-card {
        flex-direction: column;
    }

    .new-episode-thumb {
        width: 100%;
        height: auto;
        aspect-ratio: 16/9;
    }
}
