/*
 * admin-base.css — Design tokens, reset, and shared UI primitives for the vendor admin.
 * Load before admin.css (see templates/admin/panel/base.html).
 *
 * Contents:
 *   :root tokens · global reset · messages/alerts · cards · buttons · forms · tables · badges
 *   · stats grid · filters · pagination · login page · empty-state · table row actions · modal shell
 *   · page title row · layout utilities (.grid-2, spacing)
 *
 * Page-specific CSS stays in: admin.css, admin-mobile.css, dashboard.css, products.css, orders.css,
 * categories.css, settings.css, banner-admin.css, admin_product_edit.css, etc.
 *
 * Color model: calm SaaS (Stripe-like) — blue primary, neutrals ~85%, accent orange #ff6a00 rare only.
 */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #eff6ff;
    --primary-alpha: rgba(37, 99, 235, 0.12);
    --primary-mid: #3b82f6;
    --accent: #ff6a00;
    --dash-hero-gradient: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 55%, #e2e8f0 100%);
    --success: #16a34a;
    --success-light: #ecfdf5;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --info: #2563eb;
    --info-light: #eff6ff;
    --white: #ffffff;
    --bg-page: #f6f7f9;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --text-muted: rgba(17, 24, 39, 0.4);
    --text-secondary: #6b7280;
    --border-subtle: rgba(0, 0, 0, 0.06);
    --table-row-hover: #f3f4f6;
    --content-max: 1400px;
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 64px;
    --topbar-height: 60px;
    --bottom-nav-height: 64px;
    --transition: all 0.2s ease;
    --radius-sm: 8px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-btn: 10px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.05);
}

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

html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

body {
    font-family: 'Poppins', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-page);
    color: var(--gray-900);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Text links in main content (not buttons, pills, or pager) */
.content-area a:not(.btn):not(.badge):not(.pagination a):not(.banner-pill):not(.report-tile):not(.dash-snap-card-premium):not(.dash-btn-withdraw) {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s ease, text-decoration 0.2s ease;
}

.content-area a:not(.btn):not(.badge):not(.pagination a):not(.banner-pill):not(.report-tile):not(.dash-snap-card-premium):not(.dash-btn-withdraw):hover {
    text-decoration: underline;
}

/* ----- Alerts & flash messages ----- */
.messages-container {
    margin-bottom: 1.5rem;
}

.alert {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.125rem;
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
    animation: alertIn 0.3s ease;
    position: relative;
}

