/* ── Blinds Franchise Portal — Sidebar Layout ──────────── */
:root {
    --bfp-sidebar-w: 240px;
    --bfp-blue:    #1d4ed8;
    --bfp-dark:    #0f172a;
    --bfp-green:   #10b981;
    --bfp-red:     #ef4444;
    --bfp-border:  #e2e8f0;
    --bfp-bg:      #f1f5f9;
    --bfp-radius:  10px;
    --bfp-mono:    'Courier New', monospace;
}
* { box-sizing: border-box; }

/* ── Auth wrap ───────────────────────────────────────────── */
.bfp-auth-wrap {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.bfp-auth-card {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 480px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0,0,0,.3);
}
.bfp-auth-header {
    background: linear-gradient(135deg, #0f172a, #1e3a8a);
    padding: 28px 28px 22px;
    display: flex;
    align-items: center;
    gap: 14px;
}
.bfp-auth-header h2 { color: #fff !important; margin: 0 0 3px; font-size: 20px; font-weight: 700; }
.bfp-auth-header p  { color: rgba(255,255,255,.6); margin: 0; font-size: 13px; }
.bfp-auth-tabs { display: flex; border-bottom: 2px solid var(--bfp-border); }
.bfp-tab-btn { flex: 1; padding: 13px; background: none; border: none; font-size: 14px; font-weight: 600; color: #64748b; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; transition: all .15s; }
.bfp-tab-btn.active { color: var(--bfp-blue); border-bottom-color: var(--bfp-blue); background: #f8faff; }
.bfp-tab-panel { padding: 24px 28px; }
.bfp-hidden { display: none !important; }

/* Pending screen */
.bfp-pending-card { background: #fff; border-radius: 12px; max-width: 440px; padding: 40px 32px; text-align: center; box-shadow: 0 24px 60px rgba(0,0,0,.3); }
.bfp-pending-icon { font-size: 48px; margin-bottom: 16px; }
.bfp-pending-card h3 { font-size: 20px; font-weight: 700; margin-bottom: 10px; }
.bfp-pending-card p  { color: #64748b; font-size: 14px; margin-bottom: 24px; line-height: 1.6; }

/* ── App shell ───────────────────────────────────────────── */
.bfp-app {
    display: flex;
    min-height: 100vh;
    width: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.bfp-sidebar {
    width: var(--bfp-sidebar-w);
    min-height: 100vh;
    background: #0f172a;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 1000;
    transition: transform .25s ease;
    overflow-y: auto;
}
.bfp-sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 18px 16px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.bfp-sidebar-logo-text { color: #fff !important; font-size: 16px; font-weight: 700; letter-spacing: -.2px; }

.bfp-sidebar-dealer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 18px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.bfp-sidebar-avatar {
    width: 36px; height: 36px;
    background: var(--bfp-blue);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px; font-weight: 700; color: #fff;
    flex-shrink: 0;
}
.bfp-sidebar-dealer-name  { color: #fff !important; font-size: 13px; font-weight: 600; line-height: 1.3; }
.bfp-sidebar-dealer-email { color: rgba(255,255,255,.45); font-size: 11px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }

.bfp-sidebar-nav { flex: 1; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }
.bfp-nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 14px;
    border-radius: 8px;
    color: rgba(255,255,255,.55) !important;
    text-decoration: none !important;
    font-size: 14px;
    font-weight: 500;
    transition: all .15s;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}
.bfp-nav-item:hover  { background: rgba(255,255,255,.08); color: #fff !important; }
.bfp-nav-item.active { background: var(--bfp-blue); color: #fff !important; font-weight: 600; }
.bfp-nav-item svg    { flex-shrink: 0; opacity: .7; }
.bfp-nav-item.active svg { opacity: 1; }

.bfp-sidebar-logout {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px;
    padding: 11px 14px;
    background: rgba(239,68,68,.15);
    border: 1px solid rgba(239,68,68,.25);
    border-radius: 8px;
    color: #fca5a5 !important;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
    width: calc(100% - 20px);
}
.bfp-sidebar-logout:hover { background: rgba(239,68,68,.25); }

/* ── Main content ────────────────────────────────────────── */
.bfp-main {
    flex: 1;
    margin-left: var(--bfp-sidebar-w);
    min-height: 100vh;
    background: var(--bfp-bg);
    display: flex;
    flex-direction: column;
}

/* ── Top bar ─────────────────────────────────────────────── */
.bfp-topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 24px;
    height: 58px;
    background: #fff;
    border-bottom: 1px solid var(--bfp-border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.bfp-sidebar-toggle {
    background: none; border: none; cursor: pointer; padding: 6px;
    color: #64748b; display: none; border-radius: 6px;
}
.bfp-sidebar-toggle:hover { background: #f1f5f9; }
.bfp-topbar-title { font-size: 16px; font-weight: 700; color: #0f172a; flex: 1; }
.bfp-topbar-company { font-size: 13px; color: #64748b; }

/* ── Panels ──────────────────────────────────────────────── */
.bfp-panel { display: none; flex: 1; overflow-x: hidden; max-width: 100%; }
.bfp-panel.active { display: block; }
.bfp-panel-inner { padding: 28px 32px; max-width: 1300px; overflow-x: hidden; box-sizing: border-box; }
.bfp-panel-header { font-size: 18px; font-weight: 700; color: #0f172a; margin-bottom: 20px; padding-bottom: 12px; border-bottom: 2px solid var(--bfp-border); }

/* ── Dashboard stats ─────────────────────────────────────── */
.bfp-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}
.bfp-stat-card {
    background: #fff;
    border-radius: var(--bfp-radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    border: 1px solid var(--bfp-border);
}
.bfp-stat-icon {
    width: 48px; height: 48px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.bfp-stat-icon-blue   { background: #dbeafe; color: #1d4ed8; }
.bfp-stat-icon-purple { background: #ede9fe; color: #7c3aed; }
.bfp-stat-icon-green  { background: #dcfce7; color: #059669; }
.bfp-stat-icon-red    { background: #fee2e2; color: #dc2626; }
.bfp-stat-val { font-size: 24px; font-weight: 800; color: #0f172a; font-family: var(--bfp-mono); }
.bfp-stat-lbl { font-size: 12px; color: #64748b; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; margin-top: 3px; }

/* ── Quick actions ───────────────────────────────────────── */
.bfp-quick-actions { background: #fff; border-radius: var(--bfp-radius); padding: 22px; border: 1px solid var(--bfp-border); box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.bfp-quick-title { font-size: 14px; font-weight: 700; color: #0f172a; margin-bottom: 14px; }
.bfp-quick-grid { display: flex; gap: 12px; flex-wrap: wrap; }
.bfp-quick-btn {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 20px;
    background: #f8fafc;
    border: 1.5px solid var(--bfp-border);
    border-radius: 8px;
    font-size: 14px; font-weight: 600; color: #0f172a;
    cursor: pointer; transition: all .15s;
}
.bfp-quick-btn:hover { background: #eff6ff; border-color: var(--bfp-blue); color: var(--bfp-blue); }

/* ── Form fields ─────────────────────────────────────────── */
.bfp-field { margin-bottom: 14px; }
.bfp-field label { display: block; font-size: 12px; font-weight: 700; color: #475569; margin-bottom: 5px; text-transform: uppercase; letter-spacing: .4px; }
.bfp-field input, .bfp-field textarea, .bfp-field select {
    width: 100%; padding: 10px 13px;
    border: 1.5px solid var(--bfp-border); border-radius: 7px;
    font-size: 14px; color: #0f172a; background: #fff;
    transition: border .15s; font-family: inherit;
}
.bfp-field input:focus, .bfp-field textarea:focus { border-color: var(--bfp-blue); outline: none; box-shadow: 0 0 0 3px rgba(29,78,216,.1); }
.bfp-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ── Buttons ─────────────────────────────────────────────── */
.bfp-btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 20px; border: none; border-radius: 7px; font-size: 14px; font-weight: 600; cursor: pointer; transition: all .15s; text-decoration: none; white-space: nowrap; font-family: inherit; }
.bfp-btn:disabled { opacity: .6; cursor: not-allowed; }
.bfp-btn-primary  { background: var(--bfp-blue); color: #fff; }
.bfp-btn-primary:hover:not(:disabled) { background: #1e40af; }
.bfp-btn-secondary { background: #f1f5f9; color: #475569; border: 1.5px solid var(--bfp-border); }
.bfp-btn-secondary:hover:not(:disabled) { background: #e2e8f0; }
.bfp-btn-full { width: 100%; justify-content: center; padding: 13px; font-size: 15px; }
.bfp-btn-sm { padding: 6px 14px; font-size: 12px; }

/* ── Messages ────────────────────────────────────────────── */
.bfp-msg { display: none; padding: 11px 14px; border-radius: 7px; font-size: 13px; margin-bottom: 14px; font-weight: 500; }
.bfp-msg-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; display: block; }
.bfp-msg-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; display: block; }
.bfp-note { font-size: 12px; color: #94a3b8; text-align: center; margin-top: 12px; line-height: 1.5; }

/* ── Tables ──────────────────────────────────────────────── */
.bfp-table-wrap { overflow-x: auto; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.bfp-table { width: 100%; border-collapse: collapse; background: #fff; }
.bfp-table thead th { background: #0f172a; color: #fff; padding: 12px 14px; text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; font-weight: 700; white-space: nowrap; }
.bfp-table tbody td { padding: 12px 14px; font-size: 13px; border-bottom: 1px solid #f1f5f9; color: #0f172a; }
.bfp-table tbody tr:last-child td { border-bottom: none; }
.bfp-table tbody tr:hover { background: #f8faff; }
.bfp-badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; color: #fff; text-transform: capitalize; white-space: nowrap; }

/* ── Profile ─────────────────────────────────────────────── */
.bfp-profile-grid { background: #fff; border-radius: 8px; border: 1px solid var(--bfp-border); overflow: hidden; max-width: 580px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.bfp-profile-row { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid #f1f5f9; font-size: 14px; }
.bfp-profile-row:last-child { border-bottom: none; }
.bfp-profile-row span { color: #64748b; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.bfp-profile-row strong { color: #0f172a; font-weight: 600; }

/* ── States ──────────────────────────────────────────────── */
.bfp-loading { padding: 40px; text-align: center; color: #94a3b8; font-size: 14px; }
.bfp-empty   { padding: 40px; text-align: center; color: #94a3b8; font-size: 14px; background: #fff; border-radius: 8px; }

/* ── Place Order Bar ─────────────────────────────────────── */
.pvc-order-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 22px; background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%); border-radius: 0 0 10px 10px; flex-wrap: wrap; }
.pvc-order-bar-label { display: block; font-size: 12px; color: rgba(255,255,255,.6); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; margin-bottom: 3px; }
.pvc-order-bar-total { display: block; font-size: 24px; font-weight: 800; color: #34d399; font-family: monospace; }
.pvc-order-btn { display: inline-flex; align-items: center; gap: 8px; padding: 13px 28px; background: #10b981; color: #fff; border: none; border-radius: 8px; font-size: 15px; font-weight: 700; cursor: pointer; transition: background .15s; white-space: nowrap; }
.pvc-order-btn:hover { background: #059669; }

/* ── Quote request ───────────────────────────────────────── */
.bfp-rq-trigger-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; background: linear-gradient(135deg, #eff6ff, #f0fdf4); border: 1.5px solid #bfdbfe; border-top: none; flex-wrap: wrap; }
.bfp-rq-trigger-text { font-size: 14px; color: #1e3a8a; }
.bfp-rq-trigger-text strong { display: block; margin-bottom: 2px; }
.bfp-quote-request { margin-top: 20px; background: #fff; border: 2px solid var(--bfp-blue); border-radius: var(--bfp-radius); padding: 20px; }
.bfp-qr-header { font-size: 15px; font-weight: 700; color: var(--bfp-blue); margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.bfp-qr-dims { display: flex; gap: 20px; flex-wrap: wrap; padding: 10px 14px; background: #f0f9ff; border-radius: 7px; margin-bottom: 14px; font-size: 14px; font-weight: 600; color: #1e3a8a; border: 1px solid #bae6fd; }

/* ── Shade Color Select ──────────────────────────────────── */
.pvc-select { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748b' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px !important; cursor: pointer; }

/* ── Checkout Modal ──────────────────────────────────────── */
.bfp-modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.65); z-index: 99999; display: flex; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(3px); }
.bfp-modal { background: #fff; border-radius: 12px; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; box-shadow: 0 24px 60px rgba(0,0,0,.25); }
.bfp-modal-header { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; background: linear-gradient(135deg, #0f172a, #1e3a8a); border-radius: 12px 12px 0 0; color: #fff !important; font-size: 16px; font-weight: 700; }
.bfp-modal-close { background: rgba(255,255,255,.15); border: none; color: #fff; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center; }
.bfp-modal-close:hover { background: rgba(255,255,255,.3); }
.bfp-modal-body { padding: 22px; }
.bfp-checkout-section { margin-bottom: 20px; }
.bfp-checkout-section-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: #94a3b8; margin-bottom: 10px; }
.bfp-checkout-summary { background: #f8fafc; border-radius: 8px; border: 1px solid var(--bfp-border); overflow: hidden; }
.bfp-co-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid #f1f5f9; font-size: 13px; }
.bfp-co-row:last-child { border-bottom: none; }
.bfp-co-row span { color: #64748b; }
.bfp-co-row strong { color: #0f172a; }
.bfp-transport-options { display: flex; flex-direction: column; gap: 8px; }
.bfp-transport-option { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border: 2px solid var(--bfp-border); border-radius: 8px; cursor: pointer; transition: border-color .15s, background .15s; }
.bfp-transport-option input[type="radio"] { accent-color: var(--bfp-blue); width: 18px; height: 18px; flex-shrink: 0; }
.bfp-transport-body { display: flex; justify-content: space-between; align-items: center; flex: 1; }
.bfp-transport-name { font-size: 14px; font-weight: 600; color: #0f172a; }
.bfp-transport-cost { font-size: 13px; font-weight: 700; color: var(--bfp-blue); font-family: monospace; }
.bfp-checkout-notes { width: 100%; padding: 10px 13px; border: 1.5px solid var(--bfp-border); border-radius: 8px; font-size: 13px; font-family: inherit; resize: vertical; }
.bfp-checkout-notes:focus { border-color: var(--bfp-blue); outline: none; }
.bfp-checkout-total-box { background: #f8fafc; border-radius: 8px; border: 1px solid var(--bfp-border); overflow: hidden; margin-top: 4px; }
.bfp-checkout-total-row { display: flex; justify-content: space-between; padding: 10px 16px; font-size: 13px; border-bottom: 1px solid #f1f5f9; }
.bfp-checkout-total-row:last-child { border-bottom: none; }
.bfp-checkout-total-row span:first-child { color: #64748b; }
.bfp-checkout-total-row span:last-child  { font-weight: 600; color: #0f172a; font-family: monospace; }
.bfp-checkout-grand { background: #0f172a; }
.bfp-checkout-grand span:first-child { color: #e2e8f0 !important; font-weight: 700; font-size: 14px; }
.bfp-checkout-grand span:last-child  { color: #34d399 !important; font-size: 18px; font-weight: 800; }

/* ── Success Banner ──────────────────────────────────────── */
.bfp-success-banner { background: #dcfce7; border: 1.5px solid #86efac; color: #166534; padding: 14px 20px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; line-height: 1.6; }

/* ── Mobile ──────────────────────────────────────────────── */
@media (max-width: 768px) {
    .bfp-sidebar { transform: translateX(-100%); }
    .bfp-sidebar.open { transform: translateX(0); }
    .bfp-main { margin-left: 0; }
    .bfp-sidebar-toggle { display: flex; }
    .bfp-stats-grid { grid-template-columns: 1fr 1fr; }
    .bfp-panel-inner { padding: 12px 0 !important; } /* Calculator fills edge to edge on mobile */
    .bfp-field-row { grid-template-columns: 1fr; }
    .bfp-panel-header { margin: 0 12px 16px; }
    .bfp-panel-inner > .bfp-stats-grid,
    .bfp-panel-inner > .bfp-quick-actions,
    .bfp-panel-inner > .bfp-profile-edit-wrap,
    .bfp-panel-inner > .bfp-table-wrap,
    .bfp-panel-inner > #bfpQuotesList,
    .bfp-panel-inner > #bfpOrdersList { padding: 0 12px; }
}
@media (max-width: 480px) {
    .bfp-stats-grid { grid-template-columns: 1fr; }
}

/* ── Profile Edit ────────────────────────────────────────── */
.bfp-profile-edit-wrap { display: flex; flex-direction: column; gap: 20px; max-width: 720px; }

.bfp-profile-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #fff;
    border: 1px solid var(--bfp-border);
    border-radius: var(--bfp-radius);
    padding: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.bfp-profile-avatar-lg {
    width: 56px; height: 56px;
    background: var(--bfp-blue);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; font-weight: 800; color: #fff;
    flex-shrink: 0;
}
.bfp-profile-meta-name  { font-size: 16px; font-weight: 700; color: #0f172a; }
.bfp-profile-meta-email { font-size: 13px; color: #64748b; margin-top: 2px; }
.bfp-profile-meta-since { font-size: 11px; color: #94a3b8; margin-top: 4px; text-transform: uppercase; letter-spacing: .4px; font-weight: 600; }

.bfp-profile-form {
    background: #fff;
    border: 1px solid var(--bfp-border);
    border-radius: var(--bfp-radius);
    padding: 22px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.bfp-profile-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.bfp-profile-pw-section { border-top: 1px solid var(--bfp-border); padding-top: 18px; margin-bottom: 18px; }
.bfp-profile-pw-title { font-size: 13px; font-weight: 700; color: #0f172a; margin-bottom: 14px; }

@media (max-width: 560px) {
    .bfp-profile-form-grid { grid-template-columns: 1fr; }
    .bfp-profile-meta { flex-direction: column; text-align: center; }
}

/* ── Prevent mobile auto-zoom on input focus ─────────────
   Browsers zoom when input font-size < 16px on iOS/Android.
   Setting font-size: 16px prevents this entirely.
   ─────────────────────────────────────────────────────── */
@media screen and (max-width: 768px) {
    .bfp-field input,
    .bfp-field select,
    .bfp-field textarea,
    .bfp-checkout-notes {
        font-size: 16px !important;
        -webkit-text-size-adjust: 100%;
    }
}
