/* ═══════════════════════════════════════════════════
   Crezko Product Personalizer — Frontend Styles
   ═══════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════
   FIX: Woostify + Elementor — form.cart usa display:flex
   y nuestro bloque se convierte en un flex-item lateral.
   Lo forzamos a ocupar el 100% y a ordenarse primero.
   ═══════════════════════════════════════════════════ */

/* Aseguramos flex-wrap en todos los contextos */
.elementor-add-to-cart form.cart,
.elementor-add-to-cart .cart,
form.cart {
    flex-wrap: wrap !important;
}

/* Ocupa fila completa y sube al inicio */
form.cart .crezko-personalizer {
    order: -1 !important;
    flex: 0 0 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
}

/* Cantidad y botón vuelven a compartir su propia fila */
form.cart .quantity {
    order: 1;
}
form.cart .single_add_to_cart_button,
form.cart button[type="submit"] {
    order: 2;
}

/* ── Contenedor principal ── */
.crezko-personalizer {
    margin: 0 0 20px;
    padding: 20px 22px;
    background: #fafafa;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
}

.crezko-personalizer__heading {
    font-size: 0.75em;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #888;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e8e8e8;
}

/* ── Cada campo ── */
.crezko-field {
    margin-bottom: 16px;
}
.crezko-field:last-child {
    margin-bottom: 0;
}

/* ── Etiquetas ── */
.crezko-label {
    display: block;
    font-size: 0.78em;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #444;
    margin-bottom: 6px;
}

.crezko-label--sub {
    margin-top: 14px;
    color: #666;
}

.crezko-req {
    color: #c0392b;
    margin-left: 2px;
}

/* ── Inputs de texto ── */
.crezko-input,
.crezko-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.95em;
    line-height: 1.5;
    background: #fff;
    color: #333;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

.crezko-input:focus,
.crezko-textarea:focus {
    border-color: #888;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0,0,0,.08);
}

.crezko-input--error,
.crezko-textarea--error {
    border-color: #c0392b !important;
    box-shadow: 0 0 0 2px rgba(192,57,43,.12) !important;
}

/* ── Subir archivo ── */
.crezko-file {
    width: 100%;
}

.crezko-file__row {
    display: flex;
    align-items: stretch;
    border: 1px solid #ddd;
    border-radius: 5px;
    overflow: hidden;
    background: #fff;
}

.crezko-file__name {
    flex: 1;
    padding: 10px 14px;
    font-size: 0.88em;
    color: #999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    align-self: center;
}

.crezko-file__name--loaded {
    color: #333;
    font-weight: 500;
}

.crezko-file__btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    padding: 0 18px;
    background: #333;
    color: #fff !important;
    font-size: 0.82em;
    font-weight: 700;
    letter-spacing: 0.05em;
    cursor: pointer;
    text-transform: uppercase;
    transition: background 0.2s;
    border: none;
    margin: 0;
    line-height: 1;
    min-height: 42px;
}

.crezko-file__btn:hover {
    background: #555;
    color: #fff !important;
}

.crezko-file--error .crezko-file__row {
    border-color: #c0392b;
    box-shadow: 0 0 0 2px rgba(192,57,43,.12);
}

/* ── Barra de progreso ── */
.crezko-file__progress {
    margin-top: 8px;
}

.crezko-progress {
    height: 3px;
    background: #eee;
    border-radius: 3px;
    overflow: hidden;
}

.crezko-progress__bar {
    height: 100%;
    width: 0;
    background: #555;
    border-radius: 3px;
    transition: width 0.3s;
}

.crezko-progress__bar--done {
    background: #27ae60;
}

.crezko-file__status {
    display: block;
    font-size: 0.8em;
    color: #888;
    margin-top: 5px;
}

.crezko-file__status--error {
    color: #c0392b;
}

/* ── Preview de imagen ── */
.crezko-file__preview {
    margin-top: 10px;
}

.crezko-file__preview img {
    max-width: 100px;
    max-height: 100px;
    border-radius: 4px;
    border: 1px solid #ddd;
    object-fit: cover;
    display: block;
}

/* ── Mensaje de validación ── */
.crezko-validation-notice {
    background: #fdf3f2;
    border: 1px solid #f5c6c2;
    border-left: 4px solid #c0392b;
    border-radius: 4px;
    padding: 10px 14px;
    margin-bottom: 14px;
    font-size: 0.9em;
    color: #7b241c;
}
