/* ============================================================
   Service Price Calculator Widget — spcw-style.css
   Author: M.Usama
   ============================================================ */

/* ── Base reset ── */
.spcw-wrapper *,
.spcw-wrapper *::before,
.spcw-wrapper *::after {
    box-sizing: border-box;
}

/* ── Wrapper ── */
.spcw-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #0f172a;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

/* ── Header ── */
.spcw-header {
    margin-bottom: 20px;
}
.spcw-title {
    font-size: clamp(18px, 4vw, 22px);
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 6px;
    line-height: 1.3;
    word-break: break-word;
}
.spcw-subtitle {
    font-size: clamp(12px, 3vw, 14px);
    color: #64748b;
    margin: 0;
    line-height: 1.5;
    word-break: break-word;
}

/* ── Column label ── */
.spcw-col-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #94a3b8;
    margin: 0 0 12px;
    padding: 0;
}

/* ══════════════════════════════════════
   TWO-COLUMN GRID
══════════════════════════════════════ */
.spcw-grid {
    display: grid;
    grid-template-columns: 55fr 45fr;
    gap: 24px;
    align-items: start;
    width: 100%;
}

@media (max-width: 900px) {
    .spcw-grid {
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }
}

@media (max-width: 640px) {
    .spcw-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .spcw-col-services { order: 1; }
    .spcw-col-summary  { order: 2; }
}

