/* ══════════════════════════════════════════════════════════════
   VENDOR DASHBOARD — MASTER RESPONSIVE STYLESHEET
   Breakpoints:
     Desktop  : > 1200px  (base styles in common.css)
     Laptop   : 1025px – 1200px
     Tablet   : 481px – 1024px
     Mobile   : ≤ 480px
   ══════════════════════════════════════════════════════════════ */

/* ── Global overflow guard ── */
html, body { overflow-x: hidden; max-width: 100vw; }
img { max-width: 100%; height: auto; }

/* ══════════════════════════════════════════════════════════════
   SECTION 1 — DESIGN TOKENS
   ══════════════════════════════════════════════════════════════ */
:root {
    --dash-btn-h: 40px;
    --dash-btn-py: 10px;
    --dash-btn-px: 18px;
    --dash-btn-fs: 0.875rem;

    --dash-sidebar-w: 240px;
    --dash-topbar-h: 65px;
    --dash-content-pad: 32px;
    --dash-card-p: 24px;
    --dash-gap: 24px;

    --dash-h1: 1.6rem;
    --dash-h2: 1.3rem;
    --dash-h3: 1rem;
}

/* Laptop */
@media (max-width: 1200px) {
    :root {
        --dash-sidebar-w: 220px;
        --dash-content-pad: 24px;
        --dash-card-p: 20px;
        --dash-gap: 20px;
        --dash-btn-px: 16px;
    }
}

/* Tablet */
@media (max-width: 1024px) {
    :root {
        --dash-sidebar-w: 0px; /* hidden */
        --dash-content-pad: 18px;
        --dash-card-p: 16px;
        --dash-gap: 16px;
        --dash-btn-h: 38px;
        --dash-btn-py: 9px;
        --dash-btn-px: 14px;
        --dash-btn-fs: 0.82rem;
        --dash-h1: 1.35rem;
        --dash-h2: 1.15rem;
    }
}

/* Mobile */
@media (max-width: 480px) {
    :root {
        --dash-content-pad: 12px;
        --dash-card-p: 12px;
        --dash-gap: 12px;
        --dash-btn-h: 36px;
        --dash-btn-py: 8px;
        --dash-btn-px: 12px;
        --dash-btn-fs: 0.78rem;
        --dash-h1: 1.2rem;
        --dash-h2: 1rem;
    }
}

/* ══════════════════════════════════════════════════════════════
   SECTION 2 — SIDEBAR (collapsible on tablet/mobile)
   ══════════════════════════════════════════════════════════════ */

/* Mobile hamburger button — hidden on desktop */
.mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-main);
    cursor: pointer;
    font-size: 18px;
    flex-shrink: 0;
    transition: all 0.2s;
}
.mobile-menu-btn:hover { background: var(--sidebar-hover); }

/* Mobile overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 199;
    backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

/* Sidebar collapse on tablet/mobile */
@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        bottom: 0;
        width: 240px;
        z-index: 200;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 4px 0 30px rgba(0,0,0,0.4);
        overflow-y: auto;
    }
    .sidebar.open { left: 0; }

    .main-content { margin-left: 0 !important; }
    .mobile-menu-btn { display: flex; }
}

/* ══════════════════════════════════════════════════════════════
   SECTION 3 — TOP BAR
   ══════════════════════════════════════════════════════════════ */
.top-bar {
    padding: 14px var(--dash-content-pad);
    gap: 12px;
}

@media (max-width: 1024px) {
    .top-bar {
        justify-content: space-between;
        padding: 12px var(--dash-content-pad);
    }
    .top-bar-title { font-size: 1rem; }
}

@media (max-width: 480px) {
    .top-bar { padding: 10px var(--dash-content-pad); }
    .top-bar-right { gap: 6px; }
}

/* ══════════════════════════════════════════════════════════════
   SECTION 4 — DASHBOARD CONTAINER
   ══════════════════════════════════════════════════════════════ */
.dashboard-container {
    padding: var(--dash-content-pad);
}

/* ══════════════════════════════════════════════════════════════
   SECTION 5 — STATS GRID (KPI cards)
   ══════════════════════════════════════════════════════════════ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--dash-gap);
    margin-bottom: var(--dash-gap);
}

@media (max-width: 1200px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-card { padding: 14px; }
    .stat-value { font-size: 20px; }
    .stat-header span { font-size: 12px; }
}

/* ══════════════════════════════════════════════════════════════
   SECTION 6 — DASHBOARD GRID (chart + profile)
   ══════════════════════════════════════════════════════════════ */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: var(--dash-gap);
    margin-bottom: var(--dash-gap);
}

