/**
 * Tangerine Theme - Library CSS
 * Media browser with infinite scroll
 * Tangerine theme color scheme with orange accents (#e17c52)
 */

/* ==========================================================================
   Global Styles
   ========================================================================== */

/* Remove text cursor from all elements except inputs */
* {
    caret-color: transparent;
}

input, textarea, [contenteditable="true"] {
    caret-color: auto;
}

/* ==========================================================================
   Container & Layout
   ========================================================================== */

.library-container {
    width: 100%;
    max-width: 100%;
    padding: 1.5rem;
    box-sizing: border-box;
}

/* ==========================================================================
   Header Section
   ========================================================================== */

.library-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.library-title-section {
    flex: 1 1 auto;
    min-width: 250px;
}

.library-title {
    font-size: 2rem;
    font-weight: bold;
    margin: 0 0 0.5rem 0;
    line-height: 1.2;
    color: #e17c52;
}

.library-subtitle {
    font-size: 0.95rem;
    opacity: 0.7;
    margin: 0;
    line-height: 1.4;
}

/* ==========================================================================
   Action Buttons - Tangerine Theme
   ========================================================================== */

/* Utility Classes */
.w-4 {
    width: 1rem;
    height: 1rem;
}

.w-5 {
    width: 1.25rem;
    height: 1.25rem;
}

.h-4 {
    width: 1rem;
    height: 1rem;
    color: #e0e0e0;
}

.h-5 {
    width: 1.25rem;
    height: 1.25rem;
    color: #e0e0e0;
}

.ml-1 {
    margin-left: 0.25rem;
}

.hidden {
    display: none;
}
.hidden.sm\:inline {
    color: #e0e0e0;
}

/* Show text on small screens and up */
@media (min-width: 640px) {
    .hidden.sm\:inline {
        display: inline;
    }
}