/* ══════════════════════════════════════
   SERVICE ITEMS
══════════════════════════════════════ */
.spcw-services-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.spcw-service-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: #f8fafc;
    border-radius: 10px;
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
    user-select: none;
    outline: none;
    width: 100%;
    min-height: 52px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.spcw-service-item:hover { background: #f1f5f9; }
.spcw-service-item:focus-visible { box-shadow: 0 0 0 3px rgba(153,13,255,0.2); }
.spcw-service-item.spcw-selected { border-color: #990dff; background: #fdf8ff; }
.spcw-service-item.spcw-selecting { transform: scale(0.99); }

@media (max-width: 380px) {
    .spcw-service-item { padding: 10px 11px; gap: 10px; }
}

/* ── Checkbox ── */
.spcw-checkbox {
    width: 20px;
    height: 20px;
    min-width: 20px;
    border-radius: 5px;
    border: 1.5px solid #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s;
    flex-shrink: 0;
}
.spcw-service-item.spcw-selected .spcw-checkbox { background: #990dff; border-color: #990dff; }
.spcw-check-svg { display: none; }
.spcw-service-item.spcw-selected .spcw-check-svg { display: block; }

/* ── Service info ── */
.spcw-service-info {
    flex: 1;
    min-width: 0;
}
.spcw-service-name {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    font-size: clamp(13px, 3.2vw, 14px);
    font-weight: 600;
    color: #0f172a;
    line-height: 1.3;
    word-break: break-word;
}
.spcw-service-desc {
    display: block;
    font-size: clamp(11px, 2.8vw, 12px);
    color: #64748b;
    margin-top: 2px;
    line-height: 1.4;
    white-space: normal;
    word-break: break-word;
}

@media (min-width: 641px) and (max-width: 900px) {
    .spcw-service-desc {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* ── Badge ── */
.spcw-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 99px;
    background: #fef3c7;
    color: #92400e;
    letter-spacing: 0.03em;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Price ── */
.spcw-service-price {
    font-size: clamp(13px, 3.2vw, 14px);
    font-weight: 700;
    color: #94a3b8;
    white-space: nowrap;
    transition: color 0.15s;
    flex-shrink: 0;
    margin-left: 4px;
}
.spcw-service-item.spcw-selected .spcw-service-price { color: #990dff; }

/* ══════════════════════════════════════
   SUMMARY CARD
══════════════════════════════════════ */
.spcw-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 18px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    width: 100%;
}

@media (min-width: 641px) {
    .spcw-card { position: sticky; top: 20px; }
}

@media (max-width: 640px) {
    .spcw-card { position: static; padding: 16px; border-radius: 12px; }
}

/* ── Empty state ── */
.spcw-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 0;
    gap: 10px;
    color: #94a3b8;
    text-align: center;
}
.spcw-empty-state p {
    font-size: 13px;
    color: #94a3b8;
    margin: 0;
    line-height: 1.5;
    padding: 0 8px;
}

/* ── Selected services list ── */
.spcw-selected-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 14px;
    width: 100%;
}
.spcw-summary-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    font-size: 13px;
    color: #334155;
    padding: 5px 0;
    gap: 8px;
    animation: spcwFadeIn 0.2s ease;
}
.spcw-summary-item-name {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    flex: 1;
    min-width: 0;
    word-break: break-word;
    line-height: 1.4;
}
.spcw-summary-item-name::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    min-width: 6px;
    border-radius: 50%;
    background: #990dff;
    flex-shrink: 0;
    margin-top: 5px;
}
.spcw-summary-item-price {
    font-weight: 600;
    color: #0f172a;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Totals ── */
.spcw-totals {
    border-top: 1px solid #f1f5f9;
    padding-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}
.spcw-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: #64748b;
    gap: 8px;
}
.spcw-discount-row { color: #0f6e56; flex-wrap: wrap; }
.spcw-discount-label-text { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.spcw-disc-badge {
    font-size: 10px;
    padding: 2px 7px;
    background: #e1f5ee;
    color: #0f6e56;
    border-radius: 99px;
    font-weight: 700;
    white-space: nowrap;
}
.spcw-grand-total-row {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    padding-top: 10px;
    border-top: 1px solid #e2e8f0;
    margin-top: 4px;
    align-items: center;
}
.spcw-total-amount {
    font-size: clamp(18px, 5vw, 22px);
    font-weight: 800;
    color: #0f172a;
    white-space: nowrap;
}

/* ── Form ── */
.spcw-form-divider { height: 1px; background: #f1f5f9; margin: 14px 0; }
.spcw-form-wrap { width: 100%; }

.spcw-field {
    display: block;
    width: 100%;
    padding: 11px 12px;
    font-family: inherit;
    color: #0f172a;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    outline: none;
    margin-bottom: 8px;
    transition: border-color 0.15s, box-shadow 0.15s;
    resize: vertical;
    /* Prevent iOS auto-zoom (requires font-size >= 16px) */
    font-size: 16px;
    -webkit-appearance: none;
    appearance: none;
}
.spcw-field:focus {
    border-color: #990dff;
    box-shadow: 0 0 0 3px rgba(153,13,255,0.1);
    background: #fff;
}
.spcw-field::placeholder { color: #94a3b8; }
textarea.spcw-field { min-height: 80px; }

/* ── Button ── */
.spcw-btn {
    display: block;
    width: 100%;
    padding: 14px 20px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(90deg, #990dff, #40FDFD);
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
    margin-top: 4px;
    letter-spacing: 0.02em;
    min-height: 48px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.spcw-btn:hover { opacity: 0.88; }
.spcw-btn:active { transform: scale(0.98); opacity: 0.85; }
.spcw-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.spcw-btn.spcw-loading { opacity: 0.7; pointer-events: none; }

/* ── Success message ── */
.spcw-success-msg {
    margin-top: 12px;
    padding: 12px 14px;
    background: #e1f5ee;
    border-radius: 8px;
    font-size: 13px;
    color: #0f6e56;
    text-align: center;
    line-height: 1.5;
    word-break: break-word;
}

/* ── Extra small phones ── */
@media (max-width: 360px) {
    .spcw-header { margin-bottom: 14px; }
    .spcw-card { padding: 12px; }
    .spcw-service-item { padding: 9px 10px; gap: 8px; }
    .spcw-checkbox { width: 18px; height: 18px; min-width: 18px; }
    .spcw-grid { gap: 12px; }
}

/* ── Animations ── */
@keyframes spcwFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}
