:root { --accent: #ef4444; --glow: rgba(239, 68, 68, 0.5); }
body { 
    font-family: 'Plus Jakarta Sans', sans-serif; 
    background: #02040a; color: white;
    height: 100vh; width: 100vw;
    display: grid; place-items: center;
    overflow: hidden; margin: 0; padding: 0;
}
.ambient-bg {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 140vw; height: 140vh;
    background: radial-gradient(circle at 50% 50%, var(--glow) 0%, transparent 60%);
    opacity: 0.15; filter: blur(90px); z-index: -1;
    pointer-events: none; animation: pulse 10s infinite ease-in-out;
}
@keyframes pulse { 0%,100% { transform: translate(-50%, -50%) scale(1); } 50% { transform: translate(-50%, -50%) scale(1.1); } }

.app-widget { 
    width: 100%; max-width: 440px; height: 100%; max-height: 100%;
    background: #0f1014;
    display: flex; flex-direction: column; overflow: hidden; 
    position: relative; z-index: 10;
}
@media (min-width: 450px) {
    .app-widget { height: 90vh; max-height: 850px; width: 90%; border-radius: 2.5rem; box-shadow: 0 50px 100px -20px rgba(0,0,0,0.9), inset 0 0 0 1px rgba(255,255,255,0.08); }
}

/* Poster Area */
.poster-frame { 
    flex: 1.4; 
    position: relative; 
    overflow: hidden; 
    z-index: 1; 
    background: #15151a; 
    flex-shrink: 0; 
    min-height: 30vh;
}
.poster-img { 
    width: 100%; height: 100%; object-fit: cover; 
    transition: transform 0.8s ease, opacity 0.5s; 
    position: absolute; inset: 0; 
    animation: subtle-zoom 20s infinite ease-in-out; 
}
@keyframes subtle-zoom {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.poster-gradient { position: absolute; inset: 0; background: linear-gradient(to top, #0f1014 5%, rgba(15,16,20,0.6) 40%, transparent 80%); z-index: 2; pointer-events: none; }
.poster-skeleton { position: absolute; inset:0; background: #15151a; z-index:-1; }
.poster-placeholder { position: absolute; inset:0; display:flex; align-items:center; justify-content:center; color:#222; opacity: 1; transition: opacity 0.5s; }
.watermark-icon { width: 80px; height: 80px; opacity: 0.1; }
.poster-content { position: absolute; bottom: 0; width: 100%; padding: 2rem; padding-bottom: 1.5rem; z-index: 10; display: flex; flex-direction: column; justify-content: flex-end; pointer-events: none; }

/* Info Panel */
.info-panel { 
    flex: 1; 
    padding: 0 2rem 2rem 2rem; 
    display: flex; 
    flex-direction: column; 
    z-index: 20; 
    position: relative; 
    background: #0f1014; 
    min-height: 0; 
}

/* Description Box */
.desc-box {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
    padding-right: 4px;
    mask-image: linear-gradient(to bottom, black 90%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 90%, transparent 100%);
}

/* UI Elements */
.mode-switcher { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 4px; background: rgba(255,255,255,0.03); padding: 4px; border-radius: 16px; margin-bottom: 0.8rem; border: 1px solid rgba(255,255,255,0.05); flex-shrink: 0; }
.mode-btn { padding: 10px 0; text-align: center; border-radius: 12px; font-size: 10px; font-weight: 800; text-transform: uppercase; color: #64748b; transition: all 0.3s; cursor: pointer; }
.mode-btn:hover { color: white; }
.mode-btn.active { background: var(--accent); color: white; box-shadow: 0 4px 15px var(--glow); }

/* --- UPDATED: Active Filters Row (Scrollable + Draggable Cursor) --- */
.active-filters-row { 
    display: flex; 
    gap: 8px; 
    flex-wrap: nowrap;
    overflow-x: auto;
    min-height: 40px; 
    margin-bottom: 8px; 
    flex-shrink: 0; 
    align-items: center;
    cursor: grab; /* Shows hand cursor */
    
    scrollbar-width: none; 
    -ms-overflow-style: none;
    
    mask-image: linear-gradient(to right, black 85%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, black 85%, transparent 100%);
    padding-right: 20px;
}
.active-filters-row:active { cursor: grabbing; } /* Closes hand on click */
.active-filters-row::-webkit-scrollbar { display: none; }

.active-pill { 
    height: 32px;
    padding: 0 14px; 
    background: rgba(255,255,255,0.03); 
    border: 1px solid var(--accent); 
    box-shadow: 0 0 10px -5px var(--accent); 
    border-radius: 100px; 
    color: white; 
    font-size: 11px; 
    font-weight: 700; 
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap; 
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.filter-action-btn { 
    height: 32px; 
    border-radius: 100px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-size: 11px; 
    font-weight: 800; 
    cursor: pointer; 
    transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1); 
    border: 1px solid rgba(255,255,255,0.1); 
    background: rgba(255,255,255,0.05); 
    color: #94a3b8; 
    backdrop-filter: blur(4px);
    flex-shrink: 0;
}

.filter-action-btn:hover { 
    background: rgba(255,255,255,0.15); 
    color: white; 
    border-color: rgba(255,255,255,0.3);
    transform: translateY(-1px);
}

.filter-action-btn:active {
    transform: scale(0.96);
}

.filter-action-btn.reset { 
    width: 32px; 
    color: #ef4444; 
    background: rgba(239, 68, 68, 0.05);
    border-color: rgba(239, 68, 68, 0.2);
}
.filter-action-btn.reset:hover {
    background: rgba(239, 68, 68, 0.2);
    color: white;
}

.filter-action-btn.add { 
    width: auto; 
    padding: 0 16px; 
    text-transform: uppercase; 
    letter-spacing: 0.1em; 
    gap: 6px;
}

/* Buttons */
.discover-btn { background: white; color: black; font-weight: 900; text-transform: uppercase; letter-spacing: 0.15em; width: 100%; padding: 1.2rem; border-radius: 1.2rem; margin-bottom: 0.8rem; transition: transform 0.1s; cursor: pointer; box-shadow: 0 0 40px var(--glow); flex-shrink: 0; }
.discover-btn:active { transform: scale(0.98); }
.discover-btn:disabled { opacity: 0.7; cursor: wait; filter: grayscale(1); }
.btn-group { display: flex; gap: 8px; flex-shrink: 0; }
.secondary-btn { flex: 1; display: flex; items-center; justify-center; gap: 6px; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.05); padding: 0.8rem; border-radius: 1rem; font-size: 10px; font-weight: 800; text-transform: uppercase; transition: all 0.2s; color: #94a3b8; cursor: pointer; }
.secondary-btn:hover { background: rgba(255,255,255,0.1); color: white; }
.btn-disabled { opacity: 0.3; pointer-events: none; }
.secondary-btn.saved { color: #facc15; border-color: rgba(250, 204, 21, 0.2); background: rgba(250, 204, 21, 0.1); }

/* Swipe Guides */
.swipe-guides { position: absolute; inset: 0; z-index: 5; pointer-events: none; display: flex; justify-content: space-between; align-items: center; padding: 20px; opacity: 0; transition: opacity 0.3s; }
.swipe-guides.active { opacity: 1; }
.guide-pill { background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); border: 1px solid rgba(255,255,255,0.1); color: white; border-radius: 50px; padding: 8px 16px; display: flex; align-items: center; opacity: 0; transform: scale(0.9); transition: all 0.2s; }
.guide-pill.left { transform-origin: left; color: #ef4444; }
.guide-pill.right { transform-origin: right; color: white; }

/* Modals */
.modal { 
    position: absolute; 
    inset: 0; 
    background: #09090b; 
    z-index: 50; 
    padding: 0; 
    transform: translateY(100%); 
    transition: transform 0.4s cubic-bezier(0.33, 1, 0.68, 1), visibility 0.4s; 
    display: flex; 
    flex-direction: column; 
    visibility: hidden; /* Fixes scroll-into-view bug */
}
.modal.open { transform: translateY(0); visibility: visible; }

.grid-item { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.05); border-radius: 12px; padding: 12px; text-align: center; font-size: 11px; font-weight: 700; color: #94a3b8; cursor: pointer; transition: all 0.2s; }
.grid-item.selected { background: var(--accent); color: white; border-color: var(--accent); box-shadow: 0 0 15px var(--glow); }

.mini-action-btn { padding: 6px 16px; border-radius: 8px; font-size: 10px; font-weight: 800; text-transform: uppercase; transition: all 0.2s; }
.mini-action-btn.ghost { color: #64748b; background: transparent; }
.mini-action-btn.ghost:hover { color: white; background: rgba(255,255,255,0.05); }
.mini-action-btn.white { background: white; color: black; }
.mini-action-btn.blue { background: #3b82f6; color: white; }
.mini-action-btn.red { background: #ef4444; color: white; }
.close-icon-btn { width: 32px; height: 32px; border-radius: 50%; display: flex; items-center; justify-center; background: rgba(255,255,255,0.05); color: white; transition: 0.2s; }
.close-icon-btn:hover { background: rgba(255,255,255,0.15); }
.theme-input { background: rgba(255,255,255,0.05); color: white; border: 1px solid rgba(255,255,255,0.05); }
.theme-input:focus { border-color: rgba(255,255,255,0.2); }
.modal-action-btn { padding: 14px; border-radius: 12px; font-size: 12px; font-weight: 800; text-transform: uppercase; transition: all 0.2s; display: flex; align-items: center; justify-content: center; gap: 8px; }
.modal-action-btn.primary { background: white; color: black; }
.modal-action-btn.ghost { background: rgba(255,255,255,0.05); color: white; }

.header-badge {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
}

/* Watchlist Specifics */
.wl-filter-btn { padding: 6px 14px; border-radius: 20px; font-size: 10px; font-weight: 800; text-transform: uppercase; background: rgba(255,255,255,0.03); color: #64748b; border: 1px solid transparent; transition: all 0.2s; white-space: nowrap; flex-shrink: 0; }
.wl-filter-btn:hover { background: rgba(255,255,255,0.1); color: white; }
.wl-filter-btn.active { background: var(--accent); color: white; border-color: var(--accent); box-shadow: 0 0 10px var(--glow); }

.wl-item { transition: all 0.3s ease; border: 1px solid rgba(255,255,255,0.05); }
.wl-item.watched { background: rgba(34, 197, 94, 0.05); border-color: rgba(34, 197, 94, 0.2); }
.watched-badge { position: absolute; top: -5px; right: -5px; width: 18px; height: 18px; background: #22c55e; color: black; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 900; border: 2px solid #09090b; z-index: 20; box-shadow: 0 2px 5px rgba(0,0,0,0.5); }
.type-badge { font-size: 8px; padding: 2px 6px; border-radius: 4px; background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.7); font-weight: 800; text-transform: uppercase; }

/* Dialogs */
.dialog-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.8); backdrop-filter: blur(8px); z-index: 60; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.dialog-overlay.open { opacity: 1; pointer-events: auto; }
.dialog-box, .modern-dialog { width: 85%; max-width: 320px; background: #18181b; border: 1px solid rgba(255,255,255,0.1); border-radius: 24px; padding: 24px; text-align: center; box-shadow: 0 20px 50px -10px rgba(0,0,0,0.5); transform: scale(0.95); transition: transform 0.2s; }
.dialog-overlay.open .dialog-box, .dialog-overlay.open .modern-dialog { transform: scale(1); }
.dialog-icon-area { width: 50px; height: 50px; border-radius: 50%; background: rgba(255,255,255,0.05); color: #fff; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; }
.dialog-title { font-size: 18px; font-weight: 800; color: white; margin-bottom: 8px; }
.dialog-sub { font-size: 13px; color: #94a3b8; margin-bottom: 20px; font-weight: 500; }
.link-preview-box { display: flex; background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.1); border-radius: 12px; padding: 6px; margin-bottom: 20px; }
.link-input { flex: 1; background: transparent; border: none; color: #94a3b8; font-size: 12px; font-family: monospace; padding: 0 10px; outline: none; width: 100%; }
.copy-trigger-btn { width: 36px; height: 36px; border-radius: 8px; background: white; color: black; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: 0.2s; flex-shrink: 0; }
.copy-trigger-btn:hover { background: #e2e8f0; }
.dialog-done-btn { width: 100%; padding: 14px; border-radius: 14px; background: rgba(255,255,255,0.05); color: white; font-weight: 700; font-size: 13px; transition: 0.2s; }
.dialog-done-btn:hover { background: rgba(255,255,255,0.1); }

/* Share & Import */
.share-item, .import-item { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px; background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.05); cursor: pointer; transition: 0.2s; }
.share-item.checked, .import-item.selected { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.2); }
.share-checkbox { width: 18px; height: 18px; border-radius: 5px; border: 2px solid rgba(255,255,255,0.2); flex-shrink: 0; transition: 0.2s; }
.share-item.checked .share-checkbox, .import-item.selected .share-checkbox { background: #22c55e; border-color: #22c55e; }
.share-poster { width: 30px; height: 45px; object-fit: cover; border-radius: 4px; background: #000; flex-shrink: 0; }
.import-mode-select .import-item:not(.owned) { opacity: 1; } .import-item.owned { opacity: 0.5; }

/* Import Mode Specifics (New) */
.import-mode-preview .share-checkbox { display: none; }
.import-item .share-poster { width: 40px; height: 60px; box-shadow: 0 4px 10px rgba(0,0,0,0.5); }
.import-item { position: relative; overflow: hidden; }
.import-item:active { transform: scale(0.98); background: rgba(255,255,255,0.08); }

/* Toast */
.toast { position: absolute; top: 20px; left: 50%; transform: translateX(-50%) translateY(-20px); background: white; color: black; padding: 10px 20px; border-radius: 30px; font-size: 11px; font-weight: 800; opacity: 0; transition: all 0.3s; z-index: 100; display: flex; align-items: center; gap: 8px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: #ef4444; color: white; }

/* Utilities */
.clean-scroll { scrollbar-width: none; }
.clean-scroll::-webkit-scrollbar { display: none; }
.glow-text { text-shadow: 0 0 30px rgba(255,255,255,0.3); }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }
.no-scrollbar::-webkit-scrollbar { display: none; }
@keyframes highlightPulse { 0% { border-color: var(--accent); transform: scale(1); } 50% { border-color: white; transform: scale(1.02); box-shadow: 0 0 20px var(--accent); } 100% { border-color: var(--accent); transform: scale(1); } }
.highlight-pick { animation: highlightPulse 1s ease infinite; z-index: 10; position: relative; background: rgba(255,255,255,0.05); }
.trailer-modal { position: absolute; inset: 0; background: black; z-index: 100; transform: translateY(100%); transition: transform 0.3s cubic-bezier(0.33, 1, 0.68, 1); display: flex; flex-direction: column; }
.trailer-modal.open { transform: translateY(0); }