/* ================================================================
   Infomac Buyback Pro — CSS Frontend v2.1
   ================================================================ */
.imb-app *, .imb-app *::before, .imb-app *::after { box-sizing: border-box; }

.imb-app {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    max-width: 680px;
    margin: 0 auto;
    color: #1d1d1f;
    -webkit-font-smoothing: antialiased;
}

/* ── Progress ─────────────────────────────────────────────────── */
.imb-progress { margin-bottom: 24px; }
.imb-progress-bar {
    height: 5px;
    background: #e5e5ea;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 10px;
}
.imb-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0071e3 0%, #34aadc 100%);
    border-radius: 3px;
    transition: width .4s ease;
}
.imb-steps-labels {
    display: flex;
    justify-content: space-between;
}
.imb-steps-labels span {
    font-size: 12px;
    color: #bbb;
    font-weight: 500;
    transition: color .3s;
}
.imb-steps-labels span.active { color: #0071e3; font-weight: 600; }

/* ── Step visibility ──────────────────────────────────────────── */
.imb-step         { display: none; }
.imb-step.active  { display: block; }
.imb-fade         { animation: imbFadeIn .25s ease; }
@keyframes imbFadeIn { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:none; } }

/* ── Card ─────────────────────────────────────────────────────── */
.imb-card {
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 4px 24px rgba(0,0,0,.10);
    overflow: hidden;
}
.imb-card-hd {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 22px 26px 18px;
    border-bottom: 1px solid #f0f0f5;
}
.imb-card-hd h2 { margin: 0 0 3px; font-size: 18px; font-weight: 600; }
.imb-card-hd p  { margin: 0; font-size: 13px; color: #888; }
.imb-step-badge {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #0071e3;
    color: #fff;
    border-radius: 50%;
    font-size: 14px;
    font-weight: 700;
    margin-top: 2px;
}
.imb-card-body { padding: 22px 26px 26px; }

/* ── Type grid ────────────────────────────────────────────────── */
.imb-type-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 22px;
}
.imb-type-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 10px;
    border: 2px solid #e5e5ea;
    border-radius: 13px;
    cursor: pointer;
    user-select: none;
    transition: border-color .18s, background .18s, transform .12s;
}
.imb-type-card:hover { border-color: #aaccf5; transform: translateY(-2px); }
.imb-type-card:has(input:checked) { border-color: #0071e3; background: #f0f7ff; }
.imb-type-card input { display: none; }
.imb-type-icon  { font-size: 30px; line-height: 1; }
.imb-type-label { font-size: 13px; font-weight: 600; color: #333; text-align: center; }

/* ── Brand pills ──────────────────────────────────────────────── */
.imb-brand-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}
.imb-brand-pill {
    display: inline-flex;
    align-items: center;
    padding: 8px 18px;
    border: 2px solid #e5e5ea;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    transition: border-color .15s, background .15s, color .15s;
    color: #333;
}
.imb-brand-pill:hover { border-color: #aaccf5; }
.imb-brand-pill:has(input:checked) {
    border-color: #0071e3;
    background: #0071e3;
    color: #fff;
}
.imb-brand-pill input { display: none; }

/* ── Storage pills ────────────────────────────────────────────── */
.imb-storage-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}
.imb-storage-pill {
    display: inline-flex;
    align-items: center;
    padding: 8px 20px;
    border: 2px solid #e5e5ea;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    transition: border-color .15s, background .15s, color .15s;
    color: #333;
}
.imb-storage-pill:hover { border-color: #aaccf5; }
.imb-storage-pill.active,
.imb-storage-pill:has(input:checked) {
    border-color: #0071e3;
    background: #0071e3;
    color: #fff;
}
.imb-storage-pill input { display: none; }

/* ── Field labels & inputs ────────────────────────────────────── */
.imb-field { margin-bottom: 18px; }
.imb-field:last-child { margin-bottom: 0; }
.imb-field-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #444;
    margin-bottom: 7px;
}
.imb-optional { font-weight: 400; color: #aaa; font-size: 12px; margin-left: 4px; }
.imb-req      { color: #e63946; }
.imb-select,
.imb-input {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid #d0d0d5;
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    background: #fafafa;
    color: #1d1d1f;
    transition: border-color .2s, box-shadow .2s, background .2s;
    appearance: none;
}
.imb-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 38px;
    background-color: #fafafa;
    cursor: pointer;
}
.imb-input:focus, .imb-select:focus {
    border-color: #0071e3;
    box-shadow: 0 0 0 3px rgba(0,113,227,.13);
    outline: none;
    background: #fff;
}
.imb-textarea { resize: vertical; min-height: 80px; }
.imb-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.imb-form-section { margin-top: 22px; padding-top: 22px; border-top: 1px solid #f0f0f5; }
.imb-form-title { margin: 0 0 16px; font-size: 14px; font-weight: 600; color: #555; text-transform: uppercase; letter-spacing: .5px; }

/* ── Condition list ───────────────────────────────────────────── */
.imb-condition-list { margin-bottom: 22px; }
.imb-condition-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 1.5px solid #e5e5ea;
    border-radius: 12px;
    cursor: pointer;
    user-select: none;
    margin-bottom: 8px;
    transition: border-color .2s, background .2s;
}
.imb-condition-item:last-child { margin-bottom: 0; }
.imb-condition-item:hover { border-color: #aaccf5; }
.imb-condition-item:has(input:checked) { border-color: #0071e3; background: #f0f7ff; }
.imb-condition-item input { display: none; }
.imb-condition-content { flex: 1; }
.imb-condition-name { font-size: 15px; font-weight: 600; margin-bottom: 3px; }
.imb-condition-desc { font-size: 13px; color: #777; }
.imb-condition-radio {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1.5px solid #d0d0d5;
    transition: background .2s, border-color .2s;
    position: relative;
}
.imb-condition-item:has(input:checked) .imb-condition-radio {
    background: #0071e3;
    border-color: #0071e3;
}
.imb-condition-item:has(input:checked) .imb-condition-radio::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%,-50%);
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #fff;
}

/* ── Price box ────────────────────────────────────────────────── */
.imb-price-box {
    background: linear-gradient(135deg, #0071e3 0%, #004eb3 100%);
    border-radius: 16px;
    padding: 30px;
    text-align: center;
    color: #fff;
    margin-bottom: 0;
    min-height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.imb-price-loading { text-align: center; }
.imb-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: imbSpin .7s linear infinite;
    margin: 0 auto 12px;
}
@keyframes imbSpin { to { transform: rotate(360deg); } }
.imb-price-loading p { margin: 0; opacity: .85; font-size: 14px; }
.imb-price-device { font-size: 14px; opacity: .82; margin-bottom: 8px; }
.imb-price-amount {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 3px;
    line-height: 1;
    margin-bottom: 8px;
}
.imb-price-eur { font-size: 26px; font-weight: 700; margin-top: 10px; }
.imb-price-num { font-size: 68px; font-weight: 800; }
.imb-price-cond { font-size: 14px; opacity: .85; margin-bottom: 12px; }
.imb-price-note {
    font-size: 12px;
    opacity: .7;
    background: rgba(0,0,0,.15);
    border-radius: 8px;
    padding: 8px 14px;
    line-height: 1.5;
}

/* ── Buttons ──────────────────────────────────────────────────── */
.imb-actions { display: flex; justify-content: flex-end; margin-top: 22px; gap: 10px; }
.imb-actions-split { justify-content: space-between; }

.imb-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 13px 24px;
    border: none;
    border-radius: 11px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    background: #0071e3;
    color: #fff;
    transition: background .18s, transform .12s, opacity .18s;
    white-space: nowrap;
}
.imb-btn:hover:not(:disabled)  { background: #005bbf; transform: translateY(-1px); }
.imb-btn:active:not(:disabled) { transform: none; }
.imb-btn:disabled               { opacity: .4; cursor: not-allowed; }

.imb-btn-ghost {
    background: #f0f0f5;
    color: #444;
}
.imb-btn-ghost:hover:not(:disabled) { background: #e0e0e8; }
.imb-btn-green { background: #28a745; }
.imb-btn-green:hover:not(:disabled) { background: #1e7e34; }

/* ── Alert ────────────────────────────────────────────────────── */
.imb-alert {
    background: #fff0f0;
    color: #c00;
    border-left: 4px solid #c00;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
    margin-top: 14px;
    line-height: 1.5;
}

/* ── Success ──────────────────────────────────────────────────── */
.imb-success {
    text-align: center;
    padding: 40px 30px;
}
.imb-success-icon { font-size: 56px; margin-bottom: 16px; }
.imb-success h2   { font-size: 24px; margin: 0 0 10px; }
.imb-success p    { font-size: 15px; color: #555; margin: 0 0 20px; }

.imb-coupon-box {
    background: linear-gradient(135deg, #fffbe6, #fdf5d9);
    border: 2px dashed #e6c96a;
    border-radius: 14px;
    padding: 20px 26px;
    margin: 18px 0;
    text-align: center;
}
.imb-coupon-label { font-size: 13px; font-weight: 600; color: #8a6d00; margin-bottom: 10px; }
.imb-coupon-code  { font-size: 28px; font-weight: 800; letter-spacing: 4px; color: #5a4500; font-family: monospace; }
.imb-coupon-note  { font-size: 12px; color: #8a6d00; margin-top: 8px; }

.imb-store-info {
    background: #f4f4f8;
    border-radius: 12px;
    padding: 16px 20px;
    display: inline-block;
    font-size: 14px;
    line-height: 1.8;
    text-align: left;
    margin-top: 18px;
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 520px) {
    .imb-card-hd, .imb-card-body { padding: 16px 14px; }
    .imb-type-grid  { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .imb-grid-2     { grid-template-columns: 1fr; gap: 0; }
    .imb-price-num  { font-size: 52px; }
    .imb-actions-split { flex-direction: column; }
    .imb-actions-split .imb-btn { width: 100%; justify-content: center; }
    .imb-success { padding: 30px 16px; }
}

/* ── Device preview photo (step 1) ───────────────────────────── */
.imb-device-preview {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #f8f8f8;
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 18px;
    animation: imbFadeIn .3s ease;
}
.imb-device-preview img {
    width: 70px;
    height: 70px;
    object-fit: contain;
    border-radius: 10px;
    background: #fff;
    padding: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,.1);
}
.imb-preview-badge {
    font-size: 16px;
    font-weight: 700;
    color: #1d1d1f;
}

/* ── Offer hero (step 3) ──────────────────────────────────────── */
.imb-offer-hero {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 0;
    background: linear-gradient(135deg, #0071e3, #004eb3);
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 22px;
    min-height: 140px;
    align-items: center;
}
.imb-offer-img-wrap {
    background: rgba(0,0,0,.15);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 140px;
}
.imb-offer-device-img {
    width: 100px;
    height: 100px;
    object-fit: contain;
    padding: 10px;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,.3));
}
.imb-offer-loading { text-align: center; color: rgba(255,255,255,.85); padding: 20px; }
.imb-offer-price-box { padding: 20px 22px; color: #fff; }
.imb-offer-device-name { font-size: 13px; opacity: .8; margin-bottom: 6px; }
.imb-offer-amount { display: flex; align-items: flex-start; gap: 3px; line-height: 1; margin-bottom: 6px; }
.imb-offer-eur { font-size: 22px; font-weight: 700; margin-top: 6px; }
.imb-offer-value { font-size: 54px; font-weight: 800; }
.imb-offer-cond { font-size: 13px; opacity: .8; margin-bottom: 10px; }
.imb-offer-note { font-size: 11px; opacity: .65; background: rgba(0,0,0,.15); border-radius: 6px; padding: 6px 10px; line-height: 1.5; }
.imb-offer-err { color: rgba(255,255,255,.9); font-size: 13px; padding: 20px; }
.imb-offer-err a { color: #fff; }

/* ── Recap box (step 4) ───────────────────────────────────────── */
.imb-recap-box {
    background: #f8f8f8;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 22px;
}
.imb-recap-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}
.imb-recap-row:last-child { border-bottom: none; }
.imb-recap-row span { color: #888; }
.imb-recap-row strong { color: #1d1d1f; }
.imb-recap-highlight { background: #f0f7ff; }
.imb-recap-highlight strong { color: #0071e3; font-size: 18px; }

/* ── Signature pad (step 4) ───────────────────────────────────── */
.imb-sig-section { margin-bottom: 22px; }
.imb-sig-wrap {
    position: relative;
    border: 2px solid #d0d0d5;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    cursor: crosshair;
    margin-top: 8px;
}
.imb-sig-canvas {
    display: block;
    width: 100%;
    touch-action: none;
}
.imb-sig-clear {
    position: absolute;
    top: 8px;
    right: 10px;
    background: rgba(255,255,255,.9);
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    color: #666;
    backdrop-filter: blur(4px);
}
.imb-sig-clear:hover { background: #fee; color: #c00; }
.imb-sig-legal {
    font-size: 12px;
    color: #888;
    margin-top: 10px;
    line-height: 1.6;
    background: #fffbe6;
    border-radius: 8px;
    padding: 10px 14px;
}
.imb-sig-wrap:has(.imb-sig-canvas:focus),
.imb-sig-wrap:focus-within { border-color: #0071e3; box-shadow: 0 0 0 3px rgba(0,113,227,.12); }

/* ── Invoice box (step 5) ─────────────────────────────────────── */
.imb-invoice-box {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #f0fff4;
    border: 1.5px solid #28a745;
    border-radius: 12px;
    padding: 16px 20px;
    margin: 18px 0;
    text-align: left;
}
.imb-invoice-icon { font-size: 28px; flex-shrink: 0; }
.imb-invoice-link {
    display: inline-block;
    color: #0071e3;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    margin-top: 4px;
}
.imb-invoice-link:hover { text-decoration: underline; }

/* ── Steps labels (5 steps) ──────────────────────────────────── */
.imb-steps-labels span { font-size: 11px; }
