/* AP Wholesale — Layout
   Layout A: persistent left sidebar + main content area
   Version: 1.0.9 */

/* ── Full-viewport reset ──────────────────────────────────────────────────── */
body.ap-wholesale-portal-page {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    background: var(--ws-bg);
}

/* WordPress admin bar sits 32px tall on desktop, 46px on mobile — push topbar down */
body.admin-bar.ap-wholesale-portal-page .ap-wholesale-topbar {
    top: 32px;
}
@media screen and (max-width: 782px) {
    body.admin-bar.ap-wholesale-portal-page .ap-wholesale-topbar {
        top: 46px;
    }
}
/* ─────────────────────────────────────────────────────────────────────────── */

:root {
    --ws-sidebar-width: 260px;
    --ws-topbar-height: 56px;
    --ws-bg: #f5f7fa;
    --ws-sidebar-bg: #1e2535;
    --ws-sidebar-text: #c8d0e0;
    --ws-accent: #2ecc71;
    --ws-card-bg: #ffffff;
    --ws-border: #e2e8f0;
    --ws-text: #1a202c;
    --ws-muted: #718096;
}

.ap-wholesale-wrap {
    display: grid;
    grid-template-columns: var(--ws-sidebar-width) 1fr;
    grid-template-rows: var(--ws-topbar-height) 1fr;
    min-height: 100vh;
    background: var(--ws-bg);
}

.ap-wholesale-topbar {
    grid-column: 1 / -1;
    background: #fff;
    border-bottom: 1px solid var(--ws-border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--ws-topbar-height);
}
.ap-wholesale-topbar__account { font-weight: 600; color: var(--ws-text); }
.ap-wholesale-topbar__tier           { font-size: 11px; color: #fff; padding: 2px 9px; border-radius: 12px; white-space: nowrap; font-weight: 600; }
.ap-wholesale-topbar__tier--appd    { background: var(--ws-accent); }   /* colour overridden inline from wp_user_type.color */
.ap-wholesale-topbar__tier--seachem { background: #1a6fa8; }
.ap-wholesale-topbar__search  { flex: 1; max-width: 400px; }
.ap-wholesale-topbar__search input {
    width: 100%;
    border: 1px solid var(--ws-border);
    border-radius: 6px;
    padding: 7px 12px;
    font-size: 14px;
}
.ap-wholesale-topbar__back {
    margin-left: auto;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    background: #2d3748;
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 6px;
    white-space: nowrap;
    border: 2px solid #2d3748;
    transition: background 0.15s, color 0.15s;
}
.ap-wholesale-topbar__back:hover {
    background: #fff;
    color: #2d3748;
}

.ap-wholesale-sidebar {
    background: var(--ws-sidebar-bg);
    padding: 20px 0;
    overflow-y: visible;
    position: sticky;
    top: var(--ws-topbar-height);
    align-self: start;
}
.ap-wholesale-sidebar__tray-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    color: var(--ws-accent);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    margin-bottom: 12px;
}
.ap-wholesale-sidebar nav ul  { list-style: none; margin: 0; padding: 0; }
.ap-wholesale-sidebar nav a   { display: block; padding: 8px 20px; color: var(--ws-sidebar-text); text-decoration: none; font-size: 14px; }
.ap-wholesale-sidebar nav a:hover { background: rgba(255,255,255,0.06); }
.ap-wholesale-sidebar .has-children > a {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: .08em;
    color: #b8c8dc;
    padding: 20px 18px 6px;
    border-left: 2px solid rgba(46,204,113,0.40);
    border-top: 1px solid rgba(255,255,255,0.08);
    margin-top: 8px;
    pointer-events: none;
    cursor: default;
}
.ap-wholesale-sidebar .has-children:first-child > a {
    border-top: none;
    margin-top: 0;
    padding-top: 8px;
    padding-left: 18px;
}
.ap-wholesale-sidebar .ap-ws-sidebar-section > a {
    color: #dde6f0;
    font-weight: 600;
    border-left: 2px solid rgba(46,204,113,0.40);
    border-top: 1px solid rgba(255,255,255,0.08);
    margin-top: 8px;
    padding-top: 16px;
    padding-left: 18px;
}

/* On Sale / Monthly Specials sidebar highlights */
.ap-wholesale-sidebar .ap-ws-sidebar-onsale > a {
    color: #fc8181;
    border-left: 3px solid #e53e3e;
    padding-left: 17px;
}
.ap-wholesale-sidebar .ap-ws-sidebar-onsale > a:hover {
    background: rgba(229, 62, 62, 0.12);
    color: #feb2b2;
}
.ap-wholesale-sidebar .ap-ws-sidebar-monthly > a {
    color: #fbbf24;
    border-left: 3px solid #d97706;
    padding-left: 17px;
}
.ap-wholesale-sidebar .ap-ws-sidebar-monthly > a:hover {
    background: rgba(217, 119, 6, 0.12);
    color: #fde68a;
}

.ap-wholesale-main {
    padding: 28px 32px;
    overflow-y: auto;
}

/* ── Free Freight Progress Bar ──────────────────────────────────────────── */
.ap-wholesale-main { padding-bottom: 72px; }

#ap-ws-freight-bar {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: 50%;
    z-index: 990;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.10);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    font-family: inherit;
}
#ap-ws-freight-bar .ap-ws-freight-label {
    color: #4a5568;
    white-space: nowrap;
}
#ap-ws-freight-bar .ap-ws-freight-track {
    flex: 1;
    background: #e2e8f0;
    border-radius: 100px;
    height: 10px;
    overflow: hidden;
}
#ap-ws-freight-bar .ap-ws-freight-fill {
    height: 100%;
    border-radius: 100px;
    background: linear-gradient(90deg, #4299e1, #48bb78);
    transition: width 0.4s ease;
    max-width: 100%;
}
#ap-ws-freight-bar .ap-ws-freight-fill--qualified {
    background: #48bb78;
}
#ap-ws-freight-bar .ap-ws-freight-remaining {
    color: #2d3748;
    font-weight: 600;
    white-space: nowrap;
    min-width: 120px;
    text-align: right;
}
