/* =========================================================
   Imperica Forms — Frontend CSS
   ========================================================= */

/* ── Variables globales ────────────────────────────────── */
.if-multistep-wrap,
.if-cotizador-wrap,
.if-calculadora-wrap {
    --if-accent:      #6366f1;
    --if-radius:      10px;
    --if-border:      #e5e7eb;
    --if-bg-field:    #ffffff;
    --if-text:        #1f2937;
    --if-muted:       #6b7280;
    --if-font:        inherit;
    font-family:      var(--if-font);
    color:            var(--if-text);
    box-sizing:       border-box;
}

*, *::before, *::after { box-sizing: inherit; }

/* ── Botones base ──────────────────────────────────────── */
.if-btn {
    display:         inline-flex;
    align-items:     center;
    justify-content: center;
    gap:             .4em;
    padding:         .65em 1.4em;
    border:          none;
    border-radius:   8px;
    font-size:       1rem;
    font-weight:     600;
    cursor:          pointer;
    text-decoration: none;
    transition:      filter .15s, transform .1s;
    line-height:     1.2;
}
.if-btn:hover  { filter: brightness(1.08); }
.if-btn:active { transform: scale(.97); }

/* =========================================================
   FORMULARIO MULTIPASO
   ========================================================= */

/* Barra de progreso */
.if-progress-bar {
    margin-bottom: 2rem;
}

.if-step-dots {
    display:     flex;
    align-items: center;
    gap:         0;
}

.if-step-dot {
    display:        flex;
    flex-direction: column;
    align-items:    center;
    gap:            .3rem;
    flex-shrink:    0;
}

.if-dot-num {
    width:           2rem;
    height:          2rem;
    border-radius:   50%;
    border:          2px solid var(--if-border);
    background:      #ffffff;
    display:         flex;
    align-items:     center;
    justify-content: center;
    font-size:       .8rem;
    font-weight:     700;
    transition:      background .2s, border-color .2s, color .2s;
    color:           var(--if-muted);
}

.if-step-dot.is-active .if-dot-num,
.if-step-dot.is-done   .if-dot-num {
    background:   var(--if-accent);
    border-color: var(--if-accent);
    color:        #fff;
}

.if-dot-label {
    font-size:   .72rem;
    color:       var(--if-muted);
    white-space: nowrap;
    font-weight: 500;
}

.if-step-dot.is-active .if-dot-label { color: var(--if-accent); font-weight: 700; }

.if-progress-track {
    flex:           1;
    height:         3px;
    background:     var(--if-border);
    border-radius:  2px;
    overflow:       hidden;
    margin:         0 .25rem;
    margin-bottom:  1.2rem;
}

.if-progress-fill {
    height:     100%;
    width:      0%;
    background: var(--if-accent);
    transition: width .3s ease;
}

/* Campos */
.if-fields-grid {
    display:   flex;
    flex-wrap: wrap;
    gap:       1rem;
    margin-bottom: 1.5rem;
}

.if-field {
    display:        flex;
    flex-direction: column;
    gap:            .4rem;
    min-width:      0;
}

.if-field label {
    font-size:   .875rem;
    font-weight: 600;
    color:       var(--if-text);
}

