/**
 * FreshBasket — Enterprise Web Admin Panel Stylesheet (WAD-01 to WAD-25)
 * Matching Screenshots 151, 152, 154, 155, 157
 */

:root {
    --adm-sidebar-bg: #0d2530;
    --adm-sidebar-hover: #153240;
    --adm-primary: #00a651;
    --adm-primary-dark: #008f45;
    --adm-primary-light: #e6f7ee;
    --adm-bg: #f5f7fb;
    --adm-card-bg: #ffffff;
    --adm-text-main: #111827;
    --adm-text-muted: #64748b;
    --adm-border: #e2e8f0;
    --adm-badge-red: #ef4444;
    --adm-badge-blue: #3b82f6;
    --adm-badge-orange: #f59e0b;
    --adm-badge-green: #10b981;
}

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

body.admin-body {
    background-color: var(--adm-bg);
    color: var(--adm-text-main);
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

/* 1. Left Sidebar */
.admin-sidebar {
    width: 240px;
    background-color: var(--adm-sidebar-bg);
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 50;
    transition: width 0.25s ease;
}

.sidebar-header {
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo {
    height: 38px;
    width: auto;
}

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

.nav-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    color: #94a3b8;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 500;
    font-size: 13.5px;
    transition: all 0.15s ease;
}

.nav-item-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-item .nav-icon {
    font-size: 17px;
    width: 20px;
    text-align: center;
    color: #94a3b8;
}

.nav-item:hover {
    background-color: var(--adm-sidebar-hover);
    color: #ffffff;
}

.nav-item.active {
    background-color: var(--adm-primary);
    color: #ffffff;
    font-weight: 600;
}

.nav-item.active .nav-icon {
    color: #ffffff;
}

.nav-badge {
    background-color: var(--adm-badge-red);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 12px;
    min-width: 18px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* 2. Top Header */
.admin-main-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.admin-header {
    height: 70px;
    background: #ffffff;
    border-bottom: 1px solid var(--adm-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 40;
}

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

.hamburger-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: #475569;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
}

.hamburger-btn:hover {
    background: #f1f5f9;
}

.header-search {
    position: relative;
    width: 100%;
    max-width: 460px;
}

.header-search input {
    width: 100%;
    padding: 9px 16px 9px 40px;
    background: #f8fafc;
    border: 1px solid var(--adm-border);
    border-radius: 10px;
    font-size: 13.5px;
    outline: none;
    transition: all 0.2s;
    font-family: inherit;
}

.header-search input:focus {
    background: #ffffff;
    border-color: var(--adm-primary);
    box-shadow: 0 0 0 3px rgba(0, 166, 81, 0.12);
}

.header-search .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 15px;
}

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

.notification-bell-btn {
    position: relative;
    background: #f8fafc;
    border: 1px solid var(--adm-border);
    border-radius: 10px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 17px;
    color: #475569;
    text-decoration: none;
}

.notification-bell-btn .bell-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--adm-badge-red);
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ffffff;
}

.btn-header-order {
    background: var(--adm-primary);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    padding: 9px 18px;
    font-size: 13.5px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}

.btn-header-order:hover {
    background: var(--adm-primary-dark);
}

.header-user-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 12px 5px 6px;
    border-radius: 30px;
    border: 1px solid var(--adm-border);
    background: #ffffff;
    cursor: pointer;
}

.user-avatar-circle {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #e2fbe8;
    color: #0b7a3e;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    border: 2px solid #a7f3d0;
}

.user-info-text {
    line-height: 1.2;
}

.user-name {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
}

.user-role-label {
    font-size: 11px;
    color: #64748b;
}

/* 3. Main Content Area */
.admin-content {
    padding: 24px 28px 40px;
    flex: 1;
}

/* Breadcrumb & Top Bar */
.content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
}

.page-title-wrap h1 {
    font-size: 24px;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 4px;
}

.page-title-wrap p {
    font-size: 13.5px;
    color: #64748b;
}

.header-date-filter {
    background: #ffffff;
    border: 1px solid var(--adm-border);
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

/* 4. KPI Stat Cards (6 in a row for Dashboard, 5 for Products, 4 for Orders) */
.kpi-grid-6 {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
    margin-bottom: 22px;
}

.kpi-grid-5 {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-bottom: 22px;
}

.kpi-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 22px;
}

