/* =========================================
   Zerox Partner Dashboard — dashboard.css
   ========================================= */

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

:root {
    --sidebar-bg: #0d0d1a;
    --sidebar-w: 230px;
    --sidebar-collapsed: 64px;
    --accent: #ff0080;
    --accent-dim: rgba(255, 0, 128, 0.12);
    --success: #22c55e;
    --warning: #f59e0b;
    --info: #8c00ff;
    --danger: #ef4444;
    --bg: #f4f5f8;
    --card: #ffffff;
    --border: #e8eaed;
    --text: #1a1a2e;
    --muted: #6b7280;
    --font: 'Inter', sans-serif;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ==============================
   SIDEBAR
   ============================== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
    /* Starts hidden — toggled by hamburger button */
    transform: translateX(-100%);
    transition: transform 0.26s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
}

.sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 28px rgba(0, 0, 0, 0.4);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 22px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    white-space: nowrap;
}


.brand-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 1px;
}

.brand-name span {
    color: #9370DB;
    /* Matches .logo-highlight in style.css */
}

.sidebar-nav {
    flex: 1;
    padding: 16px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.88rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.18s ease, color 0.18s ease;
    white-space: nowrap;
}

.nav-item i {
    font-size: 1rem;
    min-width: 18px;
    text-align: center;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.nav-item.active {
    background: var(--accent-dim);
    color: var(--accent);
    font-weight: 600;
}

.sidebar-footer {
    padding: 14px 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-logout {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 10px;
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.4);
    font-family: var(--font);
    font-size: 0.88rem;
    width: 100%;
    transition: background 0.18s ease, color 0.18s ease;
    white-space: nowrap;
}

.sidebar-logout:hover {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
}

/* ==============================
   MAIN CONTENT
   ============================== */
.dashboard-main {
    margin-left: 0;
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ==============================
   HEADER
   ============================== */
.dash-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 24px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.sidebar-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--muted);
    padding: 6px;
    border-radius: 8px;
    transition: background 0.15s ease;
}

.sidebar-toggle:hover {
    background: var(--bg);
}

.dash-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.dash-header-left h1 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}

.role-badge {
    background: var(--accent-dim);
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dash-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dash-user-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--muted);
}

.dash-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--info));
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==============================
   SECTIONS
   ============================== */
.dash-section {
    display: none;
    padding: 24px;
    flex: 1;
}

.dash-section.active {
    display: block;
}

/* ==============================
   TOOLBAR
   ============================== */
.section-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
    flex-wrap: wrap;
}

.toolbar-left {
    display: flex;
    gap: 10px;
    align-items: center;
}

.toolbar-right {
    display: flex;
    gap: 8px;
    align-items: center;
}

.filter-select,
.form-input {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 7px 12px;
    font-family: var(--font);
    font-size: 0.83rem;
    background: var(--card);
    color: var(--text);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.filter-select {
    cursor: pointer;
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(255, 0, 128, 0.1);
}

.btn-icon {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    color: var(--muted);
    font-size: 0.9rem;
    transition: background 0.15s ease, color 0.15s ease;
}

.btn-icon:hover {
    background: var(--bg);
    color: var(--text);
}

.btn-icon .fa-spin {
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==============================
   TABLE
   ============================== */
.table-wrapper {
    background: var(--card);
    border-radius: 14px 14px 0 0;
    /* flat bottom for pagination */
    border: 1px solid var(--border);
    overflow-x: auto;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.05);
}

/* ==============================
   PAGINATION
   ============================== */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 20px;
    background: #fff;
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 14px 14px;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.05);
}

.pg-info {
    font-size: 0.85rem;
    color: var(--muted);
}

.pg-info strong {
    color: var(--text);
    font-weight: 600;
}

.pg-total {
    color: #94a3b8;
    font-size: 0.8rem;
}

.pg-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.pg-btn:hover:not(:disabled) {
    background: #f1f5f9;
    color: var(--accent);
    border-color: #cbd5e1;
}

.pg-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #f8fafc;
}

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

.orders-table thead th {
    background: #f8f9fb;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 13px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.orders-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.12s ease;
}

.orders-table tbody tr:last-child {
    border-bottom: none;
}

.orders-table tbody tr:hover {
    background: #fafafa;
}

.orders-table tbody td {
    padding: 13px 16px;
    color: var(--text);
    vertical-align: middle;
    white-space: nowrap;
}

/* Order ID */
.order-id-cell {
    font-family: monospace;
    font-weight: 500;
    color: #64748b;
    /* normal light grey */
    font-size: 0.9rem;
}

/* Mode Pills */
.mode-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.mode-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    background: #f0ebff;
    color: var(--info);
}

.mode-tag.bw {
    background: #f3f4f6;
    color: #4b5563;
}

.mode-tag.single {
    background: #e0f2fe;
    /* Light sky blue */
    color: #0369a1;
    /* Dark sky blue */
}

.mode-tag.double {
    background: #ffedd5;
    /* Light orange */
    color: #c2410c;
    /* Dark orange */
}

.mode-tag.binding {
    background: #fef3c7;
    color: #92400e;
}

.mode-tag.color {
    background: #fce7f3;
    color: #be185d;
}

/* Status badge */
.status-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.73rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.status-pill.placed,
.status-pill.uploaded {
    background: #e0f2fe;
    color: #0369a1;
}

.status-pill.printing {
    background: #fef3c7;
    color: #92400e;
}

.status-pill.ready {
    background: #d1fae5;
    color: #065f46;
}

.status-pill.delivered,
.status-pill.completed {
    background: #d1fae5;
    color: #065f46;
}

.status-pill.cancelled {
    background: #fee2e2;
    color: #991b1b;
}