.if-required { color: #ef4444; margin-left: .15em; }

.if-field input:not([type="radio"]):not([type="checkbox"]),
.if-field textarea,
.if-field select {
    width:         100%;
    padding:       .6rem .85rem;
    border:        1.5px solid var(--if-border);
    border-radius: 8px;
    background:    var(--if-bg-field);
    font-size:     1rem;
    color:         var(--if-text);
    transition:    border-color .15s, box-shadow .15s;
    appearance:    auto;
}

.if-field textarea { resize: vertical; min-height: 90px; }

.if-radio-group {
    display:   flex;
    flex-wrap: wrap;
    gap:       .6rem;
}

.if-radio-label,
.if-checkbox-label {
    display:     flex;
    align-items: center;
    gap:         .4rem;
    font-size:   .9rem;
    cursor:      pointer;
}

/* Navegación de pasos */
.if-step-nav {
    display:         flex;
    justify-content: space-between;
    align-items:     center;
    gap:             1rem;
    flex-wrap:       wrap;
}

.if-btn-prev {
    background: #f3f4f6;
    color:      var(--if-text);
}
.if-btn-prev:hover { filter: brightness(.95); }

.if-btn-next,
.if-btn-submit {
    background: var(--if-accent);
    color:      #fff;
    margin-left: auto;
}

/* Mensajes */
.if-success {
    padding:       1.5rem;
    background:    #f0fdf4;
    border:        1px solid #bbf7d0;
    border-radius: var(--if-radius);
    color:         #15803d;
    font-weight:   600;
    text-align:    center;
}

.if-error {
    padding:       1rem;
    background:    #fef2f2;
    border:        1px solid #fecaca;
    border-radius: var(--if-radius);
    color:         #b91c1c;
}

/* =========================================================
   COTIZADOR
   ========================================================= */

.if-cot-header {
    margin-bottom: 1.5rem;
}

.if-cot-title {
    font-size:     1.5rem;
    font-weight:   700;
    margin:        0 0 .4rem;
    line-height:   1.2;
}

.if-cot-subtitle {
    font-size:  .95rem;
    color:      var(--if-muted);
    margin:     0;
}

.if-cot-items {
    display:   flex;
    flex-wrap: wrap;
    gap:       .75rem;
    margin-bottom: 1.25rem;
}

.if-cot-item {
    display:         flex;
    align-items:     center;
    gap:             1rem;
    padding:         .9rem 1.1rem;
    background:      #ffffff;
    border:          1.5px solid var(--if-border);
    border-radius:   var(--if-radius);
    flex:            1 1 calc(50% - .4rem);
    min-width:       260px;
    cursor:          pointer;
    transition:      border-color .15s, box-shadow .15s;
}

@media (max-width: 600px) {
    .if-cot-item { flex: 1 1 100%; }
}

.if-cot-item:hover { border-color: var(--if-accent); }

.if-cot-item.is-selected {
    border-color: var(--if-accent);
    box-shadow:   0 0 0 3px color-mix(in srgb, var(--if-accent) 15%, transparent);
}

.if-cot-item-info { flex: 1; min-width: 0; }

.if-cot-item-name {
    font-weight: 600;
    font-size:   .95rem;
}

.if-cot-item-desc {
    font-size: .8rem;
    color:     var(--if-muted);
    margin-top: .15rem;
}

.if-cot-checkbox { width: 1.1rem; height: 1.1rem; accent-color: var(--if-accent); cursor: pointer; flex-shrink: 0; }

.if-qty-wrap {
    display:     flex;
    align-items: center;
    gap:         .3rem;
}

.if-qty-btn {
    width:           2rem;
    height:          2rem;
    border:          1.5px solid var(--if-border);
    border-radius:   6px;
    background:      #f9fafb;
    font-size:       1.1rem;
    line-height:     1;
    cursor:          pointer;
    display:         flex;
    align-items:     center;
    justify-content: center;
    transition:      background .1s;
}
.if-qty-btn:hover { background: #e5e7eb; }

.if-qty-input {
    width:       3.5rem;
    text-align:  center;
    padding:     .3rem .4rem;
    border:      1.5px solid var(--if-border);
    border-radius: 6px;
    font-size:   .9rem;
}

.if-qty-select {
    padding:       .4rem .6rem;
    border:        1.5px solid var(--if-border);
    border-radius: 6px;
    font-size:     .85rem;
    background:    #fff;
}

.if-cot-item-price {
    text-align:  right;
    flex-shrink: 0;
}

.if-item-unit-price {
    display:     block;
    font-size:   .8rem;
    color:       var(--if-muted);
}

.if-item-subtotal {
    display:     block;
    font-size:   1rem;
    font-weight: 700;
    color:       var(--if-accent);
}

/* Panel de total */
.if-cot-total-panel {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    flex-wrap:       wrap;
    gap:             1rem;
    padding:         1.25rem 1.5rem;
    background:      var(--if-accent);
    border-radius:   var(--if-radius);
    color:           #fff;
    margin-bottom:   .75rem;
}

.if-cot-total-row {
    display:        flex;
    flex-direction: column;
    gap:            .15rem;
}

.if-cot-total-label { font-size: .85rem; opacity: .85; }

.if-cot-total-amount {
    font-size:   1.75rem;
    font-weight: 800;
    line-height: 1;
}

.if-cot-cta {
    padding:    .75em 1.6em;
    background: #fff;
    color:      var(--if-accent);
    border-radius: 8px;
    font-weight:   700;
    text-decoration: none;
    transition: filter .15s;
    white-space: nowrap;
}
.if-cot-cta:hover { filter: brightness(.95); }

.if-cot-disclaimer {
    font-size: .78rem;
    color:     var(--if-muted);
    margin:    0;
}

/* =========================================================
   CALCULADORA
   ========================================================= */

.if-calc-header {
    margin-bottom: 1.5rem;
}

.if-calc-title {
    font-size:   1.5rem;
    font-weight: 700;
    margin:      0 0 .4rem;
    line-height: 1.2;
}

.if-calc-subtitle {
    font-size: .95rem;
    color:     var(--if-muted);
    margin:    0;
}

.if-calc-inputs {
    display:   flex;
    flex-wrap: wrap;
    gap:       1.25rem;
    margin-bottom: 1.5rem;
}

.if-calc-field {
    flex:      1 1 calc(50% - .65rem);
    min-width: 220px;
}

@media (max-width: 500px) {
    .if-calc-field { flex: 1 1 100%; }
}

.if-calc-field-header {
    display:         flex;
    justify-content: space-between;
    align-items:     baseline;
    margin-bottom:   .4rem;
}

.if-calc-label {
    font-size:   .875rem;
    font-weight: 600;
    color:       var(--if-text);
}

.if-calc-value-display {
    font-size:   .9rem;
    font-weight: 700;
    color:       var(--if-accent);
}

.if-calc-unit { font-weight: 400; color: var(--if-muted); }

.if-calc-slider {
    width:          100%;
    accent-color:   var(--if-accent);
    cursor:         pointer;
    height:         6px;
    border-radius:  3px;
}

.if-calc-number {
    width:         100%;
    padding:       .55rem .8rem;
    border:        1.5px solid var(--if-border);
    border-radius: 8px;
    font-size:     1rem;
    color:         var(--if-text);
    background:    #fff;
}
.if-calc-number:focus { outline: none; border-color: var(--if-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--if-accent) 15%, transparent); }

.if-calc-select {
    width:         100%;
    padding:       .55rem .8rem;
    border:        1.5px solid var(--if-border);
    border-radius: 8px;
    font-size:     1rem;
    color:         var(--if-text);
    background:    #fff;
    cursor:        pointer;
}
.if-calc-select:focus { outline: none; border-color: var(--if-accent); }

/* Panel de resultado */
.if-calc-result-panel {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    flex-wrap:       wrap;
    gap:             1rem;
    padding:         1.25rem 1.5rem;
    background:      var(--if-accent);
    border-radius:   var(--if-radius);
    color:           #fff;
    margin-bottom:   .75rem;
}

.if-calc-result-row {
    display:        flex;
    flex-direction: column;
    gap:            .15rem;
}

.if-calc-result-label { font-size: .85rem; opacity: .85; }

.if-calc-result-value {
    font-size:   1.75rem;
    font-weight: 800;
    line-height: 1;
}

.if-calc-cta {
    padding:         .75em 1.6em;
    background:      #fff;
    color:           var(--if-accent);
    border-radius:   8px;
    font-weight:     700;
    text-decoration: none;
    transition:      filter .15s;
    white-space:     nowrap;
}
.if-calc-cta:hover { filter: brightness(.95); }

.if-calc-disclaimer {
    font-size: .78rem;
    color:     var(--if-muted);
    margin:    0;
}
