:root {
    --bfo-primary: #7c3aed;
    --bfo-primary-hover: #6d28d9;
    --bfo-success: #10b981;
    --bfo-success-hover: #059669;
    --bfo-danger: #ef4444;
    --bfo-bg: #f8fafc;
    --bfo-card-bg: #ffffff;
    --bfo-text: #1e293b;
    --bfo-text-muted: #64748b;
    --bfo-border: #e2e8f0;
    --bfo-radius: 12px;
}

.bfo-container {
    max-width: 1140px;
    margin: 20px auto;
    font-family: inherit;
    color: var(--bfo-text);
    padding-bottom: 120px;
}

/* هدر */
.bfo-header {
    background: #ffffff;
    border: 1px solid var(--bfo-border);
    border-radius: var(--bfo-radius);
    padding: 16px 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
.bfo-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.bfo-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}
.bfo-brand-badge {
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    color: #fff;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
}
.bfo-title {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
    color: var(--bfo-text);
}
.bfo-user-area {
    display: flex;
    align-items: center;
    gap: 12px;
}
.bfo-user-greeting {
    font-size: 13px;
    color: var(--bfo-text-muted);
}
.bfo-btn-logout {
    background: #fee2e2;
    color: #dc2626;
    border: none;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
    transition: 0.2s;
}
.bfo-btn-logout:hover { background: #fecaca; }

.bfo-notice-bar {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed var(--bfo-border);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #4338ca;
}

/* مراحل */
.bfo-step { display: none; }
.bfo-step-active { display: block; animation: bfoFadeIn 0.25s ease-in-out; }
@keyframes bfoFadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* کارت‌ها */
.bfo-card {
    background: var(--bfo-card-bg);
    border: 1px solid var(--bfo-border);
    border-radius: var(--bfo-radius);
    padding: 24px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.04);
}
.bfo-auth-card {
    max-width: 440px;
    margin: 40px auto;
    text-align: center;
}
.bfo-card-icon { font-size: 42px; margin-bottom: 12px; }
.bfo-auth-card h3 { margin: 0 0 8px 0; font-size: 20px; font-weight: 800; }
.bfo-card-desc { font-size: 13px; color: var(--bfo-text-muted); margin-bottom: 20px; line-height: 1.6; }

