/* ─── Reset & Base ─────────────────────────────────── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #16161f;
    --bg-card-hover: #1c1c28;
    --bg-glass: rgba(22, 22, 31, 0.85);
    --bg-input: #1a1a26;
    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);
    --text-primary: #e8e8ef;
    --text-secondary: #8b8b9e;
    --text-muted: #5b5b6e;
    --accent: #5865F2;
    --accent-glow: rgba(88, 101, 242, 0.25);
    --movix: #00A8FC;
    --movix-glow: rgba(0, 168, 252, 0.25);
    --success: #43b581;
    --success-glow: rgba(67, 181, 129, 0.25);
    --danger: #ed4245;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.6);
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 20% 0%, rgba(88, 101, 242, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(0, 168, 252, 0.06) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* ─── Header ───────────────────────────────────────── */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(20px) saturate(1.5);
    -webkit-backdrop-filter: blur(20px) saturate(1.5);
    border-bottom: 1px solid var(--border);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    object-fit: contain;
}

.header-title {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--text-primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 100px;
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    border-color: var(--border-hover);
}

.tab-btn.active {
    background: rgba(88, 101, 242, 0.1);
    border-color: rgba(88, 101, 242, 0.3);
    color: var(--accent);
}

.header-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(67, 181, 129, 0.08);
    border: 1px solid rgba(67, 181, 129, 0.15);
    border-radius: 100px;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(67, 181, 129, 0.4);
    }

    50% {
        box-shadow: 0 0 0 6px rgba(67, 181, 129, 0);
    }
}

.status-text {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--success);
}

/* ─── Search ───────────────────────────────────────── */
.search-section {
    position: relative;
    z-index: 50;
    padding: 40px 32px 20px;
    max-width: 680px;
    margin: 0 auto;
}

.search-container {
    position: relative;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: var(--transition);
    overflow: hidden;
}

.search-bar:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-type-toggle {
    display: flex;
    padding: 6px;
    gap: 4px;
    flex-shrink: 0;
}

.type-toggle {
    padding: 7px 14px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.type-toggle:hover {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.04);
}

.type-toggle.active {
    background: var(--accent);
    color: white;
}

.search-divider {
    width: 1px;
    height: 24px;
    background: var(--border);
    flex-shrink: 0;
}

.search-icon-svg {
    flex-shrink: 0;
    margin-left: 12px;
    color: var(--text-muted);
}

.search-input {
    flex: 1;
    padding: 14px 16px 14px 8px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    outline: none;
    min-width: 0;
}

.search-input::placeholder {
    color: var(--text-muted);
}

/* ─── Search Results Dropdown ──────────────────────── */
.search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: 400px;
    overflow-y: auto;
    display: none;
    z-index: 60;
}

.search-results.active {
    display: block;
    animation: dropIn 0.2s ease;
}

@keyframes dropIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 1px solid var(--border);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: var(--bg-card-hover);
}

.search-result-poster {
    width: 40px;
    height: 60px;
    border-radius: 6px;
    object-fit: cover;
    background: var(--bg-input);
    flex-shrink: 0;
}

.search-result-info {
    flex: 1;
    min-width: 0;
}

.search-result-title {
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-year {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.search-result-add {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}


.search-result-add:hover {
    transform: scale(1.15);
    box-shadow: 0 0 12px var(--accent-glow);
}

.search-result-add.added {
    background: var(--success);
    pointer-events: none;
}

.search-loading,
.search-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}



/* ─── Series Options (Season/Episode Picker) ──────── */
.series-options {
    display: flex;
    padding: 8px 14px 12px;
    background: rgba(88, 101, 242, 0.06);
    border-top: 1px solid rgba(88, 101, 242, 0.15);
    animation: dropIn 0.2s ease;
}

.series-options-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    width: 100%;
}

.series-option-group {
    flex: 1;
}

.series-option-group label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    font-weight: 500;
}

.optional-label {
    opacity: 0.6;
    font-weight: 400;
}

.series-season-input,
.series-episode-input {
    width: 100%;
    padding: 6px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    outline: none;
    transition: var(--transition);
}

.series-season-input:focus,
.series-episode-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.series-add-btn {
    padding: 6px 16px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
}

.series-add-btn:hover {
    background: #4752c4;
    box-shadow: 0 0 12px var(--accent-glow);
}

.search-result-add.series-expand {
    background: var(--movix);
}

.search-result-add.series-expand.expanded {
    background: var(--text-muted);
}

.search-result-add.series-expand:hover {
    box-shadow: 0 0 12px var(--movix-glow);
}

