/* ========================================
   Admin Dashboard - Styles
   ======================================== */

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

:root {
    --bg: #0f1117;
    --bg-card: #181b22;
    --bg-sidebar: #12141a;
    --bg-input: #1e2029;
    --border: rgba(255,255,255,0.07);
    --gold: #c8a97e;
    --gold-light: #e0c9a6;
    --green: #2ecc71;
    --orange: #e67e22;
    --red: #e74c3c;
    --text: #e8e6e3;
    --text-muted: #8a8b8f;
    --font: 'Inter', -apple-system, sans-serif;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* ========== LOGIN ========== */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1520 100%);
}
.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 48px 40px;
    width: 400px;
    text-align: center;
}
.login-logo {
    width: 60px; height: 60px;
    background: linear-gradient(135deg, var(--gold), #a68b5b);
    color: #0a0a0a;
    font-size: 1.8rem;
    font-weight: 700;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}
.login-card h1 { font-size: 1.5rem; color: var(--text); margin-bottom: 4px; }
.login-card > p { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 32px; }
.login-card input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: var(--font);
    font-size: 0.9rem;
    margin-bottom: 12px;
    outline: none;
    transition: border-color 0.3s;
}
.login-card input:focus { border-color: var(--gold); }
.btn-login {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--gold), #a68b5b);
    color: #0a0a0a;
    border: none;
    border-radius: 8px;
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 4px;
    transition: transform 0.2s, box-shadow 0.2s;
}
.btn-login:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(200,169,126,0.3);
}
.login-error {
    color: var(--red);
    font-size: 0.85rem;
    margin-top: 12px;
    min-height: 20px;
}

/* ========== DASHBOARD LAYOUT ========== */
.dashboard {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px 24px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}
.sidebar-logo {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--gold), #a68b5b);
    color: #0a0a0a;
    font-size: 1.2rem;
    font-weight: 700;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sidebar-brand span { font-weight: 600; font-size: 0.95rem; }
.sidebar-nav { flex: 1; }
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
    margin-bottom: 4px;
}
.sidebar-link:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.sidebar-link.active { background: rgba(200,169,126,0.1); color: var(--gold); }
.sidebar-footer {
    border-top: 1px solid var(--border);
    padding-top: 16px;
}
.btn-logout {
    width: 100%;
    padding: 10px;
    background: rgba(231,76,60,0.1);
    border: 1px solid rgba(231,76,60,0.2);
    color: var(--red);
    border-radius: 8px;
    font-family: var(--font);
    font-size: 0.85rem;
    cursor: pointer;
    margin-top: 8px;
    transition: background 0.2s;
}
.btn-logout:hover { background: rgba(231,76,60,0.2); }

.main {
    padding: 32px;
    overflow-y: auto;
}

/* ========== TABS ========== */
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.3s ease; }
.tab-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 28px;
}
.tab-header h2 { font-size: 1.5rem; font-weight: 600; }
.tab-desc { color: var(--text-muted); font-size: 0.85rem; margin-top: 4px; }

.btn-action {
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--gold), #a68b5b);
    color: #0a0a0a;
    border: none;
    border-radius: 8px;
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    white-space: nowrap;
}
.btn-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(200,169,126,0.25);
}
.btn-action.btn-danger {
    background: linear-gradient(135deg, var(--red), #c0392b);
    color: white;
}
.btn-action.btn-secondary {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
}

/* ========== STATS ========== */
.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
}
.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gold);
    line-height: 1;
    margin-bottom: 4px;
}
.stat-label { color: var(--text-muted); font-size: 0.8rem; }

/* ========== TABLE ========== */
.table-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table th {
    text-align: left;
    padding: 14px 16px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    background: rgba(255,255,255,0.02);
    border-bottom: 1px solid var(--border);
}
.data-table td {
    padding: 14px 16px;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,0.02); }

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}
.status-active { background: rgba(46,204,113,0.1); color: var(--green); }
.status-pending { background: rgba(230,126,34,0.1); color: var(--orange); }

.action-btns { display: flex; gap: 6px; }
.action-btn {
    padding: 6px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}
