:root {
    /* Color Palette (Cool Minimal) */
    --primary-gradient: linear-gradient(135deg, #06B6D4, #3B82F6);
    --bg-main: #030712;
    --bg-secondary: #0F172A;
    --text-main: #F8FAFC;
    --text-muted: #CBD5E1;
    --accent: #14B8A6;
    --glass-border: rgba(6, 182, 212, 0.3);
    --primary: #06B6D4;
    --bg-card: #0F172A;
    --nav-height: 68px;
    --like-color: #10B981;
    --nope-color: #EF4444;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background: var(--bg-main);
    background: radial-gradient(circle at top center, #1e293b 0%, #030712 100%);
    color: var(--text-main);
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#app {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    height: calc(100% - var(--nav-height));
    position: relative;
    display: flex;
    flex-direction: column;
    background-color: transparent;
}

/* Hide Scrollbar */
::-webkit-scrollbar {
    display: none;
}

* {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

@media (max-width: 480px) {
    #app {
        max-width: 100%;
    }
}

/* ========== HEADER ========== */
header {
    padding: 15px 20px;
    text-align: center;
    flex-shrink: 0;
    z-index: 10;
}

header h1 {
    font-size: 1.6rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 10px rgba(6, 182, 212, 0.2));
    letter-spacing: -0.5px;
}

/* ========== VIEWS ========== */
.view {
    display: none;
    flex: 1;
    flex-direction: column;
    padding: 20px;
    animation: fadeIn 0.3s ease;
    overflow-y: auto;
}

.view.active {
    display: flex;
}

.view-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== BOTTOM NAV ========== */
#bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: rgba(3, 7, 18, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(51, 65, 85, 0.5);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 500;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 12px;
    transition: all 0.2s;
    margin: 0;
}

.nav-btn svg {
    width: 22px;
    height: 22px;
}

.nav-btn.active {
    color: var(--primary);
}

.nav-btn.active svg {
    filter: drop-shadow(0 0 6px rgba(6, 182, 212, 0.4));
}

/* ========== LANDING ========== */
#view-landing {
    justify-content: flex-start;
    text-align: center;
    gap: 25px;
    padding-bottom: 20px;
}

.landing-hero {
    padding: 5px 0 0 0;
}

.hero-icon {
    font-size: 3rem;
    margin-bottom: 8px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

.hero-title {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.gradient-text {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
    max-width: 340px;
    margin: 0 auto;
}

/* Feature Cards */
.features-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.feature-card {
    background: var(--bg-secondary);
    border: 1px solid #334155;
    border-radius: 14px;
    padding: 16px;
    text-align: left;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    transition: border-color 0.3s, transform 0.2s;
}

.feature-card:hover {
    border-color: var(--glass-border);
    transform: translateY(-2px);
}

.feature-icon {
    font-size: 1.6rem;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(6, 182, 212, 0.08);
    border-radius: 10px;
}

.feature-card h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 3px;
    color: var(--text-main);
}

.feature-card p {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}

/* How It Works */
.how-it-works {
    padding: 0;
}

.section-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.step-number {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: white;
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.3);
}

.step p {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
    max-width: 100px;
    line-height: 1.4;
}

.step-connector {
    width: 30px;
    height: 2px;
    background: linear-gradient(90deg, rgba(6, 182, 212, 0.4), rgba(59, 130, 246, 0.4));
    flex-shrink: 0;
    margin-bottom: 30px;
}

.landing-cta {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.tagline {
    color: var(--text-muted);
    margin-bottom: 40px;
}

/* ========== FORMS ========== */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
}

input[type="text"],
input[type="number"] {
    width: 100%;
    padding: 14px;
    background: var(--bg-secondary);
    border: 1px solid #334155;
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    transition: border-color 0.2s;
}

