/* Admin Panel — Phase 3. Full premium design pass arrives in Phase 5. */

.admin-body { background: #0a0a0d; }
.admin-shell { display: flex; min-height: 100vh; }

.admin-sidebar {
    width: 240px; background: #131318; border-right: 1px solid #24242c;
    padding: 24px 16px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.admin-logo { font-weight: 700; font-size: 18px; margin-bottom: 32px; padding: 0 8px; color: #fff; }
.admin-sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.admin-sidebar nav a { padding: 10px 12px; border-radius: 8px; color: #a1a1aa; font-size: 14px; }
.admin-sidebar nav a:hover { background: #1c1c24; color: #fff; }
.admin-sidebar nav a.disabled { opacity: .35; cursor: not-allowed; pointer-events: none; }
.admin-logout-form button { width: 100%; padding: 10px; background: transparent; border: 1px solid #26262e; border-radius: 8px; color: #a1a1aa; cursor: pointer; font-size: 13px; }

.admin-main { flex: 1; padding: 32px 40px; max-width: 1200px; }
.admin-main h1 { font-size: 24px; margin-bottom: 20px; color: #fff; }
.admin-main h2 { font-size: 16px; margin-bottom: 12px; color: #fff; }
.admin-main h3 { font-size: 14px; margin: 24px 0 4px; color: #d4d4d8; text-transform: uppercase; letter-spacing: .05em; }

.admin-page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 32px; }
.kpi-card { background: #131318; border: 1px solid #24242c; border-radius: 12px; padding: 20px; }
.kpi-card.kpi-alert { border-color: rgba(251,191,36,.3); }
.kpi-label { display: block; font-size: 12px; color: #a1a1aa; margin-bottom: 8px; }
.kpi-value { display: block; font-size: 26px; font-weight: 700; color: #fff; }

.admin-panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }

/* Mobile: stack sidebar above content instead of squeezing it into a sliver */
@media (max-width: 860px) {
    .admin-shell { flex-direction: column; }
    .admin-sidebar { width: 100%; height: auto; position: static; padding: 16px; }
    .admin-sidebar nav { flex-direction: row; flex-wrap: wrap; gap: 4px; }
    .admin-sidebar nav a { padding: 8px 10px; font-size: 13px; }
    .admin-main { padding: 20px 16px; max-width: 100%; }
    .kpi-grid, .admin-panels { grid-template-columns: 1fr; }
}

.admin-panel { background: #131318; border: 1px solid #24242c; border-radius: 12px; padding: 20px; }

.admin-table { width: 100%; border-collapse: collapse; background: #131318; border: 1px solid #24242c; border-radius: 12px; overflow: hidden; }
.admin-table th, .admin-table td { padding: 12px 16px; text-align: left; font-size: 14px; border-bottom: 1px solid #1e1e26; color: #d4d4d8; }
.admin-table th { color: #a1a1aa; font-weight: 500; font-size: 12px; text-transform: uppercase; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tbody tr { transition: background-color .15s ease; }
.admin-table tbody tr:hover { background-color: rgba(139,92,246,.05); }
.admin-table-actions { display: flex; gap: 12px; }
.admin-table-actions form { display: inline; }

/* Mobile: let wide tables scroll horizontally instead of breaking page layout.
   IMPORTANT: this must stay AFTER the base .admin-table rule above — with
   equal CSS specificity, source order decides the winner, and a rule placed
   earlier gets silently overridden by a later unconditional rule even when
   its own media query matches. */
@media (max-width: 700px) {
    .admin-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
}
.link-danger { background: none; border: none; color: #f87171; cursor: pointer; font-size: 14px; padding: 0; }

.badge { padding: 3px 10px; border-radius: 999px; font-size: 12px; text-transform: capitalize; }
.badge-active, .badge-published, .badge-completed, .badge-paid { background: rgba(34,197,94,.15); color: #86efac; }
.badge-inactive, .badge-draft, .badge-cancelled { background: rgba(161,161,170,.15); color: #a1a1aa; }
.badge-pending { background: rgba(251,191,36,.15); color: #fbbf24; }
.badge-archived, .badge-refunded { background: rgba(239,68,68,.15); color: #fca5a5; }

.admin-form { max-width: 640px; }
.admin-form label { display: block; font-size: 13px; margin: 16px 0 6px; color: #a1a1aa; }
.admin-form input, .admin-form select, .admin-form textarea {
    width: 100%; padding: 10px 14px; background: #0e0e12; border: 1px solid #2c2c36; border-radius: 8px; color: #fff; font-size: 14px; font-family: inherit;
}
.admin-form textarea { resize: vertical; }
.admin-form input:focus, .admin-form select:focus, .admin-form textarea:focus { outline: none; border-color: #8b5cf6; }
.checkbox-row { display: flex; gap: 20px; margin-top: 12px; }
.checkbox-row label { display: flex; align-items: center; gap: 6px; margin: 0; }
.checkbox-row input { width: auto; }
.current-file { font-size: 12px; color: #71717a; margin-top: 4px; }

.btn-primary { display: inline-block; margin-top: 24px; padding: 11px 22px; background: #8b5cf6; border: none; border-radius: 8px; color: #fff; font-weight: 600; cursor: pointer; font-size: 14px; }
.btn-primary:hover { background: #7c3aed; }

.admin-search-bar { display: flex; gap: 8px; margin-bottom: 20px; max-width: 400px; }
.admin-search-bar input { flex: 1; padding: 10px 14px; background: #0e0e12; border: 1px solid #2c2c36; border-radius: 8px; color: #fff; }
.admin-search-bar button { padding: 10px 18px; background: #26262e; border: none; border-radius: 8px; color: #fff; cursor: pointer; }

.pagination { display: flex; gap: 6px; margin-top: 20px; }
.pagination a { padding: 8px 13px; background: #131318; border: 1px solid #24242c; border-radius: 6px; color: #a1a1aa; font-size: 14px; }
.pagination a.active { background: #8b5cf6; color: #fff; border-color: #8b5cf6; }

.empty-state { color: #71717a; padding: 40px; text-align: center; background: #131318; border: 1px dashed #24242c; border-radius: 12px; }
.sale-price { color: #86efac; }

/* Support ticket threads (admin + user) */
.ticket-thread { display: flex; flex-direction: column; gap: 12px; }
.ticket-message { background: #131318; border: 1px solid #24242c; border-radius: 10px; padding: 14px 16px; max-width: 80%; }
.ticket-message-admin { align-self: flex-end; background: rgba(139,92,246,.08); border-color: rgba(139,92,246,.25); }
.ticket-message p { margin-top: 6px; color: #d4d4d8; white-space: pre-line; }

/* ============================================================
   PREMIUM PRODUCT FORM — glassmorphism cards, sticky save,
   Quill dark theme override, structured Features/FAQ repeaters
   ============================================================ */
.admin-card {
    background: rgba(19,19,24,.7);
    backdrop-filter: blur(10px);
    border: 1px solid #24242c;
    border-radius: 14px;
    padding: 22px 24px;
    margin-bottom: 18px;
}
.admin-card h3 { margin-top: 0; }
.admin-card label { display: block; margin-top: 14px; margin-bottom: 6px; font-size: 13px; color: #d4d4d8; }
.admin-card label:first-of-type { margin-top: 0; }
.admin-card input[type="text"],
.admin-card input[type="number"],
.admin-card input[type="datetime-local"],
.admin-card input[type="file"],
.admin-card textarea,
.admin-card select {
    width: 100%; padding: 10px 14px; background: #0e0e12; border: 1px solid #2c2c36;
    border-radius: 8px; color: #fff; font-size: 14px;
}
.admin-card select[multiple] { min-height: 120px; }
.admin-card .checkbox-row { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 6px; }
.admin-card .checkbox-row label { display: flex; align-items: center; gap: 6px; margin: 0; }

.sticky-save-bar {
    position: sticky; bottom: 0; padding: 14px 0; margin-top: 8px;
    background: linear-gradient(to top, #0a0a0d 60%, transparent);
}
.sticky-save-bar .btn-primary { margin-top: 0; box-shadow: 0 8px 24px rgba(139,92,246,.35); }

/* Quill editor — match dark admin theme */
.ql-toolbar.ql-snow { background: #131318; border-color: #2c2c36 !important; border-radius: 10px 10px 0 0; }
.ql-container.ql-snow { border-color: #2c2c36 !important; border-radius: 0 0 10px 10px; min-height: 220px; background: #0e0e12; }
.ql-editor { color: #e4e4e7; min-height: 220px; font-size: 14px; }
.ql-snow .ql-stroke { stroke: #a1a1aa; }
.ql-snow .ql-fill { fill: #a1a1aa; }
.ql-snow .ql-picker { color: #a1a1aa; }
.ql-snow.ql-toolbar button:hover .ql-stroke, .ql-snow .ql-toolbar button:hover .ql-stroke { stroke: #8b5cf6; }
.ql-snow.ql-toolbar button.ql-active .ql-stroke { stroke: #8b5cf6; }
.ql-editor hr { border: none; border-top: 1px solid #2c2c36; margin: 16px 0; }
.editor-meta-bar { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12px; color: #71717a; }

/* Structured repeaters (Features / FAQ) */
.repeater-row {
    display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
    background: #0e0e12; border: 1px solid #24242c; border-radius: 10px; padding: 10px 12px;
}
.repeater-row select.feature-icon-select { width: 64px; flex-shrink: 0; text-align: center; font-size: 16px; padding: 8px; }
.repeater-row input.feature-text-input { flex: 1; }
.feature-highlight-label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #a1a1aa; white-space: nowrap; margin: 0 !important; }
.repeater-move-up, .repeater-move-down, .repeater-remove {
    width: 30px; height: 30px; flex-shrink: 0; background: #17171d; border: 1px solid #2c2c36; border-radius: 6px;
    color: #a1a1aa; cursor: pointer;
}
.repeater-remove:hover { border-color: #f87171; color: #f87171; }
.repeater-move-up:hover, .repeater-move-down:hover { border-color: #8b5cf6; color: #8b5cf6; }
.repeater-add { margin-top: 4px; }

.repeater-row-faq { align-items: flex-start; }
.faq-row-fields { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.faq-row-fields input, .faq-row-fields textarea { width: 100%; }

.btn-outline {
    background: transparent; border: 1px solid #2c2c36; color: #d4d4d8; padding: 9px 16px;
    border-radius: 8px; cursor: pointer; font-size: 13px;
}
.btn-outline:hover { border-color: #8b5cf6; color: #fff; }

/* Gallery manager */
.gallery-manage-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 12px; margin-bottom: 14px; }
.gallery-manage-item {
    display: flex; flex-direction: column; align-items: center; gap: 6px; background: #0e0e12;
    border: 1px solid #24242c; border-radius: 10px; padding: 8px; font-size: 11px; color: #a1a1aa;
}
.gallery-manage-item img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; }

/* ============================================================
   ADMIN DASHBOARD — revenue chart, status breakdown, activity log
   ============================================================ */
.revenue-chart { display: flex; align-items: flex-end; gap: 10px; height: 180px; margin-top: 16px; }
.revenue-chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; }
.revenue-chart-bar-wrap { flex: 1; display: flex; align-items: flex-end; width: 100%; }
.revenue-chart-bar { width: 100%; background: linear-gradient(180deg, #a78bfa, #8b5cf6); border-radius: 6px 6px 0 0; min-height: 4px; transition: opacity .15s ease; }
.revenue-chart-bar:hover { opacity: .8; }
.revenue-chart-value { font-size: 10px; color: #a1a1aa; margin-top: 6px; white-space: nowrap; }
.revenue-chart-label { font-size: 11px; color: #71717a; margin-top: 2px; }

.status-breakdown { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; }
.status-breakdown-row { display: flex; align-items: center; gap: 10px; }
.status-breakdown-bar { flex: 1; height: 8px; background: #1c1c24; border-radius: 999px; overflow: hidden; }
.status-breakdown-bar div { height: 100%; background: #8b5cf6; border-radius: 999px; }
.status-breakdown-count { font-size: 12.5px; color: #a1a1aa; width: 28px; text-align: right; }

.activity-log-list { display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow-y: auto; }
.activity-log-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #1e1e26; font-size: 12.5px; }
.activity-log-actor { flex-shrink: 0; padding: 2px 8px; border-radius: 999px; background: #1c1c24; color: #a1a1aa; font-size: 10.5px; }
.activity-log-desc { flex: 1; color: #d4d4d8; }
.activity-log-time { flex-shrink: 0; color: #71717a; font-size: 11px; }

/* Bulk action bar (products list) */
.bulk-action-bar {
    display: flex; align-items: center; gap: 12px; padding: 10px 14px; margin-bottom: 12px;
    background: #131318; border: 1px solid #24242c; border-radius: 10px; opacity: .5; pointer-events: none;
}
.bulk-action-bar.active { opacity: 1; pointer-events: auto; border-color: #4c3a80; }
.bulk-action-bar select { padding: 7px 10px; background: #0e0e12; border: 1px solid #2c2c36; border-radius: 6px; color: #fff; font-size: 13px; }
.bulk-action-bar button { padding: 7px 16px; font-size: 13px; }
#bulk-selected-count { font-size: 12.5px; color: #a1a1aa; }