/* Service Form Builder — base styles (overridable by Elementor controls) */

.sfb-wrapper-outer {
    display: flex;
    width: 100%;
    justify-content: center;
}

.sfb-wrapper {
    width: 100%;
    max-width: 900px;
    display: block;
}

.sfb-wrapper .sfb-form {
    display: flex;
    flex-direction: column;
    gap: inherit; /* Inherits gap from .sfb-wrapper via the 'gap' control */
    font-family: inherit;
}

/* Each orderable block — Elementor controls set `order` via inline style. */
.sfb-block { order: 10; }

.sfb-section {
    padding: 20px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
}

.sfb-heading {
    margin: 0 0 16px;
    font-size: 18px;
    font-weight: 600;
}

/* ============= Services grid ============= */
.sfb-services-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.sfb-service-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 14px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f9fafb;
    transition: box-shadow .15s ease, transform .15s ease;
    overflow: hidden;
    text-align: inherit; /* Inherit from parent alignment control. */
}

.sfb-service-card.has-image { padding-top: 0; }

.sfb-service-image {
    margin: -14px -14px 12px;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #e5e7eb;
}
.sfb-service-image img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}

.sfb-service-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
    transform: translateY(-1px);
}

.sfb-service-name { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.sfb-service-desc  { font-size: 13px; color: #6b7280; margin-bottom: 8px; line-height: 1.4; }
.sfb-service-price { font-weight: 700; font-size: 16px; margin: 6px 0 10px; color: #111827; }

.sfb-service-add {
    background: #2563eb;
    color: #fff;
    border: 0;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: opacity .15s, background-color .15s;
}
.sfb-service-add:hover { opacity: .9; }

.sfb-service-card.is-added {
    border-color: #10b981;
    background: #ecfdf5;
}
.sfb-service-card.is-added .sfb-service-add { background: #10b981; }

/* ============= Live selection bar ============= */
.sfb-live-selection {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
}
.sfb-live-label { font-weight: 600; font-size: 14px; color: #1e40af; }

.sfb-live-list {
    list-style: none; margin: 0; padding: 0;
    display: flex; flex-wrap: wrap; gap: 8px; flex: 1;
}

.sfb-live-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px 4px 12px;
    background: #fff;
    border: 1px solid #dbeafe;
    border-radius: 999px;
    font-size: 13px;
}
.sfb-live-name { font-weight: 500; color: #111827; }

.sfb-qty-controls {
    display: inline-flex; align-items: center; gap: 2px;
    background: #f3f4f6; border-radius: 999px; padding: 2px;
}
.sfb-qty-btn {
    width: 22px; height: 22px;
    padding: 0; border: 0; background: transparent;
    color: #2563eb;
    font-size: 16px; font-weight: 600; line-height: 1;
    border-radius: 50%; cursor: pointer;
    transition: background .15s;
}
.sfb-qty-btn:hover { background: #dbeafe; }
.sfb-qty-value { min-width: 18px; text-align: center; font-weight: 600; font-size: 13px; color: #111827; }

/* ============= Receipt cart ============= */
.sfb-cart-list { list-style: none; padding: 0; margin: 0; }

.sfb-cart-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 0; border-bottom: 1px solid #f3f4f6; gap: 10px;
}
.sfb-cart-item:last-child { border-bottom: 0; }

.sfb-cart-thumb { width: 40px; height: 40px; flex-shrink: 0; }
.sfb-cart-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 4px; display: block; }

.sfb-cart-name { flex: 1; }
.sfb-cart-price { font-weight: 600; min-width: 80px; text-align: right; }

.sfb-qty-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 8px;
    background: #e0e7ff;
    color: #3730a3;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}

.sfb-total-row {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 14px; padding-top: 14px;
    border-top: 2px solid #e5e7eb;
    font-size: 18px; font-weight: 600;
}
.sfb-total-amount { font-size: 22px; color: #2563eb; }

/* ============= Fields ============= */
.sfb-fields-grid { display: flex; flex-wrap: wrap; gap: 14px; }

.sfb-field {
    display: flex; flex-direction: column;
    flex: 1 1 100%;
    text-align: left; /* Inputs always left-align their content even if section is centered. */
}
.sfb-width-50 { flex: 1 1 calc(50% - 7px); }
.sfb-width-33 { flex: 1 1 calc(33.333% - 10px); }

@media (max-width: 600px) { .sfb-width-50, .sfb-width-33 { flex: 1 1 100%; } }

.sfb-field label { font-size: 14px; font-weight: 500; margin-bottom: 6px; color: #374151; }
.sfb-required { color: #ef4444; margin-left: 2px; }

.sfb-field input, .sfb-field textarea {
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
    width: 100%;
    box-sizing: border-box;
}
.sfb-field input:focus, .sfb-field textarea:focus {
    outline: 0;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}

/* ============= Submit button ============= */
.sfb-submit-row { text-align: inherit; }

.sfb-btn-primary {
    background: #2563eb;
    color: #fff;
    border: 0;
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: opacity .15s, background-color .15s;
}
.sfb-btn-primary:hover:not(:disabled) { opacity: .92; }
.sfb-btn-primary:disabled { opacity: .6; cursor: not-allowed; }

.sfb-btn-primary.is-loading::after {
    content: '';
    display: inline-block;
    width: 12px; height: 12px;
    margin-left: 8px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: sfb-spin .7s linear infinite;
    vertical-align: middle;
}
@keyframes sfb-spin { to { transform: rotate(360deg); } }

/* ============= Messages ============= */
.sfb-message {
    padding: 12px 14px;
    border-radius: 6px;
    font-size: 14px;
    text-align: left;
}
.sfb-message.is-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.sfb-message.is-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.sfb-message.is-info    { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

@media (max-width: 500px) {
    .sfb-live-selection { align-items: flex-start; flex-direction: column; }
    .sfb-services-grid { grid-template-columns: 1fr !important; }
}
