/* NFSW FACE SWAP - Styles */
:root {
    --bg: #0a0a0f;
    --bg-2: #14141d;
    --bg-3: #1c1c28;
    --border: #2a2a3a;
    --text: #f0f0f5;
    --text-dim: #9090a8;
    --primary: #7c3aed;
    --primary-2: #a855f7;
    --primary-glow: rgba(124, 58, 237, 0.4);
    --accent: #ec4899;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --radius: 14px;
    --radius-sm: 8px;
    --transition: 200ms ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 15% 10%, rgba(124, 58, 237, 0.15), transparent 40%),
        radial-gradient(circle at 85% 80%, rgba(236, 72, 153, 0.12), transparent 40%);
    pointer-events: none;
    z-index: -1;
}

a { color: var(--primary-2); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============ TOPBAR ============ */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(10, 10, 15, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}
.topbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 17px;
    color: var(--primary-2);
}
.brand svg { color: var(--primary-2); }
.nav {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}
.nav-link {
    color: var(--text-dim);
    font-weight: 500;
    font-size: 14px;
    padding: 6px 0;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
    text-decoration: none;
}
.nav-link:hover, .nav-link.active {
    color: var(--text);
    border-bottom-color: var(--primary);
    text-decoration: none;
}
.nav-user {
    font-size: 13px;
    color: var(--text-dim);
    padding-left: 12px;
    border-left: 1px solid var(--border);
}

/* ============ CONTAINER ============ */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 20px 80px;
}

/* ============ HERO ============ */
.hero { text-align: center; margin-bottom: 36px; }
.hero h1 {
    font-size: 38px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-2), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 10px;
    line-height: 1.15;
}
.hero p { color: var(--text-dim); font-size: 16px; max-width: 560px; margin: 0 auto; }

/* ============ CARDS ============ */
.card {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    transition: var(--transition);
}
.card h2 {
    font-size: 17px;
    margin-bottom: 16px;
    color: var(--text);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.generator { display: flex; flex-direction: column; gap: 0; }

/* ============ UPLOADS ============ */
.uploads {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.upload-zone {
    position: relative;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    aspect-ratio: 1;
    cursor: pointer;
    overflow: hidden;
    background: var(--bg);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}
.upload-zone:hover, .upload-zone.drag {
    border-color: var(--primary);
    background: rgba(124, 58, 237, 0.06);
}
.upload-zone.optional { border-style: dashed; }
.upload-zone.uploading { opacity: 0.6; pointer-events: none; }
.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-dim);
    text-align: center;
    padding: 16px;
}
.upload-placeholder svg { color: var(--primary-2); opacity: 0.7; }
.upload-placeholder strong { color: var(--text); font-size: 14px; }
.upload-placeholder small { font-size: 12px; }
.upload-placeholder .opt { color: var(--text-dim); font-weight: 400; font-size: 11px; }
.upload-zone img {
    width: 100%; height: 100%; object-fit: cover;
}
.upload-remove {
    position: absolute;
    top: 8px; right: 8px;
    width: 28px; height: 28px;
    border-radius: 50%;
    background: rgba(0,0,0,0.7);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.upload-remove:hover { background: var(--error); }

/* ============ FORM ============ */
textarea, input[type="text"], input[type="email"], input[type="password"], input[type="number"], select {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 15px;
    font-family: inherit;
    transition: var(--transition);
}
textarea { resize: vertical; min-height: 80px; }
textarea:focus, input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}
.preset {
    background: var(--bg-3);
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
}
.preset:hover {
    background: rgba(124, 58, 237, 0.15);
    border-color: var(--primary);
    color: var(--text);
}

.hint {
    text-align: center;
    color: var(--text-dim);
    font-size: 13px;
    margin-top: 10px;
}

/* ============ BUTTONS ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-decoration: none;
    font-family: inherit;
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: white;
    box-shadow: 0 4px 14px var(--primary-glow);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px var(--primary-glow); text-decoration: none; }
.btn-primary:disabled {
    background: var(--bg-3);
    color: var(--text-dim);
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}
.btn-ghost {
    background: transparent;
    color: var(--text-dim);
    border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--primary); text-decoration: none; }
.btn-block { width: 100%; }
.btn-large { padding: 14px 24px; font-size: 16px; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ============ PROGRESS ============ */
.active-job {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.08), rgba(236, 72, 153, 0.04));
}
.progress-wrap { margin-top: 8px; }
.progress-bar {
    height: 8px;
    background: var(--bg);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 10px;
}
#progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    width: 0%;
    transition: width 600ms ease;
}
#progress-text { color: var(--text-dim); font-size: 13px; text-align: center; }

/* ============ HISTORY ============ */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 36px 0 16px;
}
.section-header h2 { font-size: 22px; }

.jobs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}
.empty {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-dim);
    padding: 40px 20px;
    background: var(--bg-2);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}
.job-card {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
}
.job-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.job-thumb {
    width: 100%;
    aspect-ratio: 16/10;
    object-fit: cover;
    background: var(--bg);
    display: block;
}
.thumb-img { display: flex; align-items: center; justify-content: center; }
.thumb-img img { width: 100%; height: 100%; object-fit: cover; opacity: 0.6; filter: blur(2px); }
.job-body { padding: 12px 14px; }
.job-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.job-del {
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 14px;
    padding: 4px 6px;
    border-radius: 4px;
}
.job-del:hover { color: var(--error); background: rgba(239, 68, 68, 0.1); }
.job-prompt {
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    min-height: 36px;
}
.job-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.job-footer small { color: var(--text-dim); font-size: 11px; }
.job-footer .err { color: var(--error); font-size: 11px; }

