/* ================================================
   MB Solar Packages v2.0 – Frontend
   Thiết kế theo mẫu Flatsome solar-cards
   MinhBee Agency | minhbee.vn
   ================================================ */

/* ── Variables ── */
:root {
    --mbsp-red:       #e40046;
    --mbsp-red-h:     #b8003a;
    --mbsp-text:      #111111;
    --mbsp-muted:     #888888;
    --mbsp-divider:   #cfcfcf;
    --mbsp-check:     #17a34a;
    --mbsp-card-r:    20px;
    --mbsp-card-bg:   #eefbff;
    --mbsp-feat-bg:   #fff0cf;
}

/* ── Wrapper ── */
.mbsp-wrapper { font-family: inherit; padding: 40px 0; }

/* ── Section header ── */
.mbsp-section-header { text-align: center; margin-bottom: 48px; }
.mbsp-section-title {
    font-size: clamp(22px, 3vw, 32px);
    font-weight: 800;
    color: var(--mbsp-text);
    margin: 0 0 10px;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.mbsp-section-subtitle { font-size: 15px; color: var(--mbsp-muted); margin: 0; }

/* ── Grid ── */
.mbsp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
    gap: 20px;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 16px;
    /* align-items: stretch (default) → các card trong cùng hàng cao bằng nhau */
}

@media (min-width: 860px) {
    .mbsp-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ── Card ── */
.mbsp-card {
    display: flex;
    flex-direction: column;
    background: var(--mbsp-card-bg);
    border-radius: var(--mbsp-card-r);
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,.10);
    position: relative;
    transition: transform .25s ease, box-shadow .25s ease;
    height: 100%; /* stretch full chiều cao grid row */
}
.mbsp-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 32px rgba(0,0,0,.16);
}

/* Card nổi bật: nền vàng kem */
.mbsp-card--highlighted {
    background: var(--mbsp-feat-bg);
    box-shadow: 0 6px 28px rgba(0,0,0,.13);
}
.mbsp-card--highlighted:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 36px rgba(0,0,0,.2);
}
@media (min-width: 860px) {
    .mbsp-card--highlighted {
        margin-top: -10px; /* nhô lên trên desktop */
        margin-bottom: -10px;
    }
}

/* ── Badge góc (Phổ biến nhất…) ── */
.mbsp-badge {
    position: absolute; top: 10px; right: 10px; z-index: 3;
    background: var(--mbsp-red); color: #fff;
    font-size: 10px; font-weight: 700;
    padding: 3px 10px; border-radius: 20px;
    text-transform: uppercase; letter-spacing: .05em;
}

/* ── Ảnh sản phẩm: full width, không padding ── */
.mbsp-card-image {
    overflow: hidden;
    flex-shrink: 0;
    line-height: 0;
    background: #eef2f7;
}
.mbsp-card-image img {
    display: block;
    width: 100%;
    /* height: 220px; */
    object-fit: contain;
    object-position: center;
    padding: 0;
    margin: 0;
    border-radius: 0;
    background: #eef2f7;
}

/* ── Banner màu full-width dưới ảnh ── */
.mbsp-banner {
    display: block;
    width: 100%;
    padding: 8px 14px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
    text-align: center;
    box-sizing: border-box;
    line-height: 1.3;
    flex-shrink: 0;
}

/* ── Body ── */
.mbsp-card-body {
    display: flex;
    flex-direction: column;
    flex: 1;           /* chiếm hết chiều cao còn lại trong card */
    padding: 20px 20px 24px;
    text-align: center;
    min-width: 0;
    overflow: hidden;
}

/* ── Tên gói: đỏ + gạch chân ── */
.mbsp-package-name {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 800;
    color: var(--mbsp-red);
    text-transform: uppercase;
    text-decoration: underline;
    letter-spacing: .03em;
}