@keyframes alertIn {
    from { transform: translateY(-12px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.alert i { font-size: 1.1rem; flex-shrink: 0; }

.alert-success { background: var(--success-light); color: #065f46; border-left: 4px solid var(--success); }
.alert-error { background: var(--danger-light); color: #7f1d1d; border-left: 4px solid var(--danger); }
.alert-warning { background: var(--warning-light); color: #b45309; border-left: 4px solid var(--warning); }
.alert-info { background: var(--info-light); color: #1e40af; border-left: 4px solid var(--info); }

.alert-close {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    color: inherit;
    opacity: 0.55;
    padding: 0 0.25rem;
    transition: opacity 0.2s;
}

.alert-close:hover { opacity: 1; }

/* ----- Cards ----- */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

@media (min-width: 1024px) {
    .card:hover {
        box-shadow: var(--shadow-md);
        transform: translateY(-1px);
    }
}

.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0;
    letter-spacing: -0.01em;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-100);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    min-height: 40px;
    border: 1.5px solid transparent;
    border-radius: var(--radius-btn);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
    white-space: nowrap;
    font-family: inherit;
    line-height: 1.4;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
    background: var(--primary);
    color: var(--white);
    border-color: transparent;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: transparent;
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(180deg, #22c55e 0%, #16a34a 100%);
    color: var(--white);
    border-color: #15803d;
    box-shadow: var(--shadow-sm);
}

.btn-success:hover {
    background: linear-gradient(180deg, #16a34a 0%, #15803d 100%);
    border-color: #166534;
    box-shadow: var(--shadow-md);
}

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

.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }

.btn-secondary {
    background: var(--white);
    color: var(--gray-700);
    border-color: var(--border-subtle);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
    color: var(--gray-800);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}

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

.btn-sm {
    padding: 0.375rem 0.875rem;
    font-size: 0.8125rem;
    min-height: 36px;
    border-radius: var(--radius-btn);
}

.btn-icon {
    padding: 0.5rem;
    width: 40px;
    height: 40px;
    min-height: 40px;
    border-radius: var(--radius-btn);
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    color: var(--gray-700);
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-control {
    width: 100%;
    padding: 0.625rem 1rem;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--white);
    color: var(--gray-900);
    line-height: 1.5;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-alpha);
}

.form-control::placeholder {
    color: var(--gray-400);
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-check-input {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
    flex-shrink: 0;
}

.form-check-label {
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 400;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

select.form-control {
    cursor: pointer;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -1.5rem;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table thead,
.data-table thead {
    background: var(--gray-50);
}

.table th,
.data-table th {
    padding: 0.75rem 1.5rem;
    text-align: left;
    font-weight: 700;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gray-500);
    border-bottom: 1.5px solid var(--gray-200);
    white-space: nowrap;
}

.table td,
.data-table td {
    padding: 0.875rem 1.5rem;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}

.table tbody tr:hover,
.data-table tbody tr:hover {
    background: var(--table-row-hover);
}

.table-actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: nowrap;
    align-items: center;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.275rem 0.6rem;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 700;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-success { background: var(--success-light); color: #065f46; }
.badge-warning { background: var(--warning-light); color: #b45309; }
.badge-danger { background: var(--danger-light); color: #991b1b; }
.badge-info { background: var(--info-light); color: #1d4ed8; }
.badge-secondary { background: var(--gray-100); color: var(--gray-600); }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--white);
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: box-shadow 0.2s, transform 0.2s;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stat-icon.primary { background: var(--primary-alpha); color: var(--primary); }
.stat-icon.success { background: rgba(22, 163, 74, 0.1); color: var(--success); }
.stat-icon.warning { background: rgba(245, 158, 11, 0.12); color: #d97706; }
.stat-icon.danger { background: rgba(220, 38, 38, 0.1); color: var(--danger); }
.stat-icon.info { background: var(--primary-alpha); color: var(--primary); }

.stat-content { flex: 1; min-width: 0; }

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.stat-value {
    font-size: 1.625rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.1;
}

.stat-value-sm {
    font-size: 0.95rem;
    font-weight: 600;
}

.stat-change {
    font-size: 0.7rem;
    margin-top: 0.2rem;
    font-weight: 500;
}

.stat-change.positive { color: var(--success); }
.stat-change.negative { color: var(--danger); }

.filters {
    display: flex;
    gap: 0.875rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.filter-group {
    flex: 1;
    min-width: 180px;
}

.search-box {
    position: relative;
    flex: 2;
    min-width: 220px;
}

.search-box input {
    padding-left: 2.5rem;
}

.search-box i {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    font-size: 0.875rem;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.35rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    padding: 0.45rem 0.75rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--gray-600);
    font-size: 0.875rem;
    transition: background 0.2s, color 0.2s;
    font-weight: 500;
}

.pagination a:hover {
    background: var(--gray-100);
    color: var(--primary);
}

.pagination .current {
    background: var(--primary);
    color: var(--white);
    font-weight: 700;
}

/* ----- Auth login (standalone page) ----- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(165deg, #f1f5f9 0%, #e2e8f0 45%, #f6f7f9 100%);
    padding: 1.5rem;
}

.login-card {
    background: var(--white);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    font-size: 2.75rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.login-title {
    font-size: 1.625rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.25rem;
}

.login-subtitle,
.section-hint,
.card-subtitle {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 400;
}

.password-input-wrap {
    position: relative;
    display: block;
}

.password-input-wrap .form-control {
    padding-right: 2.75rem;
}

.password-input-wrap .password-toggle {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0.375rem;
    cursor: pointer;
    color: var(--gray-400);
    font-size: 0.95rem;
    line-height: 1;
    border-radius: var(--radius-sm);
    transition: color 0.2s;
}

.password-input-wrap .password-toggle:hover {
    color: var(--gray-700);
}

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--gray-600);
}

.empty-state i {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    opacity: 0.35;
    color: var(--gray-400);
    display: block;
}

.empty-state p {
    font-size: 1rem;
    margin-bottom: 1.5rem;
    color: var(--gray-700);
    max-width: 28rem;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.5;
}

.tbl-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.tbl-actions .btn,
.tbl-actions .btn-sm {
    width: 30px;
    height: 30px;
    min-width: 30px;
    min-height: 30px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
}

.btn-ghost-danger {
    background: transparent;
    color: var(--gray-400);
    border: 1.5px solid var(--gray-200);
}

.btn-ghost-danger:hover {
    background: var(--danger-light);
    color: var(--danger);
    border-color: #fecaca;
}

.btn-ghost-danger:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.admin-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.admin-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.admin-modal-content {
    position: relative;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 1.5rem;
    max-width: 420px;
    width: 100%;
}

.admin-modal-title { margin-bottom: 0.75rem; font-size: 1.15rem; font-weight: 700; }
.admin-modal-message { margin-bottom: 1.25rem; color: var(--gray-600); font-size: 0.875rem; }
.admin-modal-actions { display: flex; gap: 0.75rem; justify-content: flex-end; }
.page-title-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.875rem;
    width: 100%;
}

.page-title-text {
    flex: 1;
    min-width: 0;
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.page-title-buttons {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); font-size: 0.875rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-3 { margin-top: 1.5rem; }
.d-flex { display: flex; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}
