/* CSS Design System - packfilmes */
:root {
    --bg-main: #060609;
    --bg-darker: #020204;
    --bg-card: rgba(18, 18, 26, 0.7);
    --bg-glass: rgba(12, 12, 18, 0.6);
    --bg-glass-hover: rgba(22, 22, 34, 0.8);
    
    --border-slate: rgba(38, 38, 54, 0.6);
    --border-slate-bright: rgba(58, 58, 80, 0.9);
    
    --accent-indigo: #6366f1;
    --accent-indigo-hover: #4f46e5;
    --accent-indigo-glow: rgba(99, 102, 241, 0.35);
    
    --accent-red: #ef4444;
    --accent-red-hover: #dc2626;
    --accent-red-glow: rgba(239, 68, 68, 0.25);
    
    --accent-green: #10b981;
    --accent-green-hover: #059669;
    --accent-green-glow: rgba(16, 185, 129, 0.25);
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --blur-val: 12px;
}

/* Reset & Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-main);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Scrollbar customizations */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-darker);
}
::-webkit-scrollbar-thumb {
    background: var(--border-slate);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* App Container Layout */
.app-container {
    display: flex;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Left Column: Movie Canvas */
.recommendation-canvas {
    flex: 0 0 65%;
    max-width: 65%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 2rem;
    border-right: 1px solid var(--border-slate);
    background: radial-gradient(circle at 10% 20%, rgba(18, 18, 30, 0.4) 0%, var(--bg-main) 90%);
    position: relative;
    overflow-y: auto;
}

.logo-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.logo-header h1 span {
    color: var(--accent-indigo);
    position: relative;
    text-shadow: 0 0 15px var(--accent-indigo-glow);
}

.logo-header .tagline {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.canvas-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin: 1.5rem 0;
    min-height: 0;
}

/* Right Column: Sidebar */
.sidebar {
    flex: 0 0 35%;
    max-width: 35%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, var(--bg-darker) 0%, var(--bg-main) 100%);
    padding: 1.5rem;
    overflow-y: auto;
    gap: 1.5rem;
}

/* Movie Presentation styling */
.movie-presentation {
    width: 100%;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border-slate);
    background-color: var(--bg-card);
    backdrop-filter: blur(var(--blur-val));
    -webkit-backdrop-filter: blur(var(--blur-val));
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.media-container {
    width: 100%;
    position: relative;
    background-color: #000;
    overflow: hidden;
}

/* YouTube Iframe responsive wrapper */
.ratio-wrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    height: 0;
    width: 100%;
}

.ratio-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
}

.backdrop-fallback {
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* Matches 16:9 ratio */
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.movie-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.65;
    transition: opacity 0.5s ease;
}

.backdrop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to top, var(--bg-card) 0%, rgba(0, 0, 0, 0) 100%);
    z-index: 1;
}

/* Metadata card underneath media */
.movie-meta-card {
    padding: 1.5rem;
}

.meta-main {
    display: flex;
    gap: 1.5rem;
}

.movie-poster-thumb {
    width: 186px;
    height: 280px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border-slate);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    flex-shrink: 0;
}

.meta-text {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.5rem;
}

.title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.title-row h2 {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.2;
    color: var(--text-primary);
}

.rating-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: rgba(251, 191, 36, 0.15);
    border: 1px solid rgba(251, 191, 36, 0.4);
    color: #fbbf24;
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    text-shadow: 0 0 5px rgba(251,191,36,0.2);
}

.subtitle-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.meta-divider {
    color: var(--border-slate);
}

.genre-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.genre-tag {
    background-color: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-slate);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.movie-overview {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-top: 0.25rem;
}

/* Button & Action Control Panel */
.controls-panel {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 500;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    user-select: none;
}

.btn:active {
    transform: scale(0.97);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    border-radius: 6px;
}

.btn-indigo {
    background-color: var(--accent-indigo);
    color: #fff;
    box-shadow: 0 4px 14px var(--accent-indigo-glow);
}

.btn-indigo:hover {
    background-color: var(--accent-indigo-hover);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
    transform: translateY(-1px);
}

