:root {
    /* User Palette */
    --palette-night: #0E1715;
    --palette-tiffany: #84DCC6;
    --palette-aquamarine: #A5FFD6;
    --palette-melon: #FFA69E;
    --palette-lightred: #FF686B;

    /* Semantic Mappings */
    --bg-color: var(--palette-night);
    --card-bg: #151e1c; /* Lighter shade of night */
    --text-color: #ffffff;
    --hint-color: #a0b8b5; 
    
    --accent-color: var(--palette-lightred);
    --accent-text: #ffffff;
    
    --secondary-active: var(--palette-tiffany);
    
    --danger-color: var(--palette-melon);
    
    --radius-l: 16px;
    --radius-m: 12px;
    --radius-s: 8px;
    
    --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-main);
    margin: 0;
    padding: 0;
    font-size: 16px;
    padding-bottom: 80px;
}

.container {
    padding: 16px;
    max-width: 600px;
    margin: 0 auto;
}

/* --- Active Filters Header --- */
.active-filters-section {
    margin-bottom: 24px;
}

.active-filters-section h3 {
    margin: 0 0 12px 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--palette-tiffany); /* Tiffany title */
}

.horizontal-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: none; 
}
.horizontal-scroll::-webkit-scrollbar {
    display: none; 
}

.chip-active {
    background-color: var(--palette-tiffany);
    color: var(--palette-night);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chip-placeholder {
    color: var(--hint-color);
    font-size: 14px;
    font-style: italic;
    opacity: 0.7;
}

/* --- Cards --- */
.filter-card {
    background-color: var(--card-bg);
    border: 1px solid rgba(132, 220, 198, 0.05); /* Subtle Tiffany border */
    border-radius: var(--radius-l);
    margin-bottom: 16px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.card-header {
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    color: var(--text-color);
}
.header-title .icon {
    font-size: 18px;
}

.chevron {
    color: var(--hint-color);
    transition: transform 0.3s;
}

.filter-card.expanded .chevron {
    transform: rotate(180deg);
    color: var(--palette-tiffany);
}

.card-body {
    padding: 0 16px 16px 16px; 
    display: none; 
}

.filter-card.expanded .card-body {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.hint {
    font-size: 12px;
    color: var(--hint-color);
    margin-top: -8px;
    margin-bottom: 16px;
}

/* --- Sliders --- */
.slider-container {
    padding: 10px 10px 30px 10px;
}

.noUi-target {
    background: #0b1110;
    border: none;
    box-shadow: none;
    height: 6px;
}

.noUi-connect {
    background: var(--accent-color); /* Light Red Connect */
}

.noUi-handle {
    background: #fff;
    border: 2px solid var(--accent-color);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    right: -10px !important;
    top: -7px !important;
    box-shadow: 0 0 10px rgba(255, 104, 107, 0.3);
}

.noUi-handle:before, .noUi-handle:after {
    display: none;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--palette-tiffany);
    margin-top: 10px;
    font-weight: 500;
}

/* --- Presets & Buttons --- */
.presets {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.presets.vertical {
    flex-direction: column;
}

.presets.scrollable {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 8px;
}

button {
    border: none;
    outline: none;
    font-family: var(--font-main);
    cursor: pointer;
}

.btn-preset, .btn-select, .btn-toggle, .btn-radio {
    background: rgba(255,255,255,0.05);
    color: var(--text-color);
    border: 1px solid rgba(255,255,255,0.05);
    padding: 8px 16px;
    border-radius: var(--radius-s);
    font-size: 14px;
    transition: all 0.2s;
    white-space: nowrap;
}

/* Active States */
.btn-select.active, .btn-toggle.active {
    background: var(--accent-color);
    color: var(--accent-text);
    border-color: var(--accent-color);
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(255, 104, 107, 0.3);
}

.btn-radio.active {
    background: rgba(132, 220, 198, 0.1);
    color: var(--palette-tiffany);
    border-color: var(--palette-tiffany);
    font-weight: 600;
    text-align: left;
    position: relative;
}
.btn-radio.active::after {
    content: '✔';
    position: absolute;
    right: 12px;
}

/* --- Genre Grid --- */
.grid-2-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.btn-genre {
    padding: 10px;
    border-radius: var(--radius-s);
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.05);
    color: var(--text-color);
    text-align: center;
    font-size: 14px;
    position: relative;
    user-select: none;
    transition: all 0.2s;
}

/* States */
.btn-genre[data-state="1"] { /* Include */
    background: var(--palette-tiffany);
    color: var(--palette-night);
    border-color: var(--palette-tiffany);
    font-weight: 700;
}
.btn-genre[data-state="1"]::before { content: '+ '; }

.btn-genre[data-state="2"] { /* Exclude */
    background: rgba(255, 104, 107, 0.1);
    color: var(--palette-lightred);
    border-color: var(--palette-lightred);
}
.btn-genre[data-state="2"]::before { content: '- '; }

/* --- Bottom Bar --- */
.bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--bg-color);
    border-top: 1px solid rgba(255,255,255,0.05);
    padding: 12px 16px;
    display: flex;
    gap: 12px;
    z-index: 100;
}

.btn-primary {
    flex: 2;
    background: var(--accent-color);
    color: var(--accent-text); /* White on Red */
    padding: 14px;
    border-radius: var(--radius-m);
    font-weight: 600;
    font-size: 16px;
    box-shadow: 0 4px 15px rgba(255, 104, 107, 0.4);
}