input:focus {
    border-color: #3B82F6;
    outline: none;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* ========== CHIPS & PROVIDERS ========== */
.chips-container,
.providers-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip-btn,
.provider-btn {
    background: var(--bg-secondary);
    border: 1px solid #334155;
    color: var(--text-muted);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: auto !important;
    flex: 0 0 auto;
}

.chip-btn.selected,
.provider-btn.selected {
    background: rgba(6, 182, 212, 0.15);
    border-color: #06B6D4;
    color: #06B6D4;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.2);
}

/* Provider SVG Logos */
.provider-logo {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ========== BUTTONS ========== */
button {
    padding: 14px;
    border-radius: 12px;
    border: none;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    margin-bottom: 8px;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    width: 100%;
    display: block;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(6, 182, 212, 0.3);
}

.btn-secondary {
    background: #1e293b;
    border: 1px solid #334155;
    color: white;
    width: 100%;
    display: block;
}

.btn-text {
    background: transparent;
    color: var(--text-muted);
    width: 100%;
    display: block;
}

.btn-text.small {
    font-size: 0.8rem;
}

/* ========== DECK & CARDS ========== */
#view-deck {
    position: relative;
    padding: 0;
    overflow: hidden;
}

.status-bar {
    padding: 8px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    flex-shrink: 0;
}

#card-stack {
    flex: 1;
    position: relative;
    margin: 5px 20px 15px 20px;
    perspective: 1000px;
}

.card-swipe-wrapper {
    position: absolute;
    width: 100%;
    height: 100%;
    cursor: grab;
    touch-action: none;
}

.card-swipe-wrapper:active {
    cursor: grabbing;
}

.card-flip-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.card-flip-wrapper.flipped {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
    background: var(--bg-card);
}

.card-front {
    background-size: cover;
    background-position: center;
    background-color: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.card-back {
    background: var(--bg-secondary);
    transform: rotateY(180deg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    color: var(--text-main);
    border: 1px solid #1e293b;
    overflow-y: auto;
}

.card-content {
    margin-top: auto;
    background: linear-gradient(to top, #030712 10%, rgba(3, 7, 18, 0.8) 50%, transparent 100%);
    padding: 24px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    text-align: left;
    width: 100%;
}

.movie-title {
    font-family: 'Inter', sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 6px;
    line-height: 1.2;
    color: var(--text-main);
}

.movie-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 1.1rem;
    color: #FBBF24;
}

.btn-details {
    margin-top: 12px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-main);
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: 0.2s;
    width: auto;
    pointer-events: auto;
    align-self: flex-start;
}

.btn-details:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.star.filled {
    color: #FBBF24;
}

.star {
    color: rgba(255, 255, 255, 0.2);
}

.card-back h3 {
    font-size: 1.4rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 12px;
}

.rating-badge {
    background: rgba(15, 23, 42, 0.8);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
    border: 1px solid #334155;
}

.chip-small {
    background: var(--bg-main);
    border: 1px solid #334155;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ========== SWIPE FEEDBACK STAMPS ========== */
.swipe-label {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 3rem;
    font-weight: 900;
    padding: 10px 25px;
    border-radius: 12px;
    border: 4px solid;
    opacity: 0;
    pointer-events: none;
    z-index: 10;
    letter-spacing: 3px;
    transition: none;
}

.like-label {
    right: 20px;
    color: var(--like-color);
    border-color: var(--like-color);
    transform: translateY(-50%) rotate(-20deg);
}

.nope-label {
    left: 20px;
    color: var(--nope-color);
    border-color: var(--nope-color);
    transform: translateY(-50%) rotate(20deg);
}

/* ========== CONTROLS ========== */
.controls {
    display: flex;
    justify-content: center;
    gap: 30px;
    padding: 8px 20px 20px 20px;
    flex-shrink: 0;
}

.control-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 1px solid #334155;
    cursor: pointer;
    background: var(--bg-secondary);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.8rem;
    transition: transform 0.2s, background 0.2s;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.control-btn:active {
    transform: scale(0.95);
}

.btn-dislike {
    color: var(--nope-color);
}

.btn-dislike:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--nope-color);
}

.btn-like {
    color: var(--like-color);
}

.btn-like:hover {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--like-color);
}

/* ========== MATCH ========== */
#view-match {
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
}

.match-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.match-content h1 {
    font-size: 2rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

#match-poster {
    width: 100%;
    max-width: 250px;
    max-height: 35vh;
    object-fit: cover;
    border-radius: 14px;
    margin: 15px 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

#match-title {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

#match-overview {
    font-size: 0.85rem;
    max-width: 400px;
    margin-bottom: 15px;
    color: var(--text-muted);
}

/* Watch Now Buttons */
.watch-link {
    background: var(--primary-gradient);
    color: white;
    padding: 10px 18px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: transform 0.2s, box-shadow 0.2s;
    border: none;
    cursor: pointer;
}