/* ── Giá siêu to ── */
.mbsp-price {
    display: block;
    font-size: clamp(28px, 5vw, 40px); /* nhỏ hơn, responsive theo card width */
    font-weight: 900;
    color: var(--mbsp-text);
    line-height: 1;
    letter-spacing: -1px;
    word-break: break-all;  /* fallback nếu vẫn tràn */
    overflow-wrap: break-word;
}
.mbsp-unit {
    display: block;
    margin-top: 8px;
    font-size: 13px;
    font-weight: 400;
    color: var(--mbsp-muted);
    letter-spacing: .02em;
    text-transform: uppercase;
}

/* ── Subtitle ── */
.mbsp-package-subtitle {
    margin: 10px 0 16px;
    font-size: 15px;
    color: var(--mbsp-muted);
    font-weight: 400;
}

/* ── Nút pill outline ── */
.mbsp-btn-consult {
    display: block;
    width: 100%;
    padding: 10px 18px;
    border: 1.5px solid #bbb;
    border-radius: 99px;
    background: transparent;
    color: var(--mbsp-text);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: border-color .18s, color .18s, background .18s;
    box-sizing: border-box;
    letter-spacing: .01em;
    font-family: inherit;
}
.mbsp-btn-consult:hover {
    border-color: var(--mbsp-red);
    color: var(--mbsp-red);
    background: rgba(228,0,70,.04);
    text-decoration: none;
}
a.mbsp-btn-consult { display: block; }

/* ── Danh sách thiết bị: luôn ở cuối card ── */
.mbsp-devices {
    margin-top: auto;   /* đẩy xuống đáy card dù card dài hay ngắn */
    padding-top: 18px;
    border-top: 1px solid var(--mbsp-divider);
    text-align: left;
}
.mbsp-devices-label {
    display: block;
    margin: 0 0 12px;
    font-size: 16px;
    font-weight: 700;
    color: var(--mbsp-dev-color, var(--mbsp-red));
}
.mbsp-device-list { list-style: none; margin: 0; padding: 0; }
.mbsp-device-list li {
    position: relative;
    padding-left: 24px;
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--mbsp-text);
    line-height: 1.55;
}
.mbsp-device-list li::before {
    content: '✔';
    position: absolute; left: 0; top: 1px;
    color: var(--mbsp-check);
    font-weight: 700;
    font-size: 13px;
}

/* ── spacer giữa nút và devices ── */
.mbsp-cta-spacer { display: block; height: 22px; }

/* ================================================
   MODAL v2 — form đăng ký tư vấn
   ================================================ */
/* Reset box-sizing cho modal */
.mbsp-modal-overlay *,
.mbsp-modal-overlay *::before,
.mbsp-modal-overlay *::after {
    box-sizing: border-box;
}
.mbsp-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0; /* fallback cho inset */
    inset: 0;
    background: rgba(0,0,0,.6);
    z-index: 9999999; /* cao hơn Flatsome header/sticky */
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    animation: mbspFadeIn .2s ease;
}
.mbsp-modal-overlay[hidden] { display: none !important; }
@keyframes mbspFadeIn { from { opacity: 0; } to { opacity: 1; } }

