/* ===== AniAni - Reusable Components ===== */

/* ===== Media Card ===== */
.media-card {
    position: relative;
    border-radius: var(--card-radius);
    overflow: hidden;
    background: var(--bg-card);
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.media-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px var(--shadow-heavy);
}

.media-card-image {
    position: relative;
    width: 100%;
    aspect-ratio: 2/3;
    overflow: hidden;
}

.media-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition);
}

.media-card:hover .media-card-image img {
    transform: scale(1.05);
}

.media-card-score {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    gap: 4px;
}

.media-card-score .material-symbols-rounded {
    font-size: 14px;
    color: var(--accent-yellow);
}

.media-card-format {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    background: var(--accent);
    color: var(--text-bright);
}

.media-card-status {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 500;
    text-align: center;
    color: var(--text-bright);
}

.media-card-status.airing { background: var(--status-watching); }
.media-card-status.completed { background: var(--status-completed); }
.media-card-status.upcoming { background: var(--status-planning); }

/* Hover overlay with extra info */
.media-card-hover-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 40px 10px 10px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));
    opacity: 0;
    transition: opacity var(--transition-fast);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.media-card:hover .media-card-hover-info {
    opacity: 1;
}

.media-card-hover-genres {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.media-card-hover-genres span {
    font-size: 10px;
    padding: 1px 6px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
}

.media-card-hover-episodes {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Bookmark button on hover */
.media-card-bookmark {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: var(--text-bright);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.8);
    transition: all var(--transition-fast);
    z-index: 2;
    backdrop-filter: blur(4px);
}

.media-card:hover .media-card-bookmark {
    opacity: 1;
    transform: scale(1);
}

.media-card-bookmark:hover {
    background: var(--accent);
    transform: scale(1.1) !important;
}

.media-card-bookmark .material-symbols-rounded {
    font-size: 18px;
}

/* Quick add button on hover */
.media-card-quick-add {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--text-bright);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.8);
    transition: all var(--transition-fast);
    z-index: 2;
}

.media-card:hover .media-card-quick-add {
    opacity: 1;
    transform: scale(1);
}

.media-card-quick-add:hover {
    background: var(--accent-hover);
    transform: scale(1.1) !important;
}

.media-card-quick-add .material-symbols-rounded {
    font-size: 18px;
}

.media-card-body {
    padding: 10px;
}