/* ─── Movies Section ───────────────────────────────── */
.movies-section {
    position: relative;
    z-index: 1;
    padding: 10px 32px 60px;
    max-width: 1200px;
    margin: 0 auto;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.section-title {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.movie-count {
    font-size: 0.82rem;
    color: var(--text-muted);
    padding: 4px 12px;
    background: var(--bg-input);
    border-radius: 100px;
}

/* ─── Movie Grid ───────────────────────────────────── */
.movie-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

/* ─── Movie Card ───────────────────────────────────── */
.movie-card {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border);
    transition: var(--transition);
    cursor: pointer;
    animation: cardIn 0.3s ease;
}

@keyframes cardIn {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.movie-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}

.movie-card-poster {
    position: relative;
    width: 100%;
    aspect-ratio: 2/3;
    overflow: hidden;
}

.movie-card-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.movie-card:hover .movie-card-poster img {
    transform: scale(1.05);
}

.movie-card-poster .no-poster {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a26, #12121a);
    font-size: 2.5rem;
}

/* Status badges on poster */
.movie-card-badges {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.badge {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    backdrop-filter: blur(8px);
}

.badge-torr9 {
    background: rgba(88, 101, 242, 0.85);
    color: white;
}

.badge-movix {
    background: rgba(0, 168, 252, 0.85);
    color: white;
}

.badge-waiting {
    background: rgba(91, 91, 110, 0.7);
    color: var(--text-secondary);
}

/* Delete button */
.movie-card-delete {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(237, 66, 69, 0.85);
    backdrop-filter: blur(8px);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    opacity: 0;
    transition: var(--transition);
}

.movie-card:hover .movie-card-delete {
    opacity: 1;
}

.movie-card-delete:hover {
    background: var(--danger);
    transform: scale(1.15);
}

/* Card info */
.movie-card-info {
    padding: 12px 14px;
}

.movie-card-title {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.movie-card-year {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ─── Empty State ──────────────────────────────────── */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.empty-sub {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ─── Toast Notification ───────────────────────────── */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 200;
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
        transform: translateY(8px);
    }
}

/* ─── Scrollbar ────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ─── Movie Detail Modal ──────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    position: relative;
    width: 90vw;
    max-width: 860px;
    max-height: 90vh;
    border-radius: var(--radius-xl);
    overflow: hidden;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6), 0 0 80px rgba(88, 101, 242, 0.05);
    transform: translateY(24px) scale(0.96);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
}

.modal-overlay.active .modal-container {
    transform: translateY(0) scale(1);
}

.modal-backdrop {
    position: relative;
    width: 100%;
    height: 260px;
    background-size: cover;
    background-position: center top;
    background-color: var(--bg-card);
}

.modal-backdrop::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, var(--bg-secondary) 0%, rgba(18, 18, 26, 0.6) 60%, rgba(18, 18, 26, 0.2) 100%);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 10;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(12px);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    background: rgba(237, 66, 69, 0.8);
    transform: scale(1.1);
}

.modal-content {
    position: relative;
    z-index: 2;
    padding: 0 32px 32px;
    margin-top: -80px;
}

.modal-header {
    display: flex;
    gap: 24px;
    margin-bottom: 28px;
}

.modal-poster {
    flex-shrink: 0;
    width: 160px;
    height: 240px;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-card);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.08);
}

.modal-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-poster .no-poster {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    background: linear-gradient(135deg, #1a1a26, #12121a);
}

.modal-info {
    flex: 1;
    min-width: 0;
    padding-top: 40px;
}

.modal-title {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.2;
    margin-bottom: 4px;
}

.modal-tagline {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 12px;
}

.modal-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 100px;
    border: 1px solid var(--border);
}

.meta-item .meta-icon {
    font-size: 0.85rem;
}

.meta-star {
    color: #fbbf24;
}

.modal-genres {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.genre-tag {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 100px;
    background: linear-gradient(135deg, rgba(88, 101, 242, 0.15), rgba(0, 168, 252, 0.1));
    color: var(--accent);
    border: 1px solid rgba(88, 101, 242, 0.2);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.modal-overview {
    font-size: 0.88rem;
    line-height: 1.65;
    color: var(--text-secondary);
}

/* ─── Modal Sections ─────────────────────────────── */
.modal-section {
    margin-top: 28px;
}

.modal-section-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.01em;
}

.section-icon {
    font-size: 1.1rem;
}

/* ─── Source Cards ──────────────────────────────────── */
.sources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
}

.source-card {
    position: relative;
    padding: 18px 20px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 1px solid var(--border);
    transition: var(--transition);
    overflow: hidden;
}

.source-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    border-radius: 4px 0 0 4px;
}