.kpi-card {
    background: #ffffff;
    border-radius: 14px;
    padding: 16px 14px;
    border: 1px solid var(--adm-border);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.kpi-top {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.kpi-icon-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.kpi-icon-circle.blue   { background: #eff6ff; color: #2563eb; }
.kpi-icon-circle.green  { background: #ecfdf5; color: #059669; }
.kpi-icon-circle.orange { background: #fffbeb; color: #d97706; }
.kpi-icon-circle.red    { background: #fef2f2; color: #dc2626; }
.kpi-icon-circle.purple { background: #faf5ff; color: #7c3aed; }
.kpi-icon-circle.teal   { background: #f0fdfa; color: #0d9488; }

.kpi-label {
    font-size: 12.5px;
    font-weight: 600;
    color: #64748b;
    line-height: 1.2;
}

.kpi-value {
    font-size: 22px;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.3px;
    margin-bottom: 6px;
}

.kpi-growth {
    font-size: 11.5px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.kpi-growth.up   { color: #16a34a; }
.kpi-growth.down { color: #dc2626; }

/* 5. Row 2: Charts and Top Selling */
.dashboard-row-2 {
    display: grid;
    grid-template-columns: 2fr 1.2fr 1.2fr;
    gap: 18px;
    margin-bottom: 22px;
}

.chart-card {
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid var(--adm-border);
    padding: 18px 20px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

.card-title-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.card-title-left {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
}

.card-title-icon {
    font-size: 18px;
    padding: 6px;
    border-radius: 8px;
}

.card-title-icon.green  { background: #ecfdf5; color: #059669; }
.card-title-icon.orange { background: #fffbeb; color: #d97706; }
.card-title-icon.blue   { background: #eff6ff; color: #2563eb; }
.card-title-icon.teal   { background: #f0fdfa; color: #0d9488; }

.select-filter-sm {
    background: #f8fafc;
    border: 1px solid var(--adm-border);
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
}

.view-all-link {
    color: #2563eb;
    text-decoration: none;
    font-size: 12.5px;
    font-weight: 600;
}

.view-all-link:hover {
    text-decoration: underline;
}

/* CSS / SVG Chart Styling */
.chart-container-svg {
    width: 100%;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Donut Chart Layout */
.donut-chart-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 0;
}

.donut-svg-holder {
    position: relative;
    width: 140px;
    height: 140px;
}

.donut-center-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.donut-center-val {
    font-size: 20px;
    font-weight: 800;
    color: #0f172a;
}

.donut-center-lbl {
    font-size: 10px;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
}

.donut-legend {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.legend-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12.5px;
}

.legend-dot-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #475569;
}

.legend-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
}

.legend-dot.green  { background: #10b981; }
.legend-dot.orange { background: #f59e0b; }
.legend-dot.red    { background: #ef4444; }
.legend-dot.blue   { background: #3b82f6; }

.legend-val {
    font-weight: 700;
    color: #0f172a;
}

/* Top Selling Products List */
.top-selling-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.top-prod-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.top-prod-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.top-prod-name {
    width: 70px;
    font-size: 12px;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.top-prod-bar-wrap {
    flex: 1;
    background: #f1f5f9;
    height: 12px;
    border-radius: 6px;
    overflow: hidden;
}

.top-prod-bar-fill {
    background: #10b981;
    height: 100%;
    border-radius: 6px;
}

.top-prod-count {
    width: 28px;
    font-size: 12px;
    font-weight: 700;
    color: #0f172a;
    text-align: right;
}

/* 6. Row 3: Three Operational Tables (Today's Orders, Inventory Alert, Delivery Staff) */
.dashboard-row-3 {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr;
    gap: 18px;
    margin-bottom: 22px;
}

.table-card {
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid var(--adm-border);
    padding: 18px 20px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
    overflow: hidden;
}

.adm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}

.adm-table th {
    background: #f8fafc;
    color: #64748b;
    font-weight: 600;
    text-align: left;
    padding: 10px 10px;
    border-bottom: 1px solid var(--adm-border);
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.adm-table td {
    padding: 10px 10px;
    border-bottom: 1px solid #f1f5f9;
    color: #1e293b;
    vertical-align: middle;
}

.adm-table tr:last-child td {
    border-bottom: none;
}

.adm-table tr:hover td {
    background: #fbfcfe;
}

/* Status Badges */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border-radius: 14px;
    font-size: 11px;
    font-weight: 700;
}

.status-pill.delivered,
.status-pill.success {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
}

.status-pill.in-progress,
.status-pill.info {
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #bfdbfe;
}

.status-pill.out-for-delivery,
.status-pill.warning {
    background: #fffbeb;
    color: #d97706;
    border: 1px solid #fde68a;
}

.status-pill.failed,
.status-pill.cancelled,
.status-pill.danger {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.status-pill.offline,
.status-pill.neutral {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #cbd5e1;
}

/* 7. Row 4: Bottom Summary & Quick Actions */
.dashboard-row-4 {
    display: grid;
    grid-template-columns: 1.8fr 1.2fr 1.4fr;
    gap: 18px;
}

.revenue-kpi-subgrid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.rev-metric-box {
    background: #f8fafc;
    border-radius: 10px;
    padding: 12px 14px;
    border: 1px solid #edf2f7;
}

.rev-metric-lbl {
    font-size: 11.5px;
    color: #64748b;
    margin-bottom: 4px;
}

.rev-metric-val {
    font-size: 18px;
    font-weight: 800;
    color: #0f172a;
}

.rev-metric-growth {
    font-size: 11px;
    font-weight: 600;
    color: #16a34a;
    margin-top: 2px;
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.quick-action-card {
    background: #f8fafc;
    border: 1px solid var(--adm-border);
    border-radius: 12px;
    padding: 14px 10px;
    text-align: center;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
    display: block;
}

.quick-action-card:hover {
    background: #ffffff;
    border-color: var(--adm-primary);
    box-shadow: 0 4px 12px rgba(0, 166, 81, 0.12);
    transform: translateY(-2px);
}

.quick-action-card .qa-icon {
    font-size: 24px;
    margin-bottom: 6px;
    display: block;
}

.quick-action-card .qa-label {
    font-size: 12.5px;
    font-weight: 700;
    color: #1e293b;
}

/* Orders Management Page Styles (WAD-04) */
.filter-card {
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid var(--adm-border);
    padding: 16px 20px;
    margin-bottom: 20px;
}

.filter-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-input-search {
    flex: 1.5;
    min-width: 220px;
    padding: 9px 14px;
    border: 1px solid var(--adm-border);
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    font-family: inherit;
}

.filter-select {
    padding: 9px 12px;
    border: 1px solid var(--adm-border);
    border-radius: 8px;
    font-size: 13px;
    color: #334155;
    background: #ffffff;
    outline: none;
    cursor: pointer;
}

.btn-filter-search {
    background: var(--adm-primary);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.btn-filter-reset {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid var(--adm-border);
    border-radius: 8px;
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.status-tabs-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    overflow-x: auto;
}

.status-tab-btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid var(--adm-border);
    background: #ffffff;
    color: #475569;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.15s;
}

.status-tab-btn.active {
    background: var(--adm-primary);
    color: #ffffff;
    border-color: var(--adm-primary);
}

.table-action-btn {
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #bfdbfe;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
}

.table-action-btn:hover {
    background: #dbeafe;
}

/* Order Details & Tax Invoice (WAD-05) */
.order-detail-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 24px;
}

.detail-section-card {
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid var(--adm-border);
    padding: 22px;
    margin-bottom: 20px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.02);
}

.tax-invoice-sheet {
    background: #ffffff;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
}

/* Product Management Two-Column Layout (WAD-07) */
.products-mgmt-grid {
    display: grid;
    grid-template-columns: 1.8fr 1.2fr;
    gap: 24px;
}

.prod-drawer-card {
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid var(--adm-border);
    padding: 22px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.02);
    position: sticky;
    top: 90px;
}

.drawer-tabs {
    display: flex;
    border-bottom: 1px solid var(--adm-border);
    margin-bottom: 20px;
    gap: 8px;
}

.drawer-tab {
    padding: 8px 14px;
    font-size: 12.5px;
    font-weight: 600;
    color: #64748b;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    text-decoration: none;
}

.drawer-tab.active {
    color: var(--adm-primary);
    border-bottom-color: var(--adm-primary);
}

/* Responsive Breakpoints */
@media (max-width: 1200px) {
    .kpi-grid-6 { grid-template-columns: repeat(3, 1fr); }
    .kpi-grid-5 { grid-template-columns: repeat(3, 1fr); }
    .dashboard-row-2 { grid-template-columns: 1fr; }
    .dashboard-row-3 { grid-template-columns: 1fr; }
    .dashboard-row-4 { grid-template-columns: 1fr; }
    .order-detail-grid { grid-template-columns: 1fr; }
    .products-mgmt-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .admin-sidebar {
        position: fixed;
        left: -240px;
        top: 0;
        bottom: 0;
    }
    .admin-sidebar.open {
        left: 0;
    }
    .kpi-grid-6, .kpi-grid-5, .kpi-grid-4 {
        grid-template-columns: 1fr 1fr;
    }
    .admin-content {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .kpi-grid-6, .kpi-grid-5, .kpi-grid-4, .kpi-grid-3 {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .admin-content {
        padding: 12px 8px;
    }
    .admin-header {
        padding: 10px 12px;
        flex-wrap: wrap;
        gap: 8px;
    }
    .admin-search-input {
        width: 140px;
    }
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media print {
    .admin-sidebar, .admin-header, .btn-print-hide, .page-title-wrap {
        display: none !important;
    }
    .tax-invoice-sheet {
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
    }
    body {
        background: #ffffff !important;
    }
}
