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

:root {
    --bg-primary: #141414;
    --bg-secondary: #1a1a1a;
    --bg-card: #222;
    --bg-hover: #333;
    --text-primary: #fff;
    --text-secondary: #999;
    --accent: #e50914;
    --accent-hover: #f6121d;
    --success: #00b894;
    --danger: #e74c3c;
    --border: #333;
    --radius: 6px;
    --radius-sm: 4px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

.hidden { display: none !important; }

a { color: inherit; }

/* ─── Header ───────────────────────────────────────────────────── */

.netflix-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 200;
    background: linear-gradient(180deg, rgba(0,0,0,.9) 10%, transparent);
    padding: 16px 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background .3s;
}

.netflix-header.scrolled {
    background: rgba(20,20,20,.97);
    backdrop-filter: blur(8px);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    font-size: 22px;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: -0.5px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    text-decoration: none;
}

.btn-icon:hover {
    background: rgba(255,255,255,.1);
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0,0,0,.6);
    border: 1px solid #555;
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    width: 250px;
    transition: border-color .2s;
}

.search-box:focus-within {
    border-color: #fff;
}

.search-box svg {
    color: #999;
    flex-shrink: 0;
}

.search-box input {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    width: 100%;
    outline: none;
}

.search-box input::placeholder {
    color: #777;
}

/* ─── Netflix Rows ─────────────────────────────────────────────── */

.catalog-rows {
    padding-top: 80px;
    padding-bottom: 60px;
}

.row-section {
    margin-bottom: 36px;
    padding-left: 40px;
}

.row-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 12px;
    color: #ddd;
}

.row-slider {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    padding-bottom: 8px;
    scrollbar-width: none;
}

.row-slider::-webkit-scrollbar {
    display: none;
}

/* ─── Card ─────────────────────────────────────────────────────── */

.catalog-card {
    flex-shrink: 0;
    width: 160px;
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    position: relative;
    background: var(--bg-card);
    transition: transform .25s, box-shadow .25s;
}

.catalog-card:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 30px rgba(0,0,0,.6);
    z-index: 10;
}

.card-poster {
    width: 100%;
    aspect-ratio: 2/3;
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.card-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-placeholder::after {
    content: '';
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,.08);
}

.card-info {
    padding: 8px 10px;
    display: none;
}

.card-title {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,.85));
    padding: 30px 10px 10px;
    opacity: 0;
    transition: opacity .25s;
    pointer-events: none;
}

.catalog-card:hover .card-overlay {
    opacity: 1;
}

.card-overlay-title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
}

/* ─── Search Results Grid ──────────────────────────────────────── */

.search-results {
    padding: 90px 40px 60px;
}

.search-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.search-results .catalog-card {
    width: 100%;
}

.search-results .card-info {
    display: block;
}

.search-results .card-overlay {
    display: none;
}

/* ─── Empty State ──────────────────────────────────────────────── */

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

.empty-state svg {
    margin-bottom: 16px;
    opacity: .2;
}

.empty-state h3 {
    font-size: 20px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

/* ─── Modal ────────────────────────────────────────────────────── */

.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.7);
}

.modal-content {
    position: relative;
    background: #181818;
    border-radius: 12px 12px 0 0;
    width: 100%;
    max-width: 700px;
    max-height: 85vh;
    overflow-y: auto;
    animation: slideUp .3s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #333;
    border: none;
    color: #fff;
    font-size: 20px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: background .2s;
}

.modal-close:hover {
    background: #555;
}

.modal-backdrop {
    width: 100%;
    height: 250px;
    background-size: cover;
    background-position: center top;
    background-color: #1a1a2e;
    border-radius: 12px 12px 0 0;
}

.modal-body {
    padding: 20px 28px 28px;
}

.modal-info h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 10px;
}

.modal-meta {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.badge {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    background: #333;
    color: #ccc;
}

.badge-type {
    background: var(--accent);
    color: white;
}

/* ─── WhatsApp Button ──────────────────────────────────────────── */

.btn-whatsapp {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #25d366;
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    transition: background .2s, transform .1s;
}

.btn-whatsapp:hover {
    background: #20bd5a;
    transform: scale(1.02);
}

.btn-whatsapp:active {
    transform: scale(0.98);
}

/* ─── Config Page ──────────────────────────────────────────────── */

.config-page {
    padding: 80px 20px 60px;
    display: flex;
    justify-content: center;
}

.config-content {
    width: 100%;
    max-width: 560px;
}

.config-block {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 28px;
    margin-bottom: 20px;
}

.config-block h2 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.subtitle {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 14px;
}

.config-section {
    margin-bottom: 18px;
}

.config-section label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #bbb;
}

.hint {
    display: block;
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

.input-group {
    display: flex;
    gap: 8px;
}

.input-group input,
.config-section > input {
    width: 100%;
    padding: 10px 14px;
    background: #111;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: border-color .2s;
}

.input-group input:focus,
.config-section > input:focus {
    border-color: var(--accent);
}

.divider {
    display: flex;
    align-items: center;
    margin: 20px 0;
    color: #666;
    font-size: 13px;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.divider span {
    padding: 0 14px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-success {
    background: var(--success);
    color: white;
    width: 100%;
    padding: 12px;
    font-size: 15px;
}

.btn-success:hover {
    opacity: .9;
}

.btn-danger {
    background: transparent;
    color: #888;
    border: 1px solid #444;
    width: 100%;
    padding: 10px;
    font-size: 13px;
}

.btn-danger:hover {
    border-color: var(--danger);
    color: var(--danger);
}

.file-upload {
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 36px;
    text-align: center;
    cursor: pointer;
    transition: all .2s;
}

.file-upload:hover,
.file-upload.dragover {
    border-color: var(--accent);
    background: rgba(229, 9, 20, .05);
}

.file-upload-content {
    color: var(--text-secondary);
}

.file-upload-content svg {
    margin-bottom: 10px;
    opacity: .4;
}

.file-upload-content .link {
    color: var(--accent);
    text-decoration: underline;
}

.config-status {
    margin-top: 14px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
}

.config-status.success {
    background: rgba(0, 184, 148, .1);
    color: var(--success);
    border: 1px solid rgba(0, 184, 148, .2);
}

.config-status.error {
    background: rgba(231, 76, 60, .1);
    color: var(--danger);
    border: 1px solid rgba(231, 76, 60, .2);
}

.config-status.loading {
    background: rgba(229, 9, 20, .1);
    color: var(--accent);
    border: 1px solid rgba(229, 9, 20, .2);
}

.config-info {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
    border-top: 1px solid #333;
}

.config-info-label {
    color: var(--text-secondary);
}

.config-info-value {
    font-weight: 600;
    max-width: 60%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.config-actions {
    margin-top: 8px;
}

/* ─── Responsive ───────────────────────────────────────────────── */

@media (max-width: 768px) {
    .netflix-header {
        padding: 12px 16px;
    }

    .search-box {
        width: 160px;
    }

    .row-section {
        padding-left: 16px;
    }

    .row-title {
        font-size: 16px;
    }

    .catalog-card {
        width: 120px;
    }

    .modal-body {
        padding: 16px 20px 24px;
    }

    .modal-backdrop {
        height: 180px;
    }

    .config-block {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 18px;
    }

    .search-box {
        width: 120px;
    }

    .catalog-card {
        width: 100px;
    }

    .row-section {
        margin-bottom: 24px;
    }
}

/* ─── Scrollbar ────────────────────────────────────────────────── */

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #444; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #666; }

/* ─── Spinner ──────────────────────────────────────────────────── */

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--accent);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin .6s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

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