.source-card.source-found::before {
    background: linear-gradient(180deg, var(--success), #2ecc71);
    box-shadow: 0 0 12px var(--success-glow);
}

.source-card.source-waiting::before {
    background: var(--text-muted);
}

.source-card:hover {
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
}

.source-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.source-card-name {
    display: flex;
    align-items: center;
    gap: 8px;
}

.source-card-name .source-icon {
    font-size: 1.2rem;
}

.source-card-name h4 {
    font-size: 0.92rem;
    font-weight: 700;
}

.source-status-badge {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 3px 10px;
    border-radius: 100px;
}

.source-status-badge.found {
    background: rgba(67, 181, 129, 0.15);
    color: var(--success);
    border: 1px solid rgba(67, 181, 129, 0.25);
}

.source-status-badge.waiting {
    background: rgba(91, 91, 110, 0.15);
    color: var(--text-muted);
    border: 1px solid rgba(91, 91, 110, 0.2);
    animation: pulseWaiting 2s infinite;
}

@keyframes pulseWaiting {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.source-card-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    line-height: 1.4;
}

.source-card-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.source-detail {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.source-detail .detail-label {
    color: var(--text-muted);
    min-width: 90px;
}

.source-detail .detail-value {
    font-weight: 500;
    word-break: break-all;
}

.source-card-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 14px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
}

.source-card-link.torr9-link {
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    color: white;
}

.source-card-link.torr9-link:hover {
    box-shadow: 0 4px 20px var(--accent-glow);
    transform: translateY(-1px);
}

.source-card-link.movix-link {
    background: linear-gradient(135deg, var(--movix), #0077cc);
    color: white;
}

.source-card-link.movix-link:hover {
    box-shadow: 0 4px 20px var(--movix-glow);
    transform: translateY(-1px);
}

/* ─── Cast Grid ────────────────────────────────────── */
.cast-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}

.cast-card {
    text-align: center;
    padding: 12px 8px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.cast-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.cast-photo {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 8px;
    background: var(--bg-input);
    border: 2px solid var(--border);
}

.cast-no-photo {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    margin: 0 auto 8px;
    background: linear-gradient(135deg, var(--bg-input), var(--bg-card));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    border: 2px solid var(--border);
}

.cast-name {
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cast-character {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ─── Modal Loading ─────────────────────────────────── */
.modal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    gap: 16px;
}

.modal-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.modal-loading-text {
    font-size: 0.88rem;
    color: var(--text-muted);
}

/* ─── Media Type Badge ─────────────────────────────── */
.badge-type {
    position: absolute;
    bottom: 8px;
    left: 8px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    backdrop-filter: blur(8px);
}

.badge-movie {
    background: rgba(88, 101, 242, 0.75);
    color: white;
}

.badge-tv {
    background: rgba(168, 85, 247, 0.85);
    color: white;
}

/* ─── Logs Section ─────────────────────────────────── */
.logs-section {
    position: relative;
    z-index: 1;
    padding: 10px 32px 60px;
    max-width: 900px;
    margin: 0 auto;
}

.refresh-logs-btn {
    padding: 6px 14px;
    background: rgba(88, 101, 242, 0.1);
    border: 1px solid rgba(88, 101, 242, 0.25);
    border-radius: 100px;
    color: var(--accent);
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.refresh-logs-btn:hover {
    background: rgba(88, 101, 242, 0.2);
}

.logs-timeline {
    display: flex;
    flex-direction: column;
    gap: 2px;
    animation: cardIn 0.3s ease;
}

.logs-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.log-entry {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.log-entry:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
}

.log-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.03);
}

.log-body {
    flex: 1;
    min-width: 0;
}

.log-message {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 3px;
}

.log-time {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.log-details {
    display: inline-flex;
    gap: 6px;
    margin-left: 8px;
}

.log-tag {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.log-tag-torr9 {
    background: rgba(88, 101, 242, 0.15);
    color: var(--accent);
}

.log-tag-movix {
    background: rgba(0, 168, 252, 0.15);
    color: var(--movix);
}

.log-tag-found {
    background: rgba(67, 181, 129, 0.15);
    color: var(--success);
}

.log-tag-error {
    background: rgba(237, 66, 69, 0.15);
    color: var(--danger);
}

/* ─── Responsive ───────────────────────────────────── */
@media (max-width: 768px) {
    .header {
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .header-right {
        flex-wrap: wrap;
        gap: 6px;
    }

    .tab-btn span {
        display: none;
    }

    .search-section {
        padding: 24px 16px 12px;
    }

    .search-bar {
        flex-wrap: wrap;
    }

    .search-type-toggle {
        width: 100%;
        justify-content: center;
        border-bottom: 1px solid var(--border);
        padding-bottom: 6px;
    }

    .search-divider {
        display: none;
    }

    .movies-section,
    .logs-section {
        padding: 10px 16px 40px;
    }

    .movie-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }

    /* Delete button always visible on mobile (no hover) */
    .movie-card-delete {
        opacity: 1;
    }

    .modal-container {
        width: 95vw;
        max-height: 95vh;
    }

    .modal-content {
        padding: 0 16px 24px;
    }

    .modal-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .modal-poster {
        width: 130px;
        height: 195px;
    }

    .modal-info {
        padding-top: 12px;
    }

    .modal-meta {
        justify-content: center;
    }

    .modal-genres {
        justify-content: center;
    }

    .sources-grid {
        grid-template-columns: 1fr;
    }

    .cast-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    }
}