.watch-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(6, 182, 212, 0.3);
}

/* ========== LOBBY ========== */
.lobby-list {
    background: var(--bg-secondary);
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 15px;
    margin: 20px 0;
    text-align: left;
    max-height: 200px;
    overflow-y: auto;
}

.lobby-list ul {
    list-style: none;
}

.lobby-list li {
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

.lobby-list li:before {
    content: "👤 ";
}

/* ========== DISCOVER ========== */
.discover-section {
    margin-bottom: 25px;
}

.discover-label {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-main);
}

.discover-row {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
    scroll-snap-type: x mandatory;
}

.discover-card {
    flex: 0 0 130px;
    scroll-snap-align: start;
    cursor: pointer;
    transition: transform 0.2s;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.discover-card:hover {
    transform: scale(1.05);
}

.discover-card img {
    width: 100%;
    height: 195px;
    object-fit: cover;
    border-radius: 12px;
    display: block;
}

.discover-card-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
    font-size: 0.72rem;
    font-weight: 600;
    color: white;
    border-radius: 0 0 12px 12px;
}

/* ========== WATCHLIST ========== */
.watchlist-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.watchlist-item {
    display: flex;
    gap: 12px;
    background: var(--bg-secondary);
    border: 1px solid #334155;
    border-radius: 14px;
    padding: 12px;
    align-items: center;
    transition: border-color 0.2s;
}

.watchlist-item:hover {
    border-color: var(--glass-border);
}

.watchlist-item img {
    width: 55px;
    height: 82px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

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

.watchlist-info h4 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.watchlist-info p {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
}

.watchlist-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.watchlist-btn {
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid var(--glass-border);
    color: var(--primary);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    width: auto !important;
    margin: 0;
    white-space: nowrap;
}

.watchlist-btn.remove {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #EF4444;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

/* ========== PROFILE ========== */
.profile-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 20px;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid #334155;
    border-radius: 14px;
    padding: 20px 10px;
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 6px;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ========== MODALS ========== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 3000;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid #334155;
    border-radius: 20px;
    padding: 24px;
    width: 100%;
    max-width: 460px;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    margin: 0;
    padding: 0;
}

/* Trailer Modal */
.trailer-container {
    padding: 0;
    overflow: hidden;
}

.trailer-container iframe {
    width: 100%;
    aspect-ratio: 16/9;
    border: none;
    border-radius: 0 0 20px 20px;
}

.trailer-container .modal-close {
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.6);
}

/* Spinner Modal */
.spinner-container {
    text-align: center;
}

.spinner-container h2 {
    margin-bottom: 20px;
}

.spinner-wheel {
    position: relative;
    width: 250px;
    height: 250px;
    margin: 0 auto 20px;
}

.spinner-pointer {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.5rem;
    z-index: 10;
    color: var(--primary);
    filter: drop-shadow(0 0 5px rgba(6, 182, 212, 0.5));
}

.spinner-disc {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: conic-gradient(from 0deg,
            #06B6D4 0deg 60deg,
            #3B82F6 60deg 120deg,
            #8B5CF6 120deg 180deg,
            #EC4899 180deg 240deg,
            #F59E0B 240deg 300deg,
            #10B981 300deg 360deg);
    transition: transform 3s cubic-bezier(0.17, 0.67, 0.12, 0.99);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 30px rgba(6, 182, 212, 0.2);
}

.spinner-result {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    min-height: 30px;
}

/* ========== LOADING ========== */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(3, 7, 18, 0.95);
    z-index: 2000;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#loading-overlay.active {
    display: flex;
}

.loader {
    width: 45px;
    height: 45px;
    border: 4px solid #1e293b;
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 20px;
}

#loading-msg {
    font-size: 1.1rem;
    color: var(--text-main);
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ========== TOAST ========== */
#toast {
    position: fixed;
    bottom: calc(var(--nav-height) + 15px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid #334155;
    padding: 12px 24px;
    border-radius: 30px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
    z-index: 1000;
}

#toast.show {
    opacity: 1;
}

/* ========== CARD BACK TRAILER BUTTON ========== */
.btn-trailer {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 15px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: auto;
    transition: transform 0.2s;
}

.btn-trailer:hover {
    transform: translateY(-2px);
}