/* فرم‌ها */
.bfo-field { text-align: right; margin-bottom: 16px; }
.bfo-field label { display: block; font-size: 12px; font-weight: 700; margin-bottom: 6px; color: var(--bfo-text); }
.bfo-field input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--bfo-border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
    transition: 0.2s;
}
.bfo-field input:focus {
    border-color: var(--bfo-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}
.bfo-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* OTP جعبه‌ها */
.bfo-otp-inputs {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
}
.bfo-otp-digit {
    width: 44px;
    height: 52px;
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    border: 2px solid var(--bfo-border);
    border-radius: 10px;
    transition: 0.2s;
}
.bfo-otp-digit:focus {
    border-color: var(--bfo-primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
    outline: none;
}
.bfo-otp-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 14px;
    font-size: 12px;
    color: var(--bfo-text-muted);
}

/* دکمه‌ها */
.bfo-btn {
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-weight: 700;
    padding: 12px 18px;
    border-radius: 8px;
    font-size: 14px;
    transition: 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.bfo-btn-block { width: 100%; }
.bfo-btn-primary { background: var(--bfo-primary); color: #fff; }
.bfo-btn-primary:hover { background: var(--bfo-primary-hover); }
.bfo-btn-secondary { background: #e2e8f0; color: #1e293b; }
.bfo-btn-secondary:hover { background: #cbd5e1; }
.bfo-btn-success { background: var(--bfo-success); color: #fff; }
.bfo-btn-success:hover { background: var(--bfo-success-hover); }
.bfo-btn-danger-outline { background: transparent; border: 1px solid var(--bfo-danger); color: var(--bfo-danger); }
.bfo-btn-danger-outline:hover { background: #fef2f2; }
.bfo-btn-link { background: none; border: none; color: var(--bfo-primary); cursor: pointer; font-size: 12px; font-family: inherit; }

.bfo-msg { margin-top: 12px; font-size: 13px; text-align: center; }
.bfo-msg.error { color: #dc2626; }
.bfo-msg.success { color: #16a34a; }

/* نوار ابزار جستجو و الفبا */
.bfo-toolbar {
    background: #ffffff;
    border: 1px solid var(--bfo-border);
    border-radius: var(--bfo-radius);
    padding: 14px;
    margin-bottom: 20px;
}
.bfo-search-box { position: relative; }
.bfo-search-box input {
    width: 100%;
    padding: 12px 16px 12px 42px;
    border: 1.5px solid var(--bfo-border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
}
.bfo-search-box input:focus { border-color: var(--bfo-primary); outline: none; }
.bfo-search-spinner {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid #ccc;
    border-top-color: var(--bfo-primary);
    border-radius: 50%;
    animation: bfoSpin 0.7s linear infinite;
    display: none;
}
@keyframes bfoSpin { to { transform: translateY(-50%) rotate(360deg); } }

/* نوار الفبا */
.bfo-alphabet-bar {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding-top: 10px;
    scrollbar-width: thin;
}
.bfo-alpha-btn {
    border: 1px solid var(--bfo-border);
    background: #f8fafc;
    color: var(--bfo-text);
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    white-space: nowrap;
    transition: 0.15s;
}
.bfo-alpha-btn:hover, .bfo-alpha-btn.bfo-alpha-active {
    background: var(--bfo-primary);
    color: #fff;
    border-color: var(--bfo-primary);
}

/* گرید کالاها */
.bfo-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}
.bfo-product-card {
    background: #fff;
    border: 1px solid var(--bfo-border);
    border-radius: var(--bfo-radius);
    padding: 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.15s, box-shadow 0.15s;
}
.bfo-product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px -4px rgba(0,0,0,0.06);
}
.bfo-p-img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: 8px;
    background: #f1f5f9;
}
.bfo-p-sku { font-size: 11px; color: var(--bfo-text-muted); margin-top: 8px; }
.bfo-p-title { font-size: 14px; font-weight: 700; margin: 4px 0 10px 0; line-height: 1.4; min-height: 38px; }
.bfo-p-price { font-size: 14px; font-weight: 800; color: #047857; margin-bottom: 12px; }

/* دکمه‌های شمارنده + و - */
.bfo-counter {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f1f5f9;
    border-radius: 8px;
    padding: 3px;
}
.bfo-btn-count {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: #fff;
    color: var(--bfo-text);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.15s;
}
.bfo-btn-count:hover { background: var(--bfo-primary); color: #fff; }
.bfo-count-val { font-weight: 700; font-size: 14px; min-width: 30px; text-align: center; }

/* متغیرها در کارت */
.bfo-variable-list { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.bfo-var-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    border-top: 1px dashed var(--bfo-border);
    padding-top: 6px;
}
.bfo-var-name { font-weight: 600; color: #475569; }

/* سبد چسبان پایین (Sticky Cart) */
.bfo-sticky-cart {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 900px;
    background: #1e1b4b;
    color: #fff;
    padding: 12px 20px;
    border-radius: 16px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.25);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 999;
}
.bfo-cart-summary { display: flex; gap: 24px; }
.bfo-cart-stat { display: flex; flex-direction: column; }
.bfo-cart-stat-label { font-size: 11px; color: #a5b4fc; }
.bfo-cart-stat strong { font-size: 15px; color: #fff; }
.bfo-cart-actions { display: flex; gap: 10px; }

/* مدال اقلام */
.bfo-modal { display: none; position: fixed; inset: 0; z-index: 1000; }
.bfo-modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(2px); }
.bfo-modal-content {
    position: relative;
    max-width: 600px;
    width: 90%;
    margin: 60px auto;
    background: #fff;
    border-radius: var(--bfo-radius);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}
.bfo-modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--bfo-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.bfo-modal-header h4 { margin: 0; font-size: 16px; }
.bfo-modal-close { background: none; border: none; font-size: 24px; cursor: pointer; }
.bfo-modal-body { padding: 16px 20px; overflow-y: auto; flex: 1; }
.bfo-modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--bfo-border);
    display: flex;
    justify-content: space-between;
}
.bfo-cart-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
}
.bfo-cart-item-title { font-size: 13px; font-weight: 700; max-width: 250px; }
.bfo-cart-item-del {
    color: var(--bfo-danger);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
}

/* صفحه موفقیت */
.bfo-success-card { max-width: 520px; margin: 40px auto; text-align: center; }
.bfo-success-icon {
    width: 64px;
    height: 64px;
    background: #dcfce7;
    color: #16a34a;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 800;
    margin: 0 auto 16px auto;
}
.bfo-order-box {
    background: #f8fafc;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 16px;
    margin: 20px 0;
}
.bfo-order-number { display: block; font-size: 26px; color: var(--bfo-primary); margin-top: 6px; }
.bfo-sms-alert { font-size: 13px; color: #4338ca; line-height: 1.6; margin-bottom: 24px; }

/* اسکرول نامحدود */
.bfo-load-more, .bfo-no-more { text-align: center; padding: 20px; font-size: 13px; color: var(--bfo-text-muted); }

/* رسپانسیو موبایل */
@media (max-width: 640px) {
    .bfo-products-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .bfo-p-img { height: 110px; }
    .bfo-p-title { font-size: 12px; min-height: 32px; }
    .bfo-p-price { font-size: 12px; }
    .bfo-sticky-cart { flex-direction: column; gap: 12px; border-radius: 12px; padding: 12px; }
    .bfo-cart-summary { width: 100%; justify-content: space-around; }
    .bfo-cart-actions { width: 100%; }
    .bfo-cart-actions .bfo-btn { flex: 1; font-size: 12px; padding: 10px; }
}
