@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800;900&display=swap');

/* ================================================================
   Solar Builder — نظيف وحديث، نفس ألوان PC Builder
   ================================================================ */

.slr-builder {
    font-family: Cairo, 'Segoe UI', Tahoma, Arial, sans-serif;
    direction: rtl;
    color: #1e293b;
}
.slr-builder *, .slr-builder *::before, .slr-builder *::after { box-sizing: border-box; }

/* ── Stage Card ─────────────────────────────────────────────── */
.slr-stage {
    background: #fff;
    border: 1.5px solid #ddd6fe;
    border-radius: 16px;
    margin-bottom: 16px;
    overflow: hidden;
    transition: opacity .3s, border-color .3s;
}
.slr-stage--locked {
    opacity: .45;
    pointer-events: none;
}
.slr-stage--locked .slr-prod-card,
.slr-stage--locked .slr-prod-btn,
.slr-stage--locked .slr-amp-btn,
.slr-stage--locked input,
.slr-stage--locked select,
.slr-stage--locked button {
    pointer-events: none !important;
    cursor: not-allowed !important;
}
.slr-stage:not(.slr-stage--locked) {
    opacity: 1;
    pointer-events: auto;
}
.slr-stage--done { border-color: #a78bfa; }

.slr-stage-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    background: #fafbff;
    border-bottom: 1px solid #ddd6fe;
}
.slr-stage-num {
    width: 34px; height: 34px; border-radius: 50%;
    background: #7c3aed; color: #fff;
    font-size: 14px; font-weight: 800;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.slr-stage--done .slr-stage-num { background: #16a34a; }
.slr-stage-title { font-size: 15px; font-weight: 800; color: #1e293b; }
.slr-stage-sub   { font-size: 12px; color: #94a3b8; margin-top: 2px; }

.slr-stage-body { padding: 20px; }

/* ── Labels & Groups ────────────────────────────────────────── */
.slr-label {
    display: block;
    font-size: 13px; font-weight: 700; color: #475569;
    margin-bottom: 10px;
}
.slr-field-group { margin-bottom: 20px; }

/* ── Amp Grid ───────────────────────────────────────────────── */
.slr-amps-grid {
    display: flex; flex-wrap: wrap; gap: 7px;
    max-height: 180px; overflow-y: auto;
    padding: 4px 2px;
    border: 1px solid #ddd6fe; border-radius: 10px;
    padding: 10px;
    background: #fafbff;
}
/* scrollbar styling */
.slr-amps-grid::-webkit-scrollbar { width: 5px; }
.slr-amps-grid::-webkit-scrollbar-track { background: #f1f5f9; border-radius: 5px; }
.slr-amps-grid::-webkit-scrollbar-thumb { background: #c4b5fd; border-radius: 5px; }
.slr-amp-btn {
    padding: 7px 13px; border-radius: 8px;
    border: 1.5px solid #ddd6fe; background: #f8fafc;
    font-size: 13px; font-weight: 600; color: #475569;
    cursor: pointer; transition: all .15s;
    font-family: Cairo, sans-serif;
}
.slr-amp-btn:hover    { border-color: #a78bfa; color: #7c3aed; background: #ede9fe; }
.slr-amp-btn.selected { border-color: #7c3aed; background: #7c3aed; color: #fff; }

/* ── Calc Result ────────────────────────────────────────────── */
.slr-calc-result {
    background: #f5f3ff; border: 1px solid #ddd6fe;
    border-radius: 10px; padding: 12px 16px; margin-bottom: 18px;
}
.slr-calc-row {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 13px; color: #64748b;
}
.slr-calc-val  { font-size: 18px; font-weight: 800; color: #7c3aed; }
.slr-calc-hint { font-size: 11px; color: #94a3b8; margin-top: 4px; }

/* ── Product Grid ───────────────────────────────────────────── */
.slr-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
    gap: 10px;
    margin-bottom: 4px;
}
.slr-loading {
    grid-column: 1/-1; text-align: center;
    padding: 30px; color: #94a3b8; font-size: 13px;
}
.slr-prod-card {
    border: 1.5px solid #ddd6fe; border-radius: 12px;
    overflow: hidden; cursor: pointer; background: #fff;
    display: flex; flex-direction: column;
    transition: border-color .15s, transform .12s;
    font-family: Cairo, sans-serif;
}
.slr-prod-card:hover     { border-color: #a78bfa; transform: translateY(-2px); }
.slr-prod-card.selected  { border-color: #7c3aed; background: #f5f3ff; }
.slr-prod-img {
    width: 100%; aspect-ratio: 1; object-fit: contain;
    padding: 10px; background: #f8fafc; flex-shrink: 0;
}
.slr-prod-body {
    padding: 10px 11px; flex: 1;
    display: flex; flex-direction: column; gap: 3px;
}
.slr-prod-name  { font-size: 11px; font-weight: 700; color: #1e293b; line-height: 1.4; word-break: break-word; }
.slr-prod-meta  { font-size: 10px; color: #94a3b8; }
.slr-prod-price { font-size: 13px; font-weight: 800; color: #2563eb; margin-top: auto; padding-top: 5px; }
.slr-prod-btn {
    display: block; width: 100%; padding: 8px;
    background: #2563eb; color: #fff;
    border: none; font-size: 11px; font-weight: 700;
    cursor: pointer; font-family: Cairo, sans-serif;
    flex-shrink: 0;
}
.slr-prod-btn.deselect { background: #fee2e2; color: #dc2626; }

/* ── Selected Summary ───────────────────────────────────────── */
.slr-selected-summary {
    background: #fafbff; border: 1.5px solid #ddd6fe;
    border-radius: 12px; padding: 14px 16px;
}
.slr-selected-row {
    display: flex; align-items: center; gap: 12px;
}
.slr-selected-img {
    width: 52px; height: 52px; object-fit: contain;
    border-radius: 8px; background: #f8fafc; flex-shrink: 0;
    border: 1px solid #e2e8f0;
}
.slr-selected-info { flex: 1; min-width: 0; }
.slr-selected-name { font-size: 13px; font-weight: 700; color: #1e293b; margin-bottom: 3px; }
.slr-selected-meta { font-size: 11px; color: #64748b; }
.slr-selected-total { text-align: left; flex-shrink: 0; }
.slr-total-label { font-size: 10px; color: #94a3b8; margin-bottom: 2px; }
.slr-total-val   { font-size: 16px; font-weight: 800; color: #2563eb; white-space: nowrap; }

.slr-change-btn {
    margin-top: 10px; padding: 7px 18px;
    border: 1.5px dashed #a78bfa; border-radius: 7px;
    background: transparent; color: #7c3aed;
    font-size: 12px; font-weight: 600; cursor: pointer;
    font-family: Cairo, sans-serif; transition: all .15s;
}
.slr-change-btn:hover { background: #ede9fe; }

/* ── Night Power Cards ──────────────────────────────────────── */
.slr-night-cards {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
.slr-night-card {
    border: 2px solid #ddd6fe; border-radius: 12px;
    padding: 14px 10px; text-align: center; cursor: pointer;
    background: #fff; transition: all .15s;
}
.slr-night-card:hover    { border-color: #a78bfa; background: #faf8ff; }
.slr-night-card.selected { border-color: #7c3aed; background: #ede9fe; }
.slr-night-title { font-size: 11px; color: #64748b; font-weight: 600; margin-bottom: 6px; }
.slr-night-amps  { font-size: 20px; font-weight: 900; color: #7c3aed; }
.slr-night-card.selected .slr-night-amps { color: #5b21b6; }

/* ── Hours Row ──────────────────────────────────────────────── */
.slr-hours-row {
    display: flex; flex-wrap: wrap; gap: 8px;
}
.slr-hour-btn {
    padding: 8px 16px; border-radius: 8px;
    border: 1.5px solid #ddd6fe; background: #f8fafc;
    font-size: 13px; font-weight: 600; color: #475569;
    cursor: pointer; transition: all .15s;
    font-family: Cairo, sans-serif;
}
.slr-hour-btn:hover    { border-color: #a78bfa; color: #7c3aed; }
.slr-hour-btn.selected { border-color: #7c3aed; background: #7c3aed; color: #fff; }

/* ── Battery Combos ─────────────────────────────────────────── */
.slr-battery-combos { display: flex; flex-direction: column; gap: 10px; }
.slr-battery-combo {
    border: 2px solid #ddd6fe; border-radius: 12px;
    padding: 14px 16px; cursor: pointer; background: #fff;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    transition: all .15s;
}
.slr-battery-combo:hover    { border-color: #a78bfa; }
.slr-battery-combo.selected { border-color: #7c3aed; background: #f5f3ff; }
.slr-combo-left { display: flex; align-items: center; gap: 12px; }
.slr-combo-img  { width: 44px; height: 44px; object-fit: contain; border-radius: 6px; background: #f8fafc; }
.slr-combo-name { font-size: 13px; font-weight: 700; color: #1e293b; }
.slr-combo-cap  { font-size: 11px; color: #64748b; margin-top: 2px; }
.slr-combo-price { font-size: 15px; font-weight: 800; color: #2563eb; white-space: nowrap; }

/* ── Install Breakdown ──────────────────────────────────────── */
.slr-install-breakdown { display: flex; flex-direction: column; gap: 0; }
.slr-install-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 0; border-bottom: 1px solid #f1f5f9;
    font-size: 13px; color: #64748b;
}
.slr-install-row:last-child { border-bottom: none; }
.slr-install-total-row {
    font-size: 15px; font-weight: 800; color: #1e293b;
    background: #f5f3ff; margin: 6px -20px -20px;
    padding: 14px 20px; border-radius: 0 0 12px 12px;
}

/* ── Zone ───────────────────────────────────────────────────── */
.slr-zone-select {
    width: 100%; padding: 11px 13px;
    border: 1.5px solid #ddd6fe; border-radius: 9px;
    font-size: 14px; color: #1e293b; background: #f8fafc;
    cursor: pointer; font-family: Cairo, sans-serif;
    margin-bottom: 12px;
}
.slr-zone-select:focus { outline: none; border-color: #7c3aed; }
.slr-zone-price {
    display: flex; justify-content: space-between; align-items: center;
    background: #f5f3ff; border-radius: 9px; padding: 10px 14px;
    font-size: 13px; color: #64748b;
}

/* ── Notice ─────────────────────────────────────────────────── */
.slr-notice {
    background: #eff6ff; border-right: 3px solid #2563eb;
    border-radius: 8px; padding: 11px 14px;
    font-size: 12px; color: #1e40af; line-height: 1.7;
    margin-bottom: 18px;
}

/* ── Sticky Summary ─────────────────────────────────────────── */
/* ── Layout: grid — stages + sticky side column ── */
.slr-builder {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
    align-items: start;
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 16px 40px;
}
/* عمود الـ stages يأخذ العمود الأول */
.slr-stages-col { min-width: 0; }
/* الـ sticky يصبح عمود جانبي */
.slr-sticky {
    position: sticky;
    top: 80px;
    background: #fff;
    border: 1.5px solid #ddd6fe;
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(124,58,237,.08);
    overflow: hidden;
    /* إزالة fixed positioning */
    bottom: auto; left: auto; right: auto;
    z-index: 10;
}
.slr-sticky-inner {
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    direction: rtl;
}
/* Header الـ sticky */
.slr-sticky-header {
    padding: 13px 16px;
    background: #ede9fe;
    border-bottom: 1px solid #ddd6fe;
    font-size: 13px; font-weight: 800; color: #7c3aed;
}
.slr-sticky-items {
    padding: 10px 0;
    display: flex; flex-direction: column; gap: 0;
    min-height: 50px;
}
.slr-sticky-empty { padding: 14px 16px; font-size: 12px; color: #94a3b8; text-align: center; }
.slr-sticky-item {
    display: flex; align-items: flex-start; gap: 8px;
    padding: 7px 16px; border-bottom: 1px solid #f1f5f9;
    font-size: 12px;
}
.slr-sticky-item:last-child { border-bottom: none; }
.slr-sticky-item-dot {
    width: 7px; height: 7px; border-radius: 50%;
    flex-shrink: 0; margin-top: 3px;
}
.slr-sticky-item-info { flex: 1; min-width: 0; }
.slr-sticky-item-name { color: #1e293b; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slr-sticky-item-price { color: #2563eb; font-weight: 700; font-size: 11px; }

.slr-sticky-total-wrap {
    padding: 12px 16px;
    border-top: 1.5px solid #ddd6fe;
    background: #fafbff;
    display: flex; flex-direction: column; gap: 4px;
}
.slr-sticky-total-label { font-size: 11px; color: #94a3b8; }
.slr-sticky-total {
    display: flex; align-items: baseline; gap: 4px;
}
.slr-sticky-total #slr-final-price {
    font-size: 24px; font-weight: 900; color: #1e293b;
}
.slr-sticky-currency { font-size: 13px; color: #64748b; font-weight: 600; }

.slr-sticky-actions {
    padding: 12px 16px;
    border-top: 1px solid #ddd6fe;
    display: flex; flex-direction: column; gap: 7px;
    background: #fafbff;
}

/* موبايل: قسم عادي في الأسفل — ليس fixed */
@media (max-width: 860px) {
    .slr-builder {
        grid-template-columns: 1fr;
        padding-bottom: 40px;
    }
    .slr-stages-col { order: 1; }
    .slr-sticky {
        order: 2;
        position: static;
        border-radius: 14px;
        border: 1.5px solid #ddd6fe;
        box-shadow: 0 2px 12px rgba(124,58,237,.08);
        max-height: none;
        overflow-y: visible;
        margin-top: 16px;
    }
    .slr-sticky-inner { flex-direction: column; gap: 0; }
    .slr-sticky-items { flex-direction: column; gap: 6px; padding: 12px 16px; border-bottom: 1px solid #f1f5f9; width: 100%; }
    .slr-sticky-item { border-bottom: none; padding: 4px 8px; border-radius: 7px; background: #f5f3ff; }
    .slr-sticky-total-wrap { flex-direction: row; align-items: center; gap: 10px; flex: 1; padding: 12px 16px; flex-wrap: wrap; }
    .slr-sticky-actions { flex-direction: row; flex-wrap: wrap; padding: 12px 16px; width: 100%; gap: 8px; }
}
.slr-btn {
    padding: 9px 16px; border-radius: 8px; border: none;
    font-size: 12px; font-weight: 700; cursor: pointer;
    font-family: Cairo, sans-serif; transition: opacity .15s;
}
.slr-btn:hover { opacity: .88; }
.slr-btn--invoice { background: #7c3aed; color: #fff; }
.slr-wa-btn {
    padding: 9px 14px; border-radius: 8px; border: none;
    background: #16a34a; color: #fff;
    font-size: 12px; font-weight: 700; cursor: pointer;
    font-family: Cairo, sans-serif;
}
.slr-wa-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── Mobile ─────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .slr-night-cards { grid-template-columns: repeat(3,1fr); gap: 7px; }
    .slr-night-amps  { font-size: 17px; }
    .slr-product-grid { grid-template-columns: repeat(2, 1fr); }
    .slr-sticky-inner { flex-direction: column; gap: 10px; }
    .slr-sticky-total-wrap { align-items: flex-start; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; }
    .slr-battery-combo { flex-direction: column; align-items: flex-start; }
}

/* ── Inverter notes ─────────────────────────────────────────── */
.slr-inv-req {
    background: #eff6ff; border: 1px solid #bfdbfe;
    border-radius: 8px; padding: 8px 14px;
    font-size: 12px; color: #1e40af;
    margin-bottom: 12px;
}
.slr-inv-note {
    font-size: 11px; color: #94a3b8;
    padding: 4px 0; margin-bottom: 4px;
}
.slr-inv-combo-card .slr-prod-btn { background: #7c3aed; }
.slr-inv-combo-card .slr-prod-btn:hover { background: #6d28d9; }

/* ── High Voltage Notice ─────────────────────────────────────── */
.slr-hv-notice {
    background: linear-gradient(135deg, #1e1b4b, #312e81);
    color: #c7d2fe;
    border: 1px solid #4f46e5;
    border-radius: 10px;
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 700;
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}
