/* Admin Panel Styles — self-contained, dark theme */

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

:root {
    --bg: #0a0a0a;
    --bg-card: #141414;
    --bg-input: #1a1a1a;
    --text: #f0f0f0;
    --text-secondary: #a0a0a0;
    --text-muted: #666;
    --border: #2a2a2a;
    --primary: #e63946;
    --primary-dark: #c1121f;
    --success: #2ec4b6;
    --warning: #f4a261;
    --error: #e63946;
    --info: #457b9d;
    --radius: 8px;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    font-family: var(--font);
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: #ff6b6b; }

/* Layout */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 220px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 20px 0;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.admin-sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 20px 20px;
    font-size: 18px;
    font-weight: 700;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
}

.admin-sidebar-logo .admin-logo-img {
    height: 32px;
    width: auto;
    display: block;
}

.admin-sidebar-logo span { color: var(--text-secondary); }

.admin-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
}

.admin-nav a:hover, .admin-nav a.active {
    color: var(--text);
    background: rgba(255,255,255,0.04);
}

.admin-nav a.active {
    border-left: 3px solid var(--primary);
    padding-left: 17px;
}

.admin-nav .badge {
    margin-left: auto;
    background: var(--primary);
    color: #fff;
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
}

.admin-content {
    flex: 1;
    padding: 30px;
    min-width: 0;
}

.admin-content h1 {
    font-size: 22px;
    margin-bottom: 24px;
}

/* Cards & Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 30px;
}

.stat-card {
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
}

/* Table */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.admin-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: var(--bg-input);
    border-bottom: 1px solid var(--border);
}

.admin-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: rgba(255,255,255,0.02); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font);
    color: var(--text);
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #000; }
.btn-danger { background: var(--error); color: #fff; }
.btn-outline { background: transparent; border-color: var(--border); }
.btn-outline:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { color: var(--text); }

/* Forms */
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    outline: none;
    font-family: var(--font);
}

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

/* Badges */
.badge-status {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 4px;
}

.badge-active, .badge-approved { background: rgba(46,196,182,0.15); color: var(--success); }
.badge-pending, .badge-pending_approval { background: rgba(244,162,97,0.15); color: var(--warning); }
.badge-rejected, .badge-canceled, .badge-banned { background: rgba(230,57,70,0.15); color: var(--error); }
.badge-fan { background: rgba(69,123,157,0.15); color: var(--info); }
.badge-promotion { background: rgba(244,162,97,0.15); color: var(--warning); }
.badge-admin { background: rgba(230,57,70,0.15); color: var(--primary); }

/* Utilities */
.flex { display: flex; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.text-success { color: var(--success); }
.text-error { color: var(--error); }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

/* Approval card */
.approval-card {
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 12px;
}

.approval-card h3 { font-size: 16px; margin-bottom: 8px; }

.approval-card .meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.approval-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

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

.approval-images {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.approval-image-wrap {
    flex: 0 0 auto;
}

.approval-img {
    max-width: 220px;
    max-height: 300px;
    border-radius: 6px;
    border: 1px solid var(--border);
    object-fit: contain;
    background: var(--bg);
}

.approval-detail-grid {
    padding: 16px 0;
}

.approval-detail-row {
    display: flex;
    gap: 12px;
    padding: 6px 0;
    font-size: 13px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.approval-detail-row:last-child { border-bottom: none; }

.approval-detail-label {
    flex: 0 0 130px;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.approval-detail-value {
    flex: 1;
    min-width: 0;
    word-break: break-word;
}

/* Expanded detail rows (users/promotions pages)
   Rendered inside a colspan TD; the .detail-panel constrains width and
   gives the content a card-like container that isn't distorted by the
   parent table's column widths. */
.detail-panel {
    max-width: 1100px;
    margin: 0 auto;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 18px 22px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}
.detail-panel-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 600;
    margin: 0 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 10px 24px;
    font-size: 13px;
}
.detail-row {
    /* kept for table row animations; reset any grid leakage */
}
.detail-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.detail-field > .detail-label {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.detail-field > .detail-value {
    font-size: 13px;
    word-break: break-word;
}
.detail-section {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}
.detail-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 600;
    margin: 0 0 10px;
}
.detail-shows-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-top: 8px;
    background: rgba(255,255,255,0.02);
    border-radius: 6px;
    overflow: hidden;
}
.detail-shows-table th,
.detail-shows-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    vertical-align: middle;
}
.detail-shows-table tr:last-child td { border-bottom: none; }
.detail-shows-table th {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.06em;
    font-weight: 600;
    background: rgba(255,255,255,0.03);
}

.approval-description {
    max-height: 200px;
    overflow-y: auto;
    line-height: 1.6;
    font-size: 13px;
    color: var(--text-secondary);
}

.approval-details {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 16px;
    margin-top: 12px;
}

.text-primary { color: var(--primary); }
.mb-1 { margin-bottom: 4px; }
.mt-3 { margin-top: 12px; }

/* Login */
.admin-login {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.admin-login-card {
    width: 380px;
    padding: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.admin-login-card h1 {
    font-size: 20px;
    text-align: center;
    margin-bottom: 24px;
}

.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; font-weight: 500; }

/* Modal */
.admin-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 16px;
}

.admin-modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.admin-modal-content h2 {
    font-size: 18px;
    margin-bottom: 16px;
}

@media (max-width: 768px) {
    .admin-sidebar { display: none; }
    .admin-content { padding: 16px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Invoice user picker — hover background for the dropdown rows.
   Replaces the old inline onmouseover/onmouseout, which CSP blocks. */
.invoice-user-option:hover {
    background: var(--border);
}