.btn-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background-color: var(--accent-red);
    color: #fff;
    border-color: var(--accent-red);
    box-shadow: 0 4px 14px var(--accent-red-glow);
    transform: translateY(-1px);
}

.btn-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: #a7f3d0;
    border-color: rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    background-color: var(--accent-green);
    color: #fff;
    border-color: var(--accent-green);
    box-shadow: 0 4px 14px var(--accent-green-glow);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-color: var(--border-slate);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: var(--text-muted);
}

.btn-glass {
    background-color: rgba(255,255,255,0.03);
    border: 1px dashed var(--border-slate);
    color: var(--text-secondary);
}

.btn-glass:hover {
    background-color: rgba(255,255,255,0.06);
    border-color: var(--text-primary);
    color: var(--text-primary);
}

.btn-full {
    width: 100%;
}

.btn-icon {
    padding: 0.5rem;
    border-radius: 6px;
    width: 32px;
    height: 32px;
}

/* Status / Category Exhaustion Notice card */
.status-notice {
    background-color: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    animation: fadeIn 0.4s ease forwards;
}

.notice-icon {
    font-size: 1.2rem;
    color: var(--accent-indigo);
}

.notice-message {
    flex-grow: 1;
    font-size: 0.9rem;
    color: var(--text-primary);
}

/* Sidebar Components styling */
.sidebar-block {
    background-color: var(--bg-card);
    border: 1px solid var(--border-slate);
    border-radius: 12px;
    padding: 1.2rem;
    backdrop-filter: blur(var(--blur-val));
    -webkit-backdrop-filter: blur(var(--blur-val));
}

.sidebar-block h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}

.sidebar-block h3 i {
    color: var(--accent-indigo);
}

/* Authentication Header Box */
.auth-box {
    width: 100%;
}

.user-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-glass);
    border: 1px solid var(--border-slate);
    padding: 0.6rem 1rem;
    border-radius: 8px;
    width: 100%;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-avatar {
    color: var(--accent-indigo);
    font-size: 1.1rem;
}

.username {
    font-size: 0.95rem;
    font-weight: 500;
}

/* Filters styling */
.filter-group {
    margin-bottom: 1rem;
}

.filter-group:last-child {
    margin-bottom: 0;
}

.filter-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.range-inputs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.range-sep {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.form-input {
    width: 100%;
    background-color: var(--bg-darker);
    border: 1px solid var(--border-slate);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    color: #fff;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.form-input:focus {
    border-color: var(--accent-indigo);
}

.form-range {
    width: 100%;
    accent-color: var(--accent-indigo);
    height: 6px;
    background-color: var(--bg-darker);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.genres-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.25rem;
    max-height: none;
    padding: 0.25rem;
    border: 1px solid var(--border-slate);
    background-color: var(--bg-darker);
    border-radius: 6px;
}

.genre-chip {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    background-color: rgba(255,255,255,0.02);
    cursor: pointer;
    font-size: 0.78rem;
    color: var(--text-secondary);
    user-select: none;
    border: 1px solid transparent;
    transition: all 0.15s ease;
}

.genre-chip input {
    accent-color: var(--accent-indigo);
    cursor: pointer;
}

.genre-chip:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.genre-chip.active {
    background-color: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.3);
    color: #fff;
}

/* Watchlist section */
.watchlist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.watchlist-header h3 {
    margin-bottom: 0;
}

.count-badge {
    background-color: var(--bg-darker);
    border: 1px solid var(--border-slate);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.watchlist-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 0.2rem;
}