/* Action Button Styles */
.action-btn {
    cursor: pointer;
    user-select: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: #3d3d3d;
    padding: 0.625rem 1.25rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
    border-radius: 0.375rem;
    font-size: 0.9375rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.action-btn:active {
    transform: translateY(0);
}

.action-btn-sm {
    padding: 0.625rem 1.25rem;
}

.action-btn-primary {
    background: #e17c52;
    color: white;
}

.action-btn-primary:hover {
    background: #d66a40;
}

/* .action-btn-ghost {
    background: #374151;
    color: white;
} */

/* .action-btn-ghost:hover {
    background: #4b5563;
} */

/* Utility classes for flex layout */
.flex {
    display: flex;
    position: relative;
    top: 24px;
}

.items-center {
    align-items: center;
}

.gap-2 {
    gap: 12px;
}

/* Join group for buttons */
.join {
    display: inline-flex;
    border-radius: 0.375rem;
    overflow: hidden;
}

.join .join-item {
    border-radius: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.join .join-item:first-child {
    border-top-left-radius: 0.375rem;
    border-bottom-left-radius: 0.375rem;
}

.join .join-item:last-child {
    border-top-right-radius: 0.375rem;
    border-bottom-right-radius: 0.375rem;
    border-right: none;
}
.media-grid .hover-title {
    font-size: .95em;
}
/* ==========================================================================
   Filters Section
   ========================================================================== */

.library-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: stretch;
}

.filter-search {
    flex: 1 1 300px;
    min-width: 250px;
}

.search-input-wrapper {
    position: relative;
    width: 100%;
}

.filter-search input {
    width: 100%;
    box-sizing: border-box;
    padding-right: 2.5rem; /* Make room for clear button */
}

.search-clear-btn {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
}

.search-clear-btn:hover {
    color: #ff6b35;
    background: rgba(255, 107, 53, 0.1);
}

.search-clear-btn svg {
    width: 16px;
    height: 16px;
}

.filter-controls {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.filter-select {
    min-width: 150px;
    flex-shrink: 0;
}

/* ==========================================================================
   Results Info
   ========================================================================== */

.library-info {
    margin-bottom: 1rem;
    font-size: 0.9rem;
    opacity: 0.8;
}

/* ==========================================================================
   Media Grid
   ========================================================================== */

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1.5rem;
    padding-bottom: 2rem;
    justify-content: start;
}

/* Responsive grid columns - posters grow to fill available space */
@media (min-width: 480px) {
    .media-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
}

@media (min-width: 768px) {
    .media-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
}

@media (min-width: 1024px) {
    .media-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
}

@media (min-width: 1440px) {
    .media-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
}

/* List view */
.media-grid.list-view {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: #fba8761a;
    border-radius: 10px;
    overflow: hidden;
}

/* List header row - positioned outside the list container */
.list-header {
    display: grid;
    grid-template-columns: 40px 50px 1fr 80px 100px 100px 100px 100px;
    gap: 1rem;
    padding: 0.75rem 1rem;
    /* background: var(--bg-tertiary, #353535);
    border: 1px solid var(--border-color, #444); */
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    font-weight: 600;
    font-size: 0.875rem;
    opacity: 0.9;
    margin-bottom: 0;
}

/* List header with checkbox (in selection mode) */
.list-header:has(.list-col-checkbox) {
    grid-template-columns: 40px 40px 50px 1fr 80px 100px 100px 100px 100px;
}

/* List row */
.list-row {
    display: grid;
    grid-template-columns: 40px 50px 1fr 80px 100px 100px 100px 100px;
    gap: 1rem;
    align-items: center;
    padding: 0.4rem 1rem;
    border-bottom: 1px solid #e17c5242;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

/* List row with checkbox (in selection mode) */
.list-row:has(.list-col-checkbox) {
    grid-template-columns: 40px 40px 50px 1fr 80px 100px 100px 100px 100px;
}

.list-row:hover {
    background-color: var(--bg-hover, rgba(255, 136, 0, 0.1));
}

.list-row:last-child {
    border-bottom: none;
}

/* List columns */
.list-col {
    display: flex;
    align-items: center;
}

.list-col-badge {
    justify-content: center;
}

.list-col-checkbox {
    justify-content: center;
}

.list-col-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.list-col-poster {
    justify-content: center;
}

.list-col-poster img {
    width: 40px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.list-col-title {
    flex: 1;
    min-width: 0;
}

.list-title-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.list-col-title .type-badge {
    flex-shrink: 0;
    padding: 0.125rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.type-badge.type-movie {
    background-color: #a27cf6b5;
    color: white;
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    backdrop-filter: blur(4px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.type-badge.type-tv {
    background-color: #326bc8a8;
    color: white;
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    backdrop-filter: blur(4px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.list-col-year {
    text-align: center;
    opacity: 0.7;
    font-size: 0.875rem;
}

.list-col-status {
    text-align: center;
    opacity: 0.7;
    font-size: 0.875rem;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.status-badge.status-collected svg {
    color: #10b981;
}

.status-badge.status-blacklisted svg {
    color: #ef4444;
}

.list-col-quality {
    text-align: center;
    opacity: 0.7;
    font-size: 0.875rem;
}

.list-col-state {
    text-align: center;
    opacity: 0.7;
    font-size: 0.875rem;
}

.list-col-size {
    text-align: right;
    opacity: 0.7;
    font-size: 0.875rem;
}

/* Hide columns on smaller screens */
@media (max-width: 1024px) {
    .list-header,
    .list-row {
        grid-template-columns: 40px 50px 1fr 100px;
    }

    .list-header:has(.list-col-checkbox),
    .list-row:has(.list-col-checkbox) {
        grid-template-columns: 40px 40px 50px 1fr 100px;
    }

    .list-col-year,
    .list-col-quality,
    .list-col-size {
        display: none;
    }
}

@media (max-width: 640px) {
    /* Mobile: Show only checkbox, poster, and title with badge */
    .list-header,
    .list-row {
        grid-template-columns: 40px 50px 1fr;
        gap: 0.75rem;
        padding: 0.75rem 0.5rem;
    }

    .list-header:has(.list-col-checkbox),
    .list-row:has(.list-col-checkbox) {
        grid-template-columns: 40px 40px 50px 1fr;
    }

    /* Hide all columns except title on mobile */
    .list-col-status,
    .list-col-state,
    .list-col-year,
    .list-col-quality,
    .list-col-size {
        display: none;
    }

    /* Hide header on mobile */
    .list-header {
        display: none;
    }

    /* Title column takes full width and displays badge on the right */
    .list-col-title {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        min-width: 0;
    }

    .list-title-wrapper {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        flex: 1;
        min-width: 0;
    }

    /* Title truncation for long text */
    .list-title {
        flex: 1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        min-width: 0;
        order: 1;
    }

    /* Badge positioned on the right */
    .list-col-title .type-badge {
        flex-shrink: 0;
        order: 2;
    }

    /* Smaller poster on mobile */
    .list-col-poster img {
        width: 35px;
        height: 52px;
    }

    /* Adjust checkbox size */
    .list-col-checkbox input[type="checkbox"] {
        width: 16px;
        height: 16px;
    }
}

/* ==========================================================================
   Media Card
   ========================================================================== */

.media-card {
    position: relative;
    background: #2a2a2a;
    border-radius: 0.5rem;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    aspect-ratio: 2 / 3;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.media-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    ring: 2px solid rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   Poster
   ========================================================================== */

.media-poster {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.media-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

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

.media-poster img.placeholder {
    object-fit: contain;
    padding: 20%;
    opacity: 0.3;
}

/* Badge positioning */
.badge-top-left {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 10;
}

.badge-top-right {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    align-items: flex-end;
}

/* ==========================================================================
   Badges
   ========================================================================== */

.type-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    backdrop-filter: blur(4px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.badge-tv {
    background: #326bc8a8;
    color: white;
}

.badge-movie {
    background: #a27cf6b5;
    color: white;
}

.badge-blacklisted {
    background: rgba(239, 68, 68, 0.8);
    color: white;
    border: 1px solid rgba(239, 68, 68, 1);
}

.episode-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 0.25rem;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    backdrop-filter: blur(4px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* ==========================================================================
   Discover-Style Badges (Status & Media Type)
   ========================================================================== */

/* Status badge with icon - stacks inside badge containers */
.db-status-badge {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.db-status-badge svg {
    width: 16px;
    height: 16px;
}

.db-status-badge.present,
.db-status-badge.collected {
    background-color: rgba(16, 185, 129, 0.5);
    color: white;
}

.db-status-badge.missing {
    background-color: rgba(239, 68, 68, 0.5);
    color: white;
}

.db-status-badge.wanted,
.db-status-badge.partial {
    background-color: rgba(234, 179, 8, 0.5);
    color: white;
}

.db-status-badge.upgrading {
    background-color: rgba(59, 130, 246, 0.5);
    color: white;
}

.db-status-badge.blacklisted {
    background-color: rgba(30, 30, 30, 0.5);
    color: white;
}

.db-status-badge.unreleased {
    background-color: rgba(249, 115, 22, 0.5);
    color: white;
}

/* Media type badge with icon - stacks inside badge containers */
.media-type-badge {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.media-type-badge svg {
    width: 16px;
    height: 16px;
}

.media-type-badge.badge-movie {
    background-color: rgba(139, 92, 246, 0.5);
    color: white;
}

.media-type-badge.badge-tv {
    background-color: rgba(59, 130, 246, 0.5);
    color: white;
}

/* Split badges for mixed states - 50/50 gradient backgrounds */
.db-status-badge.split-badge {
    overflow: hidden;
}

/* Priority order: Wanted > Unreleased > Collected > Blacklisted */
/* Primary state is on the left (50%), secondary on the right (50%) */

/* Wanted + Unreleased */
.db-status-badge.split-wanted-unreleased {
    background: linear-gradient(90deg, rgba(234, 179, 8, 0.5) 50%, rgba(249, 115, 22, 0.5) 50%) !important;
}

/* Wanted + Collected */
.db-status-badge.split-wanted-collected {
    background: linear-gradient(90deg, rgba(234, 179, 8, 0.5) 50%, rgba(16, 185, 129, 0.5) 50%) !important;
}

/* Wanted + Blacklisted */
.db-status-badge.split-wanted-blacklisted {
    background: linear-gradient(90deg, rgba(234, 179, 8, 0.5) 50%, rgba(30, 30, 30, 0.5) 50%) !important;
}

/* Unreleased + Collected */
.db-status-badge.split-unreleased-collected {
    background: linear-gradient(90deg, rgba(249, 115, 22, 0.5) 50%, rgba(16, 185, 129, 0.5) 50%) !important;
}

/* Unreleased + Blacklisted */
.db-status-badge.split-unreleased-blacklisted {
    background: linear-gradient(90deg, rgba(249, 115, 22, 0.5) 50%, rgba(30, 30, 30, 0.5) 50%) !important;
}

/* Collected + Blacklisted */
.db-status-badge.split-collected-blacklisted {
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.5) 50%, rgba(30, 30, 30, 0.5) 50%) !important;
}

/* Progress bar */
.progress-bar-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    z-index: 5;
}

.progress-bar {
    height: 100%;
    background: #ff6b35; /* Tangerine accent */
    transition: width 0.3s ease;
}

/* Hover overlay */
.hover-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.2) 40%, transparent 60%);
    display: flex;
    align-items: flex-end;
    padding: 0.75rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 15;
}

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

.hover-content {
    width: 100%;
    transform: translateY(1rem);
    transition: transform 0.3s ease;
}

.media-card:hover .hover-content {
    transform: translateY(0);
}

.hover-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: white;
    margin: 0 0 0.25rem 0;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hover-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.7);
}

.hover-year,
.hover-progress {
    white-space: nowrap;
}

/* Media info removed - now using hover overlay */

/* ==========================================================================
   Loading & Empty States
   ========================================================================== */

.loading-indicator {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    gap: 1rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.empty-state {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 1rem;
    text-align: center;
}

.empty-icon {
    width: 4rem;
    height: 4rem;
    opacity: 0.3;
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin: 0 0 0.5rem 0;
}

.empty-state p {
    font-size: 1rem;
    opacity: 0.7;
    margin: 0;
}

.error-message {
    padding: 1rem;
    margin-bottom: 1rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 0.5rem;
    color: #ef4444;
    text-align: center;
}

/* ==========================================================================
   Mobile Responsive
   ========================================================================== */
@media (max-width: 1045px) {
    .flex.items-center.gap-2 {
    padding-bottom: 20px;
    }
}

@media (max-width: 768px) {
    .library-container {
        padding: 1rem;
    }

    .library-header {
        flex-direction: column;
        align-items: stretch;
    }

    .library-actions {
        flex-direction: column;
        width: 100%;
    }

    .view-toggle {
        width: 100%;
    }

    .view-toggle .btn {
        flex: 1;
    }

    .filter-controls {
        flex-direction: column;
        width: 100%;
    }

    .filter-select {
        width: 100%;
    }

    .library-title {
        font-size: 1.75rem;
    }

    .btn-text {
        display: inline;
    }

    .media-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 1rem;
    }
    .flex.items-center.gap-2 {
        justify-content: flex-end;
        padding-bottom: 10px;
    }
}

@media (max-width: 480px) {
    .library-container {
        padding: 0.75rem;
    }

    .media-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .library-title {
        font-size: 1.5rem;
    }

    .btn-text {
        display: none;
    }
}

/* ============================================================================
   MULTI-SELECT DELETION STYLES (Tangerine Theme)
   ============================================================================ */

/* Selection checkbox overlay (for grid view) */
.selection-checkbox {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 10;
    /* background: rgba(0, 0, 0, 0.9); */
    border: 2px solid rgb(240 86 29 / 43%);
    border-radius: 6px;
    /* padding: 4px; */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Override for list view - checkboxes are part of grid layout */
.list-row .selection-checkbox {
    position: static;
    background: transparent;
    border: none;
    padding: 0;
}

.selection-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    margin: 0;
    accent-color: #ff6b35;
}

/* Selection mode styling */
.media-grid.selection-mode .media-card {
    cursor: pointer;
    transition: all 0.2s ease;
}

.media-grid.selection-mode .media-card:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 24px rgba(255, 107, 53, 0.3);
}

.media-grid.selection-mode .media-card:has(input[type="checkbox"]:checked) {
    border: 2px solid #ff6b35;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.2);
}

/* Button states */
.btn-danger {
    background: linear-gradient(145deg, #dc3545, #c82333);
    color: white;
    border-color: #dc3545;
}

.btn-danger:hover {
    background: linear-gradient(145deg, #c82333, #bd2130);
    border-color: #bd2130;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

/* Maintenance button icon */
.fa-screwdriver-wrench {
    font-size: 1rem;
}

.list-col-checkbox {
    justify-content: center;
}

.list-col-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Hide trailer text on mobile, show only play icon */
@media (max-width: 768px) {
    .trailer-text {
        display: none;
    }
}

/* ============================================================================
   TANGERINE HEADER REDESIGN
   Scoped to body[data-theme="tangerine"] — header + filter bar only
   ============================================================================ */

body[data-theme="tangerine"] {
    --lib-surf:    #161616;
    --lib-surf2:   #1e1e1e;
    --lib-border:  #2e2e2e;
    --lib-border2: #3a3a3a;
    --lib-accent:  #e8601c;
    --lib-accent-h:#f07030;
    --lib-text:    #e8e8e8;
    --lib-muted:   #888;
    --lib-font:    'Inter', system-ui, sans-serif;
    --lib-radius:  6px;
}

/* ── title ───────────────────────────────────────────────── */
body[data-theme="tangerine"] .library-title {
    font-family: var(--lib-font);
    font-size: 1.5rem;
    font-weight: 700;
    color: #e0e0e0;
    letter-spacing: -0.01em;
    margin: 0 0 2px 0;
    border-left: 3px solid var(--lib-accent);
    padding-left: 10px;
}

body[data-theme="tangerine"] .library-subtitle {
    font-family: var(--lib-font);
    font-size: 0.82rem;
    color: var(--lib-muted);
    opacity: 1;
    margin: 0;
    padding-left: 13px;
}

/* ── header row ──────────────────────────────────────────── */
body[data-theme="tangerine"] .library-header {
    align-items: center;
    margin-bottom: 1rem;
    gap: 0.75rem;
}

/* ── action buttons ──────────────────────────────────────── */
body[data-theme="tangerine"] .action-btn {
    font-family: var(--lib-font);
    font-size: 0.82rem;
    font-weight: 500;
    background: var(--lib-surf2);
    border: 1px solid var(--lib-border2);
    color: var(--lib-text);
    border-radius: var(--lib-radius);
    padding: 0 12px;
    height: 30px;
    gap: 5px;
    transition: background 0.15s, border-color 0.15s;
    transform: none;
    box-shadow: none;
}

body[data-theme="tangerine"] .action-btn:hover {
    background: #2a2a2a;
    border-color: #4a4a4a;
    transform: none;
    box-shadow: none;
}

body[data-theme="tangerine"] .action-btn svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

/* active/primary = orange (active view toggle) */
body[data-theme="tangerine"] .action-btn-primary,
body[data-theme="tangerine"] .join .action-btn-primary {
    background: var(--lib-accent);
    border-color: var(--lib-accent);
    color: #fff;
}
body[data-theme="tangerine"] .action-btn-primary:hover,
body[data-theme="tangerine"] .join .action-btn-primary:hover {
    background: var(--lib-accent-h);
    border-color: var(--lib-accent-h);
}

/* danger = delete btn */
body[data-theme="tangerine"] .action-btn.btn-danger {
    background: transparent;
    border-color: rgba(224,82,82,.4);
    color: #e05252;
}
body[data-theme="tangerine"] .action-btn.btn-danger:hover {
    background: rgba(224,82,82,.12);
    border-color: #e05252;
}

/* view toggle join group */
body[data-theme="tangerine"] .join {
    border-radius: var(--lib-radius);
    overflow: hidden;
    border: 1px solid var(--lib-border2);
    gap: 0;
}
body[data-theme="tangerine"] .join .join-item {
    border-radius: 0;
    border-right: 1px solid var(--lib-border2);
    border-top: none;
    border-bottom: none;
    border-left: none;
}
body[data-theme="tangerine"] .join .join-item:last-child {
    border-right: none;
}

/* button text color inherit */
body[data-theme="tangerine"] .hidden.sm\:inline,
body[data-theme="tangerine"] .action-btn span {
    color: inherit;
}

/* flex row position fix */
body[data-theme="tangerine"] .flex.items-center.gap-2 {
    top: 0;
    gap: 6px;
}

/* ── filter bar ──────────────────────────────────────────── */
body[data-theme="tangerine"] .library-filters {
    background: var(--lib-surf);
    border: 1px solid var(--lib-border2);
    border-radius: var(--lib-radius);
    padding: 10px 12px;
    gap: 8px;
    margin-bottom: 1rem;
}

/* search input */
body[data-theme="tangerine"] .filter-search input,
body[data-theme="tangerine"] #search-input {
    background: #1a1a1a !important;
    border: 1px solid var(--lib-border2) !important;
    color: var(--lib-text) !important;
    border-radius: var(--lib-radius) !important;
    font-family: var(--lib-font) !important;
    font-size: 0.85rem !important;
    height: 32px;
    padding: 0 32px 0 10px !important;
    box-shadow: none !important;
}
body[data-theme="tangerine"] #search-input:focus {
    border-color: var(--lib-accent) !important;
    outline: none !important;
}
body[data-theme="tangerine"] #search-input::placeholder {
    color: var(--lib-muted);
}

/* clear button */
body[data-theme="tangerine"] .search-clear-btn {
    color: var(--lib-muted);
}
body[data-theme="tangerine"] .search-clear-btn:hover {
    color: var(--lib-accent);
    background: rgba(232,96,28,.1);
}

/* filter selects */
body[data-theme="tangerine"] .filter-select,
body[data-theme="tangerine"] .filter-controls select {
    background: #1a1a1a !important;
    border: 1px solid var(--lib-border2) !important;
    color: var(--lib-text) !important;
    border-radius: var(--lib-radius) !important;
    font-family: var(--lib-font) !important;
    font-size: 0.82rem !important;
    height: 32px;
    padding: 0 8px !important;
    min-width: 130px;
    cursor: pointer;
    appearance: auto;
}
body[data-theme="tangerine"] .filter-select:focus,
body[data-theme="tangerine"] .filter-controls select:focus {
    border-color: var(--lib-accent) !important;
    outline: none !important;
}

/* ── results count ───────────────────────────────────────── */
body[data-theme="tangerine"] .library-info {
    font-family: var(--lib-font);
    font-size: 0.78rem;
    color: var(--lib-muted);
    opacity: 1;
    margin-bottom: 0.75rem;
}

/* ── mobile header: title top-left, buttons top-right ───── */
@media (max-width: 768px) {
    body[data-theme="tangerine"] .library-header {
        flex-direction: column;
        align-items: center;
        flex-wrap: nowrap;
    }

    body[data-theme="tangerine"] .library-title-section {
        flex: 1 1 0;
        min-width: 0;
        align-self: start;
    }

    body[data-theme="tangerine"] .library-title {
        font-size: 1.25rem;
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
    }

    body[data-theme="tangerine"] .library-subtitle {
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
    }

    body[data-theme="tangerine"] .flex.items-center.gap-2 {
        flex-shrink: 0;
        padding-bottom: 0;
        flex-wrap: nowrap;
        align-self: end;
    }
}
