/* CineMatch - Styles matching Streamlit version */

:root {
    --bg-dark: #0e1117;
    --bg-card: #1a1a2e;
    --bg-card-hover: #16213e;
    --text-primary: #fafafa;
    --text-secondary: #a0a0a0;
    --accent-red: #E50914;
    --accent-red-light: #ff6b6b;
    --accent-purple: #667eea;
    --accent-green: #11998e;
    --border-subtle: rgba(255, 255, 255, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* Hero Header */
.hero {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    padding: 3rem 2rem 2rem;
    text-align: center;
    border-bottom: 1px solid rgba(229, 9, 20, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #E50914 0%, #ff6b6b 50%, #ffd93d 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    letter-spacing: -1px;
}

.tagline {
    font-size: 1.2rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 1rem;
}

.feature-badges {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.badge {
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.badge-red {
    background: rgba(229, 9, 20, 0.2);
    color: var(--accent-red-light);
}

.badge-purple {
    background: rgba(102, 126, 234, 0.2);
    color: var(--accent-purple);
}

.badge-green {
    background: rgba(17, 153, 142, 0.2);
    color: var(--accent-green);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 4rem 2rem;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-subtle);
    border-top-color: var(--accent-red);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

/* Status Message */
.status-message {
    background: rgba(17, 153, 142, 0.1);
    border: 1px solid var(--accent-green);
    color: var(--accent-green);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    display: none;
}

.status-message.visible {
    display: block;
}

/* Sections */
.section {
    margin-bottom: 2rem;
}

.section h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.section p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* Selection Controls */
.selection-controls {
    margin-bottom: 1.5rem;
}

.selection-controls label {
    display: block;
    margin-bottom: 0.5rem;
}

.selection-controls input[type="number"] {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    width: 80px;
    font-size: 1rem;
}

/* Movie Selectors */
.movie-selectors {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.movie-selector {
    position: relative;
}

.movie-selector label {
    display: block;
    margin-bottom: 0.3rem;
    font-weight: 500;
}

/* Searchable Input Component */
.search-container {
    position: relative;
}

.movie-search-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 2px solid var(--border-subtle);
    border-radius: 25px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.movie-search-input:focus {
    outline: none;
    border-color: var(--accent-red);
    box-shadow: 0 0 15px rgba(229, 9, 20, 0.2);
}

.movie-search-input::placeholder {
    color: var(--text-secondary);
}

.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    margin-top: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    display: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.search-dropdown.visible {
    display: block;
}

.search-option {
    padding: 0.75rem 1rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s ease;
    border-bottom: 1px solid var(--border-subtle);
}

.search-option:last-child {
    border-bottom: none;
}

.search-option:hover,
.search-option.active {
    background: rgba(229, 9, 20, 0.15);
}

.search-option .option-title {
    flex: 1;
}

.search-option .option-title strong {
    color: var(--accent-red-light);
}

.search-option .option-year {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-left: 0.5rem;
}

.search-option.no-results {
    color: var(--text-secondary);
    cursor: default;
}

.search-option.no-results:hover {
    background: transparent;
}

/* Selected Movies */
.selected-movies {
    display: none;
}

.selected-movies.visible {
    display: block;
}

.selected-movies h3 {
    margin-bottom: 1rem;
}

.selected-movies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
}

.selected-movie-card {
    text-align: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 0.5rem;
    transition: all 0.3s ease;
}

.selected-movie-card:hover {
    background: rgba(229, 9, 20, 0.1);
}

.selected-movie-card img {
    width: 100%;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.selected-movie-card .title {
    font-size: 0.85rem;
    font-weight: 500;
}

/* Divider */
.divider {
    border: none;
    border-top: 1px solid var(--border-subtle);
    margin: 2rem 0;
}

/* Primary Button */
.btn-primary {
    width: 100%;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #E50914 0%, #B20710 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(229, 9, 20, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(229, 9, 20, 0.4);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Recommendations */
.recommendations-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.recommendation-card {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 1.5rem;
    background: linear-gradient(145deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid var(--border-subtle);
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

.recommendation-card .poster {
    width: 100%;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.recommendation-card .details h3 {
    margin-bottom: 0.5rem;
}

.recommendation-card .rating {
    margin-bottom: 0.5rem;
}

/* Genre Badges */
.genre-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-bottom: 0.75rem;
}

.genre-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.genre-action {
    background: linear-gradient(135deg, #f12711 0%, #f5af19 100%);
}

.genre-comedy {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.genre-drama {
    background: linear-gradient(135deg, #4776E6 0%, #8E54E9 100%);
}

.genre-horror {
    background: linear-gradient(135deg, #200122 0%, #6f0000 100%);
}

.genre-science-fiction {
    background: linear-gradient(135deg, #00c6ff 0%, #0072ff 100%);
}

.genre-romance {
    background: linear-gradient(135deg, #ee0979 0%, #ff6a00 100%);
}

.genre-thriller {
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
}

.genre-animation {
    background: linear-gradient(135deg, #f953c6 0%, #b91d73 100%);
}

.genre-adventure {
    background: linear-gradient(135deg, #56ab2f 0%, #a8e063 100%);
}

.genre-fantasy {
    background: linear-gradient(135deg, #7f00ff 0%, #e100ff 100%);
}

/* Recommendation Reason */
.recommendation-reason {
    background: rgba(229, 9, 20, 0.1);
    border-left: 3px solid var(--accent-red);
    padding: 0.75rem 1rem;
    border-radius: 0 8px 8px 0;
    margin: 0.5rem 0;
    font-size: 0.9rem;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.trailer-btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #ff0000 0%, #cc0000 100%);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(255, 0, 0, 0.3);
}

.trailer-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 0, 0, 0.4);
}

.save-btn {
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--accent-red);
    color: var(--accent-red-light);
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.save-btn:hover {
    background: rgba(229, 9, 20, 0.1);
}

.save-btn.saved {
    background: rgba(17, 153, 142, 0.2);
    border-color: var(--accent-green);
    color: var(--accent-green);
}

/* Plot Summary */
.plot-summary {
    margin-top: 0.75rem;
}

.plot-summary summary {
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.plot-summary p {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* How It Works */
.how-it-works {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 1rem 1.5rem;
}

.how-it-works summary {
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 500;
}

.how-it-works-content {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-subtle);
}

.how-it-works table {
    width: 100%;
    max-width: 400px;
    margin: 1rem 0;
    border-collapse: collapse;
}

.how-it-works th,
.how-it-works td {
    padding: 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
}

/* Watchlist Sidebar */
.watchlist-sidebar {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
}

.toggle-watchlist {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: 1rem 0.5rem;
    border-radius: 8px 0 0 8px;
    cursor: pointer;
    font-size: 1.2rem;
}

.watchlist-content {
    position: absolute;
    right: -300px;
    top: 50%;
    transform: translateY(-50%);
    width: 280px;
    max-height: 400px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px 0 0 12px;
    padding: 1rem;
    transition: right 0.3s ease;
}

.watchlist-sidebar.open .watchlist-content {
    right: 0;
}

.watchlist-content h3 {
    margin-bottom: 0.5rem;
}

.watchlist-item {
    padding: 0.5rem;
    margin: 0.5rem 0;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border-left: 3px solid var(--accent-red);
}

/* Footer */
.footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.footer a {
    color: var(--accent-red-light);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

.coded-by {
    font-size: 0.8rem;
    margin-top: 0.5rem;
    opacity: 0.7;
}

/* Responsive */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2.5rem;
    }

    .container {
        padding: 1rem;
    }

    .recommendation-card {
        grid-template-columns: 100px 1fr;
        padding: 1rem;
        gap: 1rem;
    }

    .feature-badges {
        flex-direction: column;
        align-items: center;
    }
}

@media (max-width: 480px) {
    .recommendation-card {
        grid-template-columns: 1fr;
    }

    .recommendation-card .poster {
        max-width: 150px;
        margin: 0 auto;
    }
}