.media-card-title {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.media-card-subtitle {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ===== Media Grid ===== */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
}

.media-grid.large {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.media-grid.compact {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}

/* ===== Media List View ===== */
.media-list-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.media-list-item:hover {
    background: var(--bg-card-hover);
}

.media-list-img {
    width: 48px;
    height: 68px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.media-list-info {
    flex: 1;
    min-width: 0;
}

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

.media-list-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.media-list-score {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-yellow);
    display: flex;
    align-items: center;
    gap: 4px;
}

.media-list-score .material-symbols-rounded {
    font-size: 16px;
}

.media-list-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===== Section Header ===== */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-title {
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title .material-symbols-rounded {
    color: var(--accent);
    font-size: 24px;
}

.section-view-all {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color var(--transition-fast);
}

.section-view-all:hover {
    color: var(--accent);
}

/* ===== Horizontal Scroll Row ===== */
.scroll-row {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 8px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.scroll-row::-webkit-scrollbar {
    height: 4px;
}

.scroll-row .media-card {
    flex: 0 0 160px;
    scroll-snap-align: start;
}

.scroll-row .media-card.large {
    flex: 0 0 200px;
}

/* ===== Badges / Tags ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-lg);
    font-size: 12px;
    font-weight: 500;
}

.badge-accent { background: var(--accent-dim); color: var(--accent); }
.badge-green { background: rgba(76, 175, 80, 0.15); color: var(--accent-green); }
.badge-orange { background: rgba(255, 152, 0, 0.15); color: var(--accent-orange); }
.badge-red { background: rgba(244, 67, 54, 0.15); color: var(--accent-red); }
.badge-purple { background: rgba(156, 39, 176, 0.15); color: var(--accent-purple); }

.genre-tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: var(--radius-lg);
    font-size: 12px;
    font-weight: 500;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.genre-tag:hover {
    background: var(--accent-dim);
    color: var(--accent);
}

.genre-tag.active {
    background: var(--accent);
    color: var(--text-bright);
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: var(--text-bright);
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
}

.btn-danger {
    background: rgba(244, 67, 54, 0.15);
    color: var(--accent-red);
}

.btn-danger:hover {
    background: rgba(244, 67, 54, 0.25);
}

.btn-accent-green {
    background: var(--accent-green);
    color: var(--text-bright);
}

.btn-accent-green:hover {
    background: #43a047;
}

.btn-bookmark-active {
    background: var(--accent);
    color: var(--text-bright);
}

.btn-bookmark-active:hover {
    background: var(--accent-hover, #2563eb);
}

/* Bookmark Picker */
.bookmark-picker-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.15s ease;
}

.bookmark-picker {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 20px;
    min-width: 240px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.4);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bookmark-picker-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    text-align: center;
}

.bookmark-picker-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.bookmark-picker-option:hover {
    background: var(--accent);
    color: var(--text-bright);
    transform: scale(1.02);
}

.bookmark-picker-option .material-symbols-rounded {
    font-size: 20px;
}

.bookmark-picker-option.active {
    background: var(--accent);
    color: var(--text-bright);
}

.bookmark-picker-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

.bookmark-picker-remove {
    color: var(--accent-red) !important;
}

.bookmark-picker-remove:hover {
    background: var(--accent-red) !important;
    color: var(--text-bright) !important;
}

.bookmark-picker-cancel {
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    padding: 8px;
    margin-top: 4px;
}

.bookmark-picker-cancel:hover {
    color: var(--text-primary);
}

/* ===== Progress Bar ===== */
.progress-bar {
    width: 100%;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width var(--transition);
}

/* ===== Episode/Chapter Counter ===== */
.progress-counter {
    display: flex;
    align-items: center;
    gap: 8px;
}

.progress-counter-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all var(--transition-fast);
}

.progress-counter-btn:hover {
    background: var(--accent);
    color: var(--text-bright);
}

.progress-counter-value {
    font-size: 14px;
    font-weight: 500;
    min-width: 60px;
    text-align: center;
}

/* ===== Select / Dropdown ===== */
.select-wrap {
    position: relative;
}

.select-custom {
    appearance: none;
    padding: 8px 36px 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    outline: none;
    min-width: 140px;
}

.select-custom:focus {
    border-color: var(--accent);
}

.select-custom option {
    background: var(--bg-card);
    color: var(--text-primary);
}

/* ===== Filters Bar ===== */
.filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 16px 0;
    align-items: center;
}

.filters-bar .filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filters-bar .filter-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

/* ===== Tab Pills ===== */
.tab-pills {
    display: flex;
    gap: 4px;
    background: var(--bg-tertiary);
    padding: 4px;
    border-radius: var(--radius-lg);
    width: fit-content;
}

.tab-pill {
    padding: 6px 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.tab-pill:hover {
    color: var(--text-primary);
}

.tab-pill.active {
    background: var(--accent);
    color: var(--text-bright);
}

/* ===== Status Dots ===== */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.watching { background: var(--status-watching); }
.status-dot.completed { background: var(--status-completed); }
.status-dot.planning { background: var(--status-planning); }
.status-dot.onhold { background: var(--status-onhold); }
.status-dot.dropped { background: var(--status-dropped); }

/* ===== Empty State ===== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.empty-state .material-symbols-rounded {
    font-size: 64px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    color: var(--text-muted);
    max-width: 400px;
}

/* ===== Score Display ===== */
.score-display {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
}

.score-display.great { color: var(--score-great); }
.score-display.good { color: var(--score-good); }
.score-display.average { color: var(--score-average); }
.score-display.bad { color: var(--score-bad); }
.score-display.terrible { color: var(--score-terrible); }

/* ===== View Toggle ===== */
.view-toggle {
    display: flex;
    gap: 4px;
    background: var(--bg-tertiary);
    padding: 3px;
    border-radius: var(--radius-md);
}

.view-toggle-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: all var(--transition-fast);
}

.view-toggle-btn:hover {
    color: var(--text-primary);
}

.view-toggle-btn.active {
    background: var(--accent);
    color: var(--text-bright);
}

.view-toggle-btn .material-symbols-rounded {
    font-size: 20px;
}

/* ===== Responsive Components ===== */
@media (max-width: 768px) {
    .media-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 12px;
    }

    .media-grid.large {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    .scroll-row .media-card {
        flex: 0 0 130px;
    }

    .media-card-hover-info {
        display: none;
    }

    .media-card-quick-add,
    .media-card-bookmark {
        display: none;
    }

    .filters-bar {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 8px;
    }

    .section-title {
        font-size: 16px;
    }
}