.mbsp-modal {
    background: #fff;
    border-radius: 20px;
    padding: 0;
    max-width: 520px;
    width: 100%;
    max-width: min(520px, calc(100vw - 40px)); /* không vượt viewport */
    position: relative;
    box-shadow: 0 24px 64px rgba(0,0,0,.22);
    animation: mbspSlideUp .25s ease;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    overflow-x: visible; /* không clip dropdown select */
}
@keyframes mbspSlideUp {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Modal header đỏ */
.mbsp-modal-header {
    background: var(--mbsp-red);
    color: #fff;
    padding: 24px 28px 20px;
    text-align: center;
    position: relative;
}
.mbsp-modal-header h2 {
    font-size: 18px;
    font-weight: 800;
    margin: 0 0 6px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #fff;
}
.mbsp-modal-desc {
    font-size: 13px;
    color: rgba(255,255,255,.85);
    margin: 0;
    line-height: 1.5;
}
.mbsp-modal-desc strong { color: #fff; font-weight: 700; }

.mbsp-modal-close {
    position: absolute; top: 12px; right: 16px;
    background: rgba(255,255,255,.2); border: none;
    width: 28px; height: 28px; border-radius: 50%;
    font-size: 18px; cursor: pointer;
    color: #fff; line-height: 1;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s;
}
.mbsp-modal-close:hover { background: rgba(255,255,255,.35); }

/* Package badge */
.mbsp-modal-package-badge {
    background: #fff8f0;
    border-bottom: 1px solid #fde8cc;
    padding: 10px 28px;
    text-align: center;
}
.mbsp-modal-package-badge span {
    display: inline-block;
    background: #fff3e0; color: #b45309;
    font-size: 11px; font-weight: 700;
    padding: 3px 12px; border-radius: 20px;
    border: 1px solid #fcd34d;
    text-transform: uppercase; letter-spacing: .04em;
}

/* Form body */
.mbsp-form-body { padding: 20px 28px 28px; }

.mbsp-field { margin-bottom: 10px; }
.mbsp-field label {
    display: block;
    font-size: 12px; font-weight: 600;
    color: #444; margin-bottom: 4px;
    letter-spacing: .02em;
}
.mbsp-field input,
.mbsp-field select {
    width: 100%; box-sizing: border-box;
    padding: 5px 13px;
    border: 1.5px solid #e2e5ea;
    border-radius: 8px;
    font-size: 14px; color: var(--mbsp-text);
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
    font-family: inherit;
    appearance: auto;
}
.mbsp-field input:focus,
.mbsp-field select:focus {
    outline: none;
    border-color: var(--mbsp-red);
    box-shadow: 0 0 0 3px rgba(228,0,70,.08);
}
.mbsp-field input::placeholder { color: #adb5bd; }

.mbsp-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.mbsp-location-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}
.mbsp-location-row select {
    font-size: 12px;
    padding: 5px 4px;
    min-width: 0; 
    width: 100%;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

/* Required star */
.mbsp-required { color: var(--mbsp-red); margin-left: 2px; }

.mbsp-error-msg {
    background: #fff0f0; border: 1px solid #ffc9c9;
    color: #c92a2a; padding: 9px 13px;
    border-radius: 8px; font-size: 13px; margin-bottom: 10px;
}
.mbsp-error-msg[hidden] { display: none; }

.mbsp-success-msg { text-align: center; padding: 28px 0 12px; }
.mbsp-success-msg[hidden] { display: none; }
.mbsp-success-icon { font-size: 48px; display: block; margin-bottom: 12px; }
.mbsp-success-msg h3 { font-size: 18px; color: #16a34a; font-weight: 700; margin: 0 0 6px; }
.mbsp-success-msg p  { font-size: 13px; color: #555; margin: 0; }
.mbsp-btn-loading[hidden] { display: none; }

.mbsp-btn-submit {
    display: block; width: 100%;
    padding: 13px 20px; margin-top: 14px;
    background: var(--mbsp-red); color: #fff;
    border: none; border-radius: 10px;
    font-size: 14px; font-weight: 800; cursor: pointer;
    letter-spacing: .05em; text-transform: uppercase;
    transition: background .18s, transform .12s;
    font-family: inherit;
}
.mbsp-btn-submit:hover    { background: var(--mbsp-red-h); transform: translateY(-1px); }
.mbsp-btn-submit:active   { transform: translateY(0); }
.mbsp-btn-submit:disabled { opacity: .6; cursor: not-allowed; transform: none; }

.mbsp-form-note {
    text-align: center; margin-top: 10px;
    font-size: 11px; color: #aaa;
}

/* ── Responsive ── */
@media (max-width: 680px) {
    .mbsp-grid { grid-template-columns: 1fr; }
    .mbsp-card--highlighted { margin-top: 0; }
    .mbsp-price { font-size: 42px; }
    .mbsp-devices-label { font-size: 17px; }
    .mbsp-modal { border-radius: 16px; }
    .mbsp-form-body { padding: 16px 20px 24px; }
    .mbsp-location-row { grid-template-columns: 1fr; gap: 8px; }
    .mbsp-field-row { grid-template-columns: 1fr; }
}
