/* ============================================================================
   Calculadora de Stickers - Estils comuns (.ltw-calc)
   ============================================================================ */

.ltw-calc [hidden] {
    display: none !important;
}

/* Targetes d'opció (contorn, forma, material, efecte, unitats) */
.ltw-calc-option {
    position: relative;
    display: block;
    padding: 0.5rem;
    border-radius: 0.25rem;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.15s, box-shadow 0.15s;
}

.ltw-calc-option:hover {
    background-color: #f3f4f6;
}

.ltw-calc-option.is-selected {
    background-color: #fef2f2;
    box-shadow: 0 0 0 2px #D92644;
}

.ltw-calc-option:has(input:focus-visible) {
    outline: 2px solid #D92644;
    outline-offset: 2px;
}

.ltw-calc-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.ltw-calc-option img {
    display: block;
    width: 100%;
    max-width: 100px;
    aspect-ratio: 1;
    margin: 0 auto;
}

/* Contorn i forma al 80% */
.ltw-calc-option--sm img {
    max-width: 64px;
}

/* El tema estila tots els labels de formulari amb especificitat 0,3,1
   (:is(form, .acfe-form .acfe-form-fields .acf-label) label): el neutralitzem */
.ltw-calc .ltw-calc-step label.ltw-calc-option.ltw-calc-option {
    display: block;
    margin-bottom: 0;
    font-size: inherit;
    font-weight: inherit;
    text-transform: none;
}

.ltw-calc .ltw-calc-step label.ltw-calc-option.ltw-calc-tier {
    display: grid;
}

/* Trams d'unitats (taula: una fila per tram) */
.ltw-calc-tiers {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.ltw-calc-tier {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid #e5e7eb;
    text-align: right;
}

.ltw-calc-tier--head > :first-child,
.ltw-calc-tier__qty {
    text-align: left;
}

.ltw-calc-tier--head {
    padding-top: 0;
    padding-bottom: 0;
    border-color: transparent;
    font-size: 0.75rem;
    color: #6b7280;
}

.ltw-calc-tier__qty {
    font-weight: 700;
    white-space: nowrap;
}

.ltw-calc-tier__unit {
    font-size: 0.875rem;
    color: #6b7280;
    white-space: nowrap;
}

.ltw-calc-tier__ahorro {
    display: inline-block;
    white-space: nowrap;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    background-color: #16a34a;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.4;
}

.ltw-calc-tier__price {
    font-weight: 700;
    white-space: nowrap;
}

/* Fila "Otra cantidad": input dins la mateixa fila (supera l'estil d'inputs del tema, 0,3,1) */
.ltw-calc-tier__qty {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.ltw-calc .ltw-calc-step .ltw-calc-tier input.ltw-calc-tier__input {
    display: inline-block;
    width: calc(7ch + 0.75rem + 4px);
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1.4;
}

/* Buit: prou ample perquè es llegeixi "Otra cantidad" */
.ltw-calc .ltw-calc-step .ltw-calc-tier input.ltw-calc-tier__input:placeholder-shown {
    width: 8rem;
    font-weight: 400;
}

/* Placeholder en negre perquè cridi l'atenció */
.ltw-calc .ltw-calc-step .ltw-calc-tier input.ltw-calc-tier__input::placeholder {
    color: #000;
    opacity: 1;
}

/* Pujada de disseny: caixa per arrossegar i previsualització */
.ltw-calc-upload__box * {
    pointer-events: none; /* sense dragleave en passar per sobre dels fills */
}

.ltw-calc-upload__box.is-dragover {
    border-color: #D92644;
    background-color: #fef2f2;
}

.ltw-calc-upload__preview {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
}

.ltw-calc-upload__thumb {
    flex-shrink: 0;
    width: 5rem;
    height: 5rem;
    object-fit: contain;
    border-radius: 0.25rem;
    background-color: #f3f4f6;
}

.ltw-calc-upload__thumb--file {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #6b7280;
}

.ltw-calc-upload__name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ltw-calc-upload__remove {
    flex-shrink: 0;
    color: #D92644;
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
}

/* Comentaris */
.ltw-calc textarea {
    width: 100%;
    resize: vertical;
}

/* Total */
.ltw-calc-total-detail {
    font-size: 0.875rem;
    color: #6b7280;
}

.ltw-calc-price-message {
    font-size: 0.875rem;
    color: #dc2626;
}