.btn-secondary {
    flex: 1;
    background: rgba(255,255,255,0.05);
    color: var(--text-color);
    padding: 14px;
    border-radius: var(--radius-m);
    font-weight: 500;
    font-size: 16px;
}

.separator {
    border: 0;
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 16px 0;
}

/* === RESULTS VIEW STYLES === */

.results-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background-color: var(--bg-color);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--card-bg); /* Subtle separator */
}

.icon-btn-back {
    background: none;
    border: none;
    color: var(--accent-color);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.results-title {
    color: var(--hint-color);
    font-size: 14px;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2 columns mobile */
    gap: 12px;
    padding: 12px;
}

@media (min-width: 600px) {
    .results-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 900px) {
    .results-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.movie-card {
    background: transparent;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    cursor: pointer;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.poster-wrapper {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 2/3;
    background: var(--card-bg);
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

.poster-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s;
}

.poster-wrapper:active img {
    transform: scale(0.98);
}

.rating-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(14, 23, 21, 0.85); /* Night with opacity */
    color: #FFD700; /* Gold */
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.add-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(14, 23, 21, 0.6);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    font-size: 20px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Bouncy */
}

.add-btn:active {
    transform: scale(0.9);
}

.add-btn.added {
    background: var(--accent-color); /* Coral */
    border-color: var(--accent-color);
    color: #fff; 
    transform: rotate(360deg);
}

.movie-info {
    padding: 0 4px;
}

.movie-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.movie-meta {
    font-size: 12px;
    color: var(--hint-color);
}

.load-more-container {
    display: flex;
    justify-content: center;
    padding: 20px;
}

.loader {
    border: 3px solid var(--card-bg);
    border-top: 3px solid var(--accent-color);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- Bottom Navigation --- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: var(--bg-color);
    border-top: 1px solid rgba(255,255,255,0.05);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 200;
    padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
    background: none;
    border: none;
    color: var(--hint-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    padding: 8px;
    flex: 1;
}

.nav-item .icon {
    font-size: 20px;
    transition: transform 0.2s;
}

.nav-item.active {
    color: var(--accent-color);
}

.nav-item.active .icon {
    transform: translateY(-2px);
}

/* --- Dropdown Select --- */
.dropdown-select {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-color);
    padding: 12px;
    border-radius: var(--radius-m);
    font-size: 16px;
    appearance: none;
    margin-bottom: 16px;
}
.dropdown-select:focus {
    border-color: var(--accent-color);
    outline: none;
}

/* --- Utilities --- */
.full-width {
    width: 100%;
}
.no-click {
    pointer-events: none;
}

/* --- Onboarding Wizard --- */
#onboarding-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: linear-gradient(180deg, rgba(14,23,21,1) 0%, rgba(11,17,16,1) 100%);
    z-index: 1000;
    display: flex; /* overridden by inline */
    flex-direction: column;
    padding: 20px;
    padding-bottom: 40px;
}

.onb-step {
    display: none;
    flex-direction: column;
    height: 100%;
    animation: fadeInStep 0.4s ease;
}

.onb-step.active {
    display: flex;
}

@keyframes fadeInStep {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

.onb-content.centered {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
}

.onb-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 24px;
}

.onb-title {
    font-size: 28px;
    margin: 0 0 10px 0;
}

.text-accent {
    color: var(--accent-color); /* Light Red / Coral */
}

.onb-subtitle {
    font-size: 16px;
    color: var(--hint-color);
    margin-bottom: 40px;
}

/* Feature List */
.feature-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    max-width: 400px;
    margin-bottom: 40px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(255,255,255,0.05);
    padding: 16px;
    border-radius: var(--radius-m);
    text-align: left;
}

.feature-icon {
    font-size: 24px;
}

.feature-text strong {
    display: block;
    font-size: 16px;
    margin-bottom: 4px;
    color: var(--palette-tiffany);
}
.feature-text p {
    margin: 0;
    font-size: 13px;
    color: var(--hint-color);
}

.onb-header {
    text-align: center;
    margin-top: 40px;
    margin-bottom: 30px;
}
.onb-header h2 {
    font-size: 24px;
    margin: 0 0 8px 0;
}
.onb-header p {
    color: var(--hint-color);
    margin: 0;
}

.onb-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.input-label {
    display: block;
    color: var(--hint-color);
    font-size: 14px;
    margin-bottom: 8px;
    margin-top: 10px;
}

.mb-16 { margin-bottom: 16px; }

.spacer { flex: 1; }

.scrollable-y {
    overflow-y: auto;
    flex: 1;
    padding-bottom: 20px;
}

.providers-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.provider-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: rgba(255,255,255,0.05);
    border: 2px solid transparent;
    border-radius: var(--radius-m);
    cursor: pointer;
    transition: all 0.2s;
}

.provider-item img {
    width: 48px;
    height: 48px;
    border-radius: 12px;
}

.provider-item span {
    font-size: 12px;
    text-align: center;
    line-height: 1.2;
}

.provider-item.active {
    background: rgba(132, 220, 198, 0.1);
    border-color: var(--palette-tiffany);
}

.onb-footer {
    padding-top: 20px;
}

/* --- Contextual Hints --- */
.context-hint {
    position: absolute;
    background: var(--palette-tiffany);
    color: var(--palette-night);
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    z-index: 900;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    animation: bounceIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none; /* Let clicks pass through, or handle click to dismiss */
}

.context-hint::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 20px;
    width: 0; 
    height: 0; 
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid var(--palette-tiffany);
}

@keyframes bounceIn {
    0% { opacity: 0; transform: translateY(-10px) scale(0.9); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}
