/* ============================================================
   RUXE'KAQAW — Átomos de formulario (checkout, mayorista, admin)
   Tokens y contrastes validados AA/AAA sobre la paleta oscura.
   ============================================================ */
:root {
    --surface-card: #232323;
    --field-bg: #1A1A1A;
    --field-bg-hover: #202020;
    --field-border: #847B6B;        /* 4.17:1 vs #1A1A1A (SC 1.4.11 ok) */
    --field-border-hover: #A79C88;
    --field-text: #f4f4f4;
    --state-error: #E8859A;         /* tinto de marca aclarado — 6.18:1 en card */
    --state-error-bg: #331A20;
    --state-error-field: #1F1518;
    --state-success: #7ECEBA;       /* lake-green aclarado — 8.55:1 en card */
    --state-success-bg: #16302B;
    --disabled-bg: #332F2A;
    --disabled-text: #A39C90;
    --disabled-border: #4A443C;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

:focus-visible {
    outline: 2px solid var(--wild-honey, #E8B84E);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .anim-fade { opacity: 1 !important; transform: none !important; }
}

/* ---- Campo ---- */
.ruxe-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 24px;
}

.ruxe-label {
    font-weight: 600;
    font-size: 14px;
    line-height: 1.3;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #f4f4f4;
}

.ruxe-label .req {
    color: var(--wild-honey, #E8B84E);
    margin-left: 4px;
}

.ruxe-input,
.ruxe-select,
.ruxe-textarea {
    width: 100%;
    min-height: 52px;
    padding: 0 16px;
    font-family: inherit;
    font-size: 16px; /* <16px dispara zoom automático en iOS */
    line-height: 1.5;
    color: var(--field-text);
    background: var(--field-bg);
    border: 1px solid var(--field-border);
    border-radius: 8px;
    appearance: none;
    -webkit-appearance: none;
    transition: border-color 150ms cubic-bezier(0.4, 0, 0.2, 1), background 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

.ruxe-textarea {
    min-height: 128px;
    padding: 14px 16px;
    line-height: 1.6;
    resize: vertical;
}

.ruxe-input::placeholder,
.ruxe-textarea::placeholder {
    color: #999999;
    opacity: 1;
}

.ruxe-input:hover:not(:disabled),
.ruxe-select:hover:not(:disabled),
.ruxe-textarea:hover:not(:disabled) {
    border-color: var(--field-border-hover);
    background: var(--field-bg-hover);
}

.ruxe-input:focus-visible,
.ruxe-select:focus-visible,
.ruxe-textarea:focus-visible {
    border-color: var(--wild-honey, #E8B84E);
    background: var(--field-bg-hover);
}

.ruxe-input.is-error,
.ruxe-select.is-error {
    border-color: var(--state-error);
    background: var(--state-error-field);
}

.ruxe-input.is-error:focus-visible {
    outline-color: var(--state-error);
}

.ruxe-input:disabled,
.ruxe-select:disabled {
    background: var(--disabled-bg);
    border-color: var(--disabled-border);
    color: var(--disabled-text);
    cursor: not-allowed;
}

/* Autofill de Chrome pinta celeste y rompe el tema oscuro. */
.ruxe-input:-webkit-autofill,
.ruxe-input:-webkit-autofill:hover,
.ruxe-input:-webkit-autofill:focus {
    -webkit-text-fill-color: #f4f4f4;
    -webkit-box-shadow: 0 0 0 1000px var(--field-bg) inset;
    caret-color: #f4f4f4;
    transition: background-color 9999s ease-in-out 0s;
}

/* Select: chevron propio (appearance:none mata el nativo). */
.ruxe-select {
    padding-right: 44px;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23E8B84E' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-position: right 16px center;
    background-repeat: no-repeat;
}

.ruxe-select option {
    background: #232323;
    color: #f4f4f4; /* sin esto el popup en Windows sale blanco sobre blanco */
}

/* ---- Mensajes ---- */
.ruxe-error {
    display: flex;
    gap: 6px;
    align-items: flex-start;
    margin: 0;
    font-weight: 500;
    font-size: 14px;
    line-height: 1.45;
    color: var(--state-error);
}

.ruxe-error svg { flex: none; margin-top: 1px; }

.ruxe-hint {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: #cccccc;
}

.ruxe-note {
    margin: 0 0 24px;
    padding: 14px 16px;
    font-size: 14px;
    line-height: 1.55;
    color: #cccccc;
    background: #1F1F1F;
    border: 1px solid rgba(232, 184, 78, 0.18);
    border-left: 3px solid var(--wild-honey, #E8B84E);
    border-radius: 8px;
}

.ruxe-banner {
    max-width: 1120px;
    margin: 0 auto 24px;
    padding: 16px 20px;
    border-radius: 8px;
    font-size: 16px;
    line-height: 1.5;
}

.ruxe-banner--error {
    background: var(--state-error-bg);
    border: 1px solid rgba(232, 133, 154, 0.35);
    border-left: 3px solid var(--state-error);
    color: #f4f4f4;
}

.ruxe-banner--success {
    background: var(--state-success-bg);
    border: 1px solid rgba(126, 206, 186, 0.35);
    border-left: 3px solid var(--state-success);
    color: #f4f4f4;
}

.ruxe-banner-link {
    display: inline-block;
    margin-left: 8px;
    color: var(--wild-honey, #E8B84E);
    text-decoration: underline;
}

/* ---- Grupos ---- */
.ruxe-group {
    border: none;
    padding: 0;
    margin: 0 0 40px;
    min-width: 0;
}

.ruxe-legend {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 20px;
    font-weight: 700;
    color: #f4f4f4;
    padding-bottom: 12px;
    margin: 0 0 24px;
    border-bottom: 1px solid rgba(232, 184, 78, 0.22);
}

.ruxe-step {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    flex: none;
    border: 1px solid rgba(232, 184, 78, 0.45);
    border-radius: 50%;
    color: var(--wild-honey, #E8B84E);
    font-family: 'Montserrat', sans-serif;
    font-size: 15px;
    font-weight: 700;
}

.ruxe-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 24px;
}

@media (max-width: 640px) {
    .ruxe-row { grid-template-columns: 1fr; gap: 0; }
}

/* ---- Honeypot: fuera de pantalla, jamás display:none (los bots lo saltan) ---- */
.hp-field {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}