.action-btn:hover { border-color: var(--gold); color: var(--gold); }
.action-btn.delete:hover { border-color: var(--red); color: var(--red); }

.dropbox-link {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.empty-state {
    padding: 60px 20px;
    text-align: center;
    display: none;
}
.empty-state.visible { display: block; }
.empty-icon { font-size: 3rem; margin-bottom: 16px; }
.empty-state h3 { color: var(--text); margin-bottom: 8px; }
.empty-state p { color: var(--text-muted); font-size: 0.9rem; }

/* ========== MODAL ========== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(5px);
}
.modal-overlay.open { display: flex; animation: fadeIn 0.2s ease; }
.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 28px;
    width: 500px;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-sm { width: 360px; }
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.modal-header h3 { font-size: 1.2rem; }
.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px;
}
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.label-hint { color: var(--text-muted); font-weight: 400; font-size: 0.75rem; }
.input-field {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: var(--font);
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.3s;
}
.input-field:focus { border-color: var(--gold); }
.field-note { font-size: 0.75rem; color: var(--text-muted); margin-top: 6px; }
.slug-preview {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}
.slug-prefix {
    padding: 10px 2px 10px 14px;
    color: var(--text-muted);
    font-size: 0.8rem;
    white-space: nowrap;
}
.slug-preview .input-field {
    border: none;
    border-radius: 0;
    padding-left: 0;
    background: transparent;
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 24px;
}
.btn-cancel {
    padding: 10px 20px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 8px;
    font-family: var(--font);
    font-size: 0.85rem;
    cursor: pointer;
}
.btn-cancel:hover { border-color: var(--text-muted); }

/* QR Preview */
.qr-preview {
    text-align: center;
    padding: 20px;
}
.qr-preview img {
    max-width: 200px;
    border-radius: 8px;
    margin-bottom: 12px;
}
.qr-url {
    color: var(--text-muted);
    font-size: 0.85rem;
    word-break: break-all;
}

/* ========== SCANNER ========== */
.scanner-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}
.scanner-video-wrap {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 4/3;
}
.scanner-video-wrap video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.scanner-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.scanner-frame {
    width: 200px;
    height: 200px;
    border: 2px solid var(--gold);
    border-radius: 12px;
    box-shadow: 0 0 0 9999px rgba(0,0,0,0.4);
}
.scanner-controls {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
}
.scanner-info {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
}
.scanner-info h3 { margin-bottom: 12px; font-size: 1rem; }
.scanner-info select { margin-bottom: 16px; }
.scan-result {
    background: var(--bg-input);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    margin-bottom: 16px;
}
.scan-result-icon { font-size: 2rem; margin-bottom: 8px; }
.scan-result p { color: var(--text-muted); font-size: 0.85rem; }
.scan-result.success { background: rgba(46,204,113,0.1); border: 1px solid rgba(46,204,113,0.3); }
.scan-result.success p { color: var(--green); }
.scan-log h4 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.scan-log-entry {
    padding: 8px 12px;
    background: var(--bg-input);
    border-radius: 6px;
    font-size: 0.8rem;
    margin-bottom: 4px;
    color: var(--text-muted);
}

/* ========== LABELS ========== */
.labels-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}
.option-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px;
}
.option-card h3 { margin-bottom: 8px; font-size: 1.1rem; }
.option-card p { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 16px; }
.option-card select, .option-card input { margin-bottom: 12px; }
.input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.input-row label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .dashboard { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed;
        bottom: 0; left: 0; right: 0;
        height: auto;
        flex-direction: row;
        padding: 8px;
        z-index: 100;
        border-right: none;
        border-top: 1px solid var(--border);
    }
    .sidebar-brand, .sidebar-footer { display: none; }
    .sidebar-nav {
        display: flex;
        width: 100%;
        justify-content: space-around;
    }
    .sidebar-link { flex-direction: column; font-size: 0.65rem; gap: 4px; padding: 8px; }
    .main { padding: 16px; padding-bottom: 80px; }
    .stats-row { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .scanner-layout, .labels-options { grid-template-columns: 1fr; }
}