.watchlist-empty {
    text-align: center;
    padding: 1.5rem 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.watchlist-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background-color: var(--bg-glass);
    border: 1px solid var(--border-slate);
    border-radius: 6px;
    padding: 0.4rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.watchlist-item:hover {
    background-color: var(--bg-glass-hover);
    border-color: var(--border-slate-bright);
    transform: translateX(2px);
}

.watchlist-poster {
    width: 32px;
    height: 48px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.watchlist-details {
    flex-grow: 1;
    min-width: 0; /* allows text truncation */
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.watchlist-title {
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.watchlist-sub {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.watchlist-sub i {
    color: #fbbf24;
}

/* Footer & TMDB Logo */
.app-footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.footer-divider {
    height: 1px;
    background-color: var(--border-slate);
    width: 100%;
}

.tmdb-attribution {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.tmdb-logo {
    height: 18px;
    width: auto;
    flex-shrink: 0;
}

.tmdb-attribution p {
    font-size: 0.72rem;
    line-height: 1.3;
    color: var(--text-muted);
}

/* Modals system styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(2, 2, 4, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    width: 100%;
    max-width: 400px;
    border-radius: 16px;
    border: 1px solid var(--border-slate);
    background-color: var(--bg-card);
    box-shadow: 0 20px 40px rgba(0,0,0,0.6);
    overflow: hidden;
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#history-modal .modal-card {
    max-width: 800px; /* Double width size for Watched History */
}

#history-modal .watchlist-item {
    padding: 0.8rem; /* Larger padding for history items */
    gap: 1.2rem;
}

#history-modal .watchlist-poster {
    width: 64px; /* Doubled from 32px */
    height: 96px; /* Doubled from 48px */
    border-radius: 6px;
}

#history-modal .watchlist-title {
    font-size: 1.28rem; /* Increased by 50% from 0.85rem */
    font-weight: 600;
}

#history-modal .watchlist-sub {
    font-size: 0.95rem; /* Proportionally larger rating text */
}

#history-modal .watchlist-item .btn-icon {
    width: 40px; /* Proportionally larger delete button */
    height: 40px;
    font-size: 1.1rem;
}

.modal-overlay:not(.hidden) .modal-card {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-slate);
}

.modal-tabs {
    display: flex;
    gap: 1rem;
}

.tab-btn {
    background: none;
    border: none;
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    padding-bottom: 0.2rem;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.tab-btn.active {
    color: var(--accent-indigo);
    border-bottom-color: var(--accent-indigo);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    transition: color 0.15s ease;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

/* Forms inside modal */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper i {
    position: absolute;
    left: 0.75rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.input-wrapper .form-input {
    padding-left: 2.2rem;
}

.auth-error-alert {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 0.6rem 0.8rem;
    border-radius: 6px;
    font-size: 0.8rem;
    margin-bottom: 1rem;
}

/* Details Modal details styling */
#details-modal .modal-card {
    max-width: 500px;
}

#details-modal h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.details-content {
    display: flex;
    gap: 1.2rem;
}

.details-poster {
    width: 100px;
    height: 150px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border-slate);
    flex-shrink: 0;
}

.details-text {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.details-rating-row {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

#details-overview {
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--text-secondary);
    max-height: 120px;
    overflow-y: auto;
}

.details-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
    padding-top: 0.5rem;
}

/* Toast Notifications styling */
.toast-notification {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(40px);
    background-color: rgba(18, 18, 26, 0.95);
    border: 1px solid var(--border-slate-bright);
    color: #fff;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast-notification.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.hidden {
    display: none !important;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive breakpoint styling (Mobile/Tablet View) */
@media (max-width: 1024px) {
    body {
        overflow-y: auto;
        height: auto;
    }
    
    .app-container {
        flex-direction: column;
        height: auto;
        overflow: visible;
    }
    
    .recommendation-canvas {
        flex: 1 1 100%;
        max-width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-slate);
        padding: 1.5rem;
        height: auto;
        overflow: visible;
    }
    
    .sidebar {
        flex: 1 1 100%;
        max-width: 100%;
        padding: 1.5rem;
        height: auto;
        overflow: visible;
        border-top: 1px solid var(--border-slate);
    }
    
    .canvas-content {
        margin: 1rem 0;
    }
    
    .movie-meta-card {
        padding: 1rem;
    }
    
    .meta-main {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .title-row {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }
    
    .subtitle-row {
        justify-content: center;
    }
    
    .genre-tags {
        justify-content: center;
    }
    
    .controls-panel {
        flex-wrap: wrap;
        gap: 0.6rem;
    }
    
    .controls-panel button {
        flex: 1 1 45%;
    }
    
    #next-btn {
        order: -1;
        flex: 1 1 100%;
    }
    
    .genres-grid {
        max-height: 120px;
    }
    
    .details-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .details-actions {
        justify-content: center;
    }
}