.status-pill.pending {
    background: #f3f4f6;
    color: #4b5563;
}

/* Status editor */
.status-select {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 8px;
    font-family: var(--font);
    font-size: 0.78rem;
    cursor: pointer;
    outline: none;
    background: var(--bg);
}

/* Table Action Buttons */
.btn-action {
    border: none;
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
    transition: opacity 0.15s ease, transform 0.1s ease;
    gap: 5px;
    display: inline-flex;
    align-items: center;
}

.btn-action:hover {
    opacity: 0.82;
}

.btn-print {
    background: #ede9fe;
    color: #6d28d9;
}

.btn-details {
    background: #f3f4f6;
    color: #4b5563;
}

/* Table States */
.table-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 52px 20px;
    color: var(--muted);
    gap: 10px;
    font-size: 0.9rem;
}

.table-state i {
    font-size: 2rem;
}

/* ==============================
   PRINT POPOVER
   ============================== */
.popover-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.15s ease;
}

.print-popover {
    background: var(--card);
    border-radius: 16px;
    padding: 22px 24px;
    width: 340px;
    max-width: 95vw;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
}

.popover-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 18px;
}

.popover-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text);
}

.popover-subtitle {
    font-size: 0.78rem;
    color: var(--muted);
    margin-top: 2px;
}

.popover-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    font-size: 1rem;
    padding: 2px 6px;
    border-radius: 6px;
    transition: background 0.15s ease;
}

.popover-close:hover {
    background: var(--bg);
}

.popover-file-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.popover-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.popover-file-item:last-child {
    border-bottom: none;
}

.popover-file-info {
    flex: 1;
    min-width: 0;
}

.popover-file-name {
    font-size: 0.72rem;
    font-weight: 400;
    color: var(--text);
}

.popover-file-meta {
    font-size: 0.74rem;
    color: var(--muted);
    margin-top: 2px;
}

.popover-file-actions {
    display: flex;
    gap: 6px;
}

.popover-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #f1f5f9;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.92rem;
    color: #334155;
    transition: background 0.15s ease, color 0.15s ease;
}

.popover-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
    border-color: #cbd5e1;
}

/* print btn same neutral style — no purple override */

.popover-tip {
    font-size: 0.73rem;
    color: var(--muted);
    text-align: center;
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
}

/* ==============================
   DETAILS MODAL
   ============================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.15s ease;
}

.details-modal {
    background: var(--card);
    border-radius: 18px;
    width: 420px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
}

.details-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--card);
}

.details-modal-header h2 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

.modal-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    font-size: 1rem;
    padding: 4px 8px;
    border-radius: 6px;
}

.modal-close-btn:hover {
    background: var(--bg);
}

.details-modal-body {
    padding: 20px 24px 24px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 0;
    font-size: 0.85rem;
}

.detail-label {
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.detail-value {
    color: var(--text);
    font-weight: 600;
}

.detail-divider {
    margin: 12px 0;
    border-top: 1px solid var(--border);
}

.detail-section-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ==============================
   ANALYTICS
   ============================== */
.analytics-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    flex: 1 1 180px;
    background: var(--card);
    border-radius: 14px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    border: 1px solid var(--border);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--accent-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--accent);
}

.stat-card.green .stat-icon {
    background: #d1fae5;
    color: #059669;
}

.stat-card.yellow .stat-icon {
    background: #fef3c7;
    color: #d97706;
}

.stat-card.purple .stat-icon {
    background: #ede9fe;
    color: #7c3aed;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    display: block;
}

.stat-label {
    font-size: 0.78rem;
    color: var(--muted);
    margin-top: 2px;
    display: block;
}

/* Mini Stats Layout */
.mini-stats-group {
    display: flex;
    gap: 16px;
    flex: 1 1 180px;
    /* Share the space of one full card */
}

.stat-card.mini {
    flex: 1;
    /* Split the shared space equally */
    padding: 12px 16px;
    min-height: unset;
    gap: 10px;
}

.stat-card.mini .stat-icon {
    width: 34px;
    height: 34px;
    font-size: 0.9rem;
    background: rgba(107, 114, 128, 0.1);
    color: #6b7280;
}

.stat-card.mini .stat-value {
    font-size: 1.2rem;
}

.stat-card.mini .stat-label {
    font-size: 0.75rem;
}

.stat-card.mini.red-border {
    border-left: 3px solid var(--danger);
}

.stat-card.mini.red-border .stat-icon {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.chart-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
}

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

.chart-card h3 {
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text);
}

/* ==============================
   PARTNERS
   ============================== */
.partners-toolbar {
    margin-bottom: 16px;
}

.btn-primary-sm {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 14px;
    font-family: var(--font);
    font-size: 0.83rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: opacity 0.15s ease;
}

.btn-primary-sm:hover {
    opacity: 0.88;
}

/* ==============================
   SETTINGS
   ============================== */
.settings-card {
    background: var(--card);
    border-radius: 14px;
    border: 1px solid var(--border);
    padding: 32px;
    display: flex;
    align-items: center;
    gap: 24px;
    max-width: 460px;
}

.settings-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--info));
    color: #fff;
    font-weight: 800;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.settings-name {
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 4px;
}

.settings-email {
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 10px;
}

/* ==============================
   ANIMATIONS
   ============================== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ==============================
   RESPONSIVE
   ============================== */
/* Backdrop — shown behind open sidebar */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.sidebar-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
}

@media (max-width: 768px) {
    .chart-grid {
        grid-template-columns: 1fr;
    }

    .orders-table thead th:nth-child(3),
    .orders-table tbody td:nth-child(3) {
        display: none;
    }
}