/* ============ BADGES ============ */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.badge-done { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.badge-processing { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.badge-pending { background: rgba(156, 163, 175, 0.15); color: var(--text-dim); }
.badge-failed { background: rgba(239, 68, 68, 0.15); color: var(--error); }
.badge-admin { background: rgba(124, 58, 237, 0.15); color: var(--primary-2); }
.badge-user { background: rgba(156, 163, 175, 0.15); color: var(--text-dim); }

/* ============ MODAL ============ */
[hidden] { display: none !important; }
.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-bg {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
}
.modal-content {
    position: relative;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    background: var(--bg-2);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}
.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    cursor: pointer;
    z-index: 2;
    font-size: 18px;
}
.modal-content video {
    width: 100%;
    max-height: 70vh;
    background: black;
    display: block;
}
.modal-actions {
    padding: 16px;
    display: flex;
    gap: 10px;
    justify-content: center;
    border-top: 1px solid var(--border);
}

/* ============ TOAST ============ */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 22px;
    border-radius: var(--radius-sm);
    background: var(--bg-3);
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    font-size: 14px;
    font-weight: 500;
    z-index: 200;
    max-width: calc(100vw - 40px);
}
.toast-success { border-color: var(--success); color: var(--success); }
.toast-error { border-color: var(--error); color: var(--error); }

/* ============ AUTH ============ */
.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.auth-card {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}
.auth-logo {
    text-align: center;
    margin-bottom: 24px;
}
.auth-logo svg { color: var(--primary-2); margin-bottom: 12px; }
.auth-logo h1 {
    font-size: 22px;
    background: linear-gradient(135deg, var(--primary-2), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 4px;
}
.auth-subtitle { color: var(--text-dim); font-size: 13px; }
.auth-tabs {
    display: flex;
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 4px;
    margin-bottom: 20px;
}
.auth-tab {
    flex: 1;
    text-align: center;
    padding: 8px;
    border-radius: 6px;
    color: var(--text-dim);
    font-weight: 500;
    font-size: 14px;
    transition: var(--transition);
}
.auth-tab.active { background: var(--primary); color: white; text-decoration: none; }
.auth-tab:hover:not(.active) { color: var(--text); text-decoration: none; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: var(--text-dim);
    font-weight: 500;
}
.auth-hint {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-dim);
}
.auth-hint code {
    background: var(--bg);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 12px;
    color: var(--primary-2);
}
.alert {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 14px;
    font-size: 13px;
}
.alert-error { background: rgba(239, 68, 68, 0.1); color: var(--error); border: 1px solid rgba(239, 68, 68, 0.3); }

/* ============ ADMIN ============ */
.admin-container { max-width: 1200px; }
.admin-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-2);
    padding: 6px;
    border-radius: var(--radius-sm);
    margin-bottom: 24px;
    overflow-x: auto;
    border: 1px solid var(--border);
}
.admin-tab {
    background: transparent;
    border: none;
    color: var(--text-dim);
    padding: 9px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    white-space: nowrap;
    font-family: inherit;
    transition: var(--transition);
}
.admin-tab:hover { color: var(--text); }
.admin-tab.active { background: var(--primary); color: white; }
.admin-pane { display: none; }
.admin-pane.active { display: block; }
.admin-pane h2 { margin-bottom: 18px; font-size: 22px; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}
.stat-card {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
}
.stat-label { color: var(--text-dim); font-size: 13px; margin-bottom: 6px; }
.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-2);
}

.table-wrap {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: auto;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.data-table th {
    text-align: left;
    padding: 12px 14px;
    color: var(--text-dim);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-3);
}
.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(124, 58, 237, 0.04); }
.data-table .empty { text-align: center; color: var(--text-dim); padding: 30px; }
.cell-clip {
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.settings-form {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    max-width: 700px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.form-group label {
    color: var(--text);
    font-weight: 500;
    font-size: 14px;
}
.form-group small {
    color: var(--text-dim);
    font-size: 12px;
}

.domain-card {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    max-width: 560px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.domain-card label { color: var(--text); font-weight: 500; font-size: 14px; }
.domain-card small { color: var(--text-dim); font-size: 12px; text-align: center; }
.muted { color: var(--text-dim); margin-bottom: 20px; }

/* ============ RESPONSIVE ============ */
@media (max-width: 720px) {
    .hero h1 { font-size: 28px; }
    .uploads { grid-template-columns: 1fr; }
    .topbar-inner { gap: 8px; padding: 12px 16px; }
    .nav { gap: 12px; }
    .nav-user { display: none; }
    .container { padding: 24px 14px 60px; }
    .card { padding: 18px; }
    .jobs-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
    .modal-content { max-height: 95vh; }
    .modal-content video { max-height: 55vh; }
}
@media (max-width: 480px) {
    .hero h1 { font-size: 24px; }
    .nav-link { font-size: 13px; }
    .presets .preset { font-size: 11px; padding: 5px 10px; }
}