@media (max-width: 1200px) {
    .dashboard-grid { grid-template-columns: 1fr 300px; }
}

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

/* ══════════════════════════════════════════════════════════════
   SECTION 7 — ORDERS TABLE
   ══════════════════════════════════════════════════════════════ */
.orders-table {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.orders-table table {
    min-width: 600px;
    width: 100%;
}

@media (max-width: 768px) {
    .orders-table th,
    .orders-table td { padding: 10px 12px; font-size: 0.82rem; }
}

@media (max-width: 480px) {
    .orders-table th,
    .orders-table td { padding: 8px 10px; font-size: 0.78rem; }
}

/* ══════════════════════════════════════════════════════════════
   SECTION 8 — PRODUCT MANAGEMENT TABLE/GRID
   ══════════════════════════════════════════════════════════════ */
.products-table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 10px;
}

.products-table {
    min-width: 700px;
    width: 100%;
}

.products-page-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: var(--dash-gap);
}

@media (max-width: 1024px) {
    .products-page-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
    .products-page-grid { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════════════════════════
   SECTION 9 — ADD PRODUCT FORM
   ══════════════════════════════════════════════════════════════ */
.add-product-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
    align-items: start;
}

@media (max-width: 1200px) {
    .add-product-layout { grid-template-columns: 1fr 280px; }
}

@media (max-width: 1024px) {
    .add-product-layout { grid-template-columns: 1fr; }
}

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

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

/* ══════════════════════════════════════════════════════════════
   SECTION 10 — REVIEWS & INSIGHTS
   ══════════════════════════════════════════════════════════════ */
.reviews-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: var(--dash-gap);
}

@media (max-width: 1200px) {
    .reviews-layout { grid-template-columns: 1fr 280px; }
}

@media (max-width: 1024px) {
    .reviews-layout { grid-template-columns: 1fr; }
}

.review-stats-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
}

@media (max-width: 768px) {
    .review-stats-card { padding: 18px; gap: 16px; }
    .rating-display h4 { font-size: 40px; }
}

@media (max-width: 480px) {
    .rating-display h4 { font-size: 36px; }
    .review-grid-3d { grid-template-columns: 1fr !important; }
}

/* ══════════════════════════════════════════════════════════════
   SECTION 11 — WEBSITE EDITOR
   ══════════════════════════════════════════════════════════════ */
.website-editor-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: var(--dash-gap);
    align-items: start;
}

@media (max-width: 1200px) {
    .website-editor-layout { grid-template-columns: 1fr 320px; }
}

@media (max-width: 1024px) {
    .website-editor-layout { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════════════════════════
   SECTION 12 — BUTTON SYSTEM
   ══════════════════════════════════════════════════════════════ */
.btn,
.action-btn,
.save-btn,
.cancel-btn,
.add-btn,
.edit-btn,
.delete-btn,
.update-btn,
.submit-btn,
.export-btn {
    min-height: var(--dash-btn-h);
    padding: var(--dash-btn-py) var(--dash-btn-px);
    font-size: var(--dash-btn-fs);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
    box-sizing: border-box;
    border-radius: 8px;
}

/* Touch targets */
button, a[href] { min-height: 36px; }

/* ══════════════════════════════════════════════════════════════
   SECTION 13 — SETTINGS & VERIFICATION PAGES
   ══════════════════════════════════════════════════════════════ */
.settings-sections {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: var(--dash-gap);
}

@media (max-width: 1024px) {
    .settings-sections { grid-template-columns: 1fr; }
}

.biz-verification-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--dash-gap);
}

@media (max-width: 1024px) {
    .biz-verification-layout { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════════════════════════
   SECTION 14 — TYPOGRAPHY SCALING
   ══════════════════════════════════════════════════════════════ */
.page-title { font-size: var(--dash-h1); }
.section-heading { font-size: var(--dash-h2); }
.card-header h3 { font-size: var(--dash-h3); }

/* ══════════════════════════════════════════════════════════════
   SECTION 15 — UTILITY CLASSES
   ══════════════════════════════════════════════════════════════ */
.overflow-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
    .hide-on-mobile { display: none !important; }
    .stack-on-mobile { flex-direction: column !important; }
    .full-on-mobile { width: 100% !important; }
}

@media (max-width: 480px) {
    .hide-on-sm { display: none !important; }
    .dashboard-container { padding: 12px; }
}

/* Image safety */
img { max-width: 100%; height: auto; object-fit: cover; }
