/* ============================================================
   Auto Cambios WC — Form público moderno (cards con acentos)
   ============================================================ */

:root {
	--acw-f-accent: #6366f1;        /* indigo-500 */
	--acw-f-accent-hover: #4f46e5;  /* indigo-600 */
	--acw-f-accent-light: #eef2ff;  /* indigo-50 */
	--acw-f-accent-border: #c7d2fe; /* indigo-200 */
	--acw-f-text: #111827;
	--acw-f-text-muted: #6b7280;
	--acw-f-text-light: #9ca3af;
	--acw-f-border: #e5e7eb;
	--acw-f-border-strong: #d1d5db;
	--acw-f-bg: #f9fafb;
	--acw-f-surface: #ffffff;
	--acw-f-success: #059669;
	--acw-f-success-bg: #d1fae5;
	--acw-f-danger: #dc2626;
	--acw-f-danger-bg: #fee2e2;
	--acw-f-warning: #b45309;
	--acw-f-warning-bg: #fef3c7;
	--acw-f-shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
	--acw-f-shadow: 0 4px 12px rgba(0,0,0,0.06);
	--acw-f-shadow-lg: 0 12px 28px rgba(0,0,0,0.08);
	--acw-f-radius: 12px;
	--acw-f-radius-sm: 8px;
}

.acw-form-wrap {
	max-width: 720px;
	margin: 32px auto;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
	color: var(--acw-f-text);
	-webkit-font-smoothing: antialiased;
}

/* Garantizar que padding/border no inflen el ancho dentro del form (evita
   overflow horizontal en mobile con CBUs largos, datos bancarios, etc.) */
.acw-form-wrap,
.acw-form-wrap *,
.acw-form-wrap *::before,
.acw-form-wrap *::after {
	box-sizing: border-box;
}

.acw-branding {
	margin-top: 14px;
	text-align: center;
	font-size: 12px;
	color: var(--acw-f-text-muted);
	letter-spacing: 0.2px;
}
.acw-branding a {
	color: var(--acw-f-text-muted);
	text-decoration: none;
	border-bottom: 1px dotted currentColor;
}
.acw-branding a:hover {
	color: var(--acw-f-accent);
	border-bottom-color: var(--acw-f-accent);
}

.acw-form {
	background: var(--acw-f-surface);
	border-radius: var(--acw-f-radius);
	box-shadow: var(--acw-f-shadow);
	padding: 32px;
	border: 1px solid var(--acw-f-border);
}

/* === Progress indicator === */
.acw-progress {
	display: flex;
	gap: 8px;
	margin-bottom: 28px;
}

.acw-progress-dot {
	flex: 1;
	height: 4px;
	border-radius: 4px;
	background: var(--acw-f-border);
	transition: background 0.3s;
}

.acw-progress-dot.is-done {
	background: var(--acw-f-accent);
}

.acw-progress-dot.is-active {
	background: var(--acw-f-accent);
}

/* === Headings === */
.acw-form h2 {
	margin: 0 0 8px;
	font-size: 22px;
	font-weight: 700;
	letter-spacing: -0.02em;
	color: var(--acw-f-text);
}

.acw-help {
	color: var(--acw-f-text-muted);
	font-size: 14px;
	margin: 0 0 24px;
	line-height: 1.5;
}

/* === Step animation === */
.acw-step {
	animation: acw-fade 0.25s ease;
}

@keyframes acw-fade {
	from { opacity: 0; transform: translateY(6px); }
	to   { opacity: 1; transform: none; }
}

/* === Radio cards (tipo cambio/devolución) === */
.acw-tipo-options {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
	margin-bottom: 24px;
}

.acw-radio-card {
	display: block;
	cursor: pointer;
	border: 1.5px solid var(--acw-f-border);
	border-radius: var(--acw-f-radius-sm);
	padding: 18px;
	background: var(--acw-f-surface);
	transition: all 0.15s;
	position: relative;
}

.acw-radio-card:hover {
	border-color: var(--acw-f-border-strong);
	background: var(--acw-f-bg);
}

.acw-radio-card input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.acw-radio-card:has(input:checked) {
	border-color: var(--acw-f-accent);
	background: var(--acw-f-accent-light);
	box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.08);
}

.acw-radio-content strong {
	display: block;
	font-size: 16px;
	font-weight: 600;
	margin-bottom: 4px;
	color: var(--acw-f-text);
}

.acw-radio-content small {
	color: var(--acw-f-text-muted);
	font-size: 13px;
	line-height: 1.4;
}

/* === Form inputs === */
.acw-grid-2 {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px 14px;
	margin-bottom: 20px;
}

.acw-grid-2 label {
	display: block;
	font-size: 13px;
}

.acw-grid-2 span {
	display: block;
	margin-bottom: 6px;
	color: var(--acw-f-text);
	font-weight: 500;
	font-size: 13px;
}

.acw-grid-2 input,
.acw-grid-2 textarea {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid var(--acw-f-border-strong);
	border-radius: var(--acw-f-radius-sm);
	font-size: 14px;
	box-sizing: border-box;
	background: var(--acw-f-surface);
	transition: border-color 0.15s, box-shadow 0.15s;
	color: var(--acw-f-text);
	font-family: inherit;
}

.acw-grid-2 input:focus,
.acw-grid-2 textarea:focus {
	outline: none;
	border-color: var(--acw-f-accent);
	box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.acw-grid-2 input::placeholder,
.acw-grid-2 textarea::placeholder {
	color: var(--acw-f-text-light);
}

.acw-col-span { grid-column: 1 / -1; }

/* === Product picker === */
.acw-product-picker {
	position: relative;
	margin-bottom: 18px;
}

.acw-search-input {
	width: 100%;
	padding: 12px 14px;
	border: 1px solid var(--acw-f-border-strong);
	border-radius: var(--acw-f-radius-sm);
	font-size: 14px;
	box-sizing: border-box;
	background: var(--acw-f-surface);
	transition: border-color 0.15s, box-shadow 0.15s;
	font-family: inherit;
}

.acw-search-input:focus {
	outline: none;
	border-color: var(--acw-f-accent);
	box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.acw-search-results {
	position: absolute;
	top: calc(100% + 4px);
	left: 0;
	right: 0;
	z-index: 20;
	background: var(--acw-f-surface);
	border: 1px solid var(--acw-f-border);
	border-radius: var(--acw-f-radius-sm);
	max-height: 320px;
	overflow-y: auto;
	box-shadow: var(--acw-f-shadow-lg);
}

.acw-result-item {
	padding: 12px 14px;
	cursor: pointer;
	border-bottom: 1px solid #f3f4f6;
	font-size: 13px;
	transition: background 0.12s;
	position: relative;
}

.acw-result-item:last-child {
	border-bottom: none;
}

.acw-result-item:hover {
	background: var(--acw-f-bg);
}

.acw-result-item.acw-disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.acw-result-item strong {
	display: block;
	color: var(--acw-f-text);
	font-weight: 600;
	margin-bottom: 2px;
	padding-right: 80px;
}

.acw-result-item small {
	color: var(--acw-f-text-muted);
	font-size: 12px;
}

.acw-result-item .acw-result-stock {
	position: absolute;
	top: 12px;
	right: 14px;
	font-size: 11px;
	padding: 3px 8px;
	border-radius: 12px;
	background: var(--acw-f-success-bg);
	color: var(--acw-f-success);
	font-weight: 600;
}

.acw-result-item.acw-disabled .acw-result-stock {
	background: var(--acw-f-danger-bg);
	color: var(--acw-f-danger);
}

/* === Selected product chip === */
.acw-selected-product {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 16px;
	background: var(--acw-f-accent-light);
	border: 1px solid var(--acw-f-accent-border);
	border-radius: var(--acw-f-radius-sm);
	margin-top: 8px;
}

/* Forzar que el atributo HTML [hidden] se respete dentro del form, sin
   importar el display que tengan los elementos. Sin esto, divs con
   display: flex/grid quedan visibles aunque tengan hidden="true". */
.acw-form-wrap [hidden] {
	display: none !important;
}

.acw-selected-info {
	flex: 1;
}

.acw-selected-info strong {
	display: block;
	color: var(--acw-f-text);
	font-size: 14px;
	font-weight: 600;
}

.acw-selected-info small {
	color: var(--acw-f-text-muted);
	font-size: 12px;
}

.acw-clear-selection {
	background: transparent;
	border: none;
	font-size: 22px;
	cursor: pointer;
	color: var(--acw-f-text-muted);
	padding: 0 4px;
	line-height: 1;
	border-radius: 4px;
	transition: background 0.12s, color 0.12s;
}

.acw-clear-selection:hover {
	background: rgba(0,0,0,0.05);
	color: var(--acw-f-text);
}

/* === Order items === */
.acw-order-items-grid {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin: 8px 0 16px;
}

.acw-order-item-card {
	display: flex;
	align-items: center;
	gap: 12px;
	cursor: pointer;
	border: 1.5px solid var(--acw-f-border);
	border-radius: var(--acw-f-radius-sm);
	padding: 12px 14px;
	background: var(--acw-f-surface);
	transition: all 0.15s;
}

.acw-order-item-card:hover {
	border-color: var(--acw-f-border-strong);
	background: var(--acw-f-bg);
}

.acw-order-item-card input {
	flex-shrink: 0;
	accent-color: var(--acw-f-accent);
}

.acw-order-item-card:has(input:checked) {
	border-color: var(--acw-f-accent);
	background: var(--acw-f-accent-light);
}

.acw-item-thumb {
	width: 56px;
	height: 56px;
	object-fit: cover;
	border-radius: 6px;
	flex-shrink: 0;
	border: 1px solid var(--acw-f-border);
}

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

.acw-item-info strong {
	display: block;
	font-size: 14px;
	font-weight: 600;
	margin-bottom: 2px;
	color: var(--acw-f-text);
}

.acw-item-info small {
	display: block;
	color: var(--acw-f-text-muted);
	font-size: 12px;
}

.acw-item-info .acw-item-price {
	color: var(--acw-f-text);
	font-weight: 500;
	margin-top: 4px;
}

/* === Sucursal cards === */
.acw-sucursal-options {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin: 12px 0 20px;
	max-height: 420px;
	overflow-y: auto;
	padding: 2px;
}

.acw-sucursal-card {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	cursor: pointer;
	border: 1.5px solid var(--acw-f-border);
	border-radius: var(--acw-f-radius-sm);
	padding: 14px 16px;
	background: var(--acw-f-surface);
	transition: all 0.15s;
}

.acw-sucursal-card:hover {
	border-color: var(--acw-f-border-strong);
	background: var(--acw-f-bg);
}

.acw-sucursal-card input {
	margin-top: 3px;
	flex-shrink: 0;
	accent-color: var(--acw-f-accent);
}

.acw-sucursal-card:has(input:checked) {
	border-color: var(--acw-f-accent);
	background: var(--acw-f-accent-light);
	box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.08);
}

.acw-sucursal-content {
	flex: 1;
}

.acw-sucursal-content strong {
	display: block;
	font-size: 14px;
	font-weight: 600;
	margin-bottom: 4px;
	color: var(--acw-f-text);
}

.acw-sucursal-content small {
	color: var(--acw-f-text-muted);
	font-size: 12px;
	line-height: 1.4;
}

/* === Preventa warning === */
.acw-preventa-warning {
	margin-top: 14px;
	padding: 12px 14px;
	background: var(--acw-f-warning-bg);
	color: var(--acw-f-warning);
	border-radius: var(--acw-f-radius-sm);
	font-size: 13px;
	line-height: 1.5;
	border: 1px solid #fde68a;
}

/* === Acciones (botones) === */
.acw-actions {
	display: flex;
	gap: 12px;
	justify-content: flex-end;
	margin-top: 28px;
}

.acw-btn,
.acw-btn-secondary {
	padding: 12px 22px;
	border: none;
	border-radius: var(--acw-f-radius-sm);
	cursor: pointer;
	font-size: 14px;
	font-weight: 600;
	transition: all 0.15s;
	font-family: inherit;
}

.acw-btn {
	background: var(--acw-f-accent);
	color: #fff;
	box-shadow: 0 2px 4px rgba(99, 102, 241, 0.2);
}

.acw-btn:hover:not(:disabled) {
	background: var(--acw-f-accent-hover);
	transform: translateY(-1px);
	box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

.acw-btn:active:not(:disabled) {
	transform: translateY(0);
}

.acw-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
	box-shadow: none;
}

.acw-btn-secondary {
	background: var(--acw-f-surface);
	color: var(--acw-f-text);
	border: 1px solid var(--acw-f-border-strong);
}

.acw-btn-secondary:hover {
	background: var(--acw-f-bg);
}

/* === Quote / cotización === */
#acw-quote-result {
	padding: 24px;
	background: var(--acw-f-bg);
	border-radius: var(--acw-f-radius-sm);
	border: 1px solid var(--acw-f-border);
	margin-bottom: 20px;
}

#acw-quote-result h3 {
	margin: 0 0 14px;
	font-size: 14px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--acw-f-text-muted);
}

.acw-quote-line {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 10px 0;
	font-size: 14px;
	color: var(--acw-f-text);
}

.acw-quote-line strong {
	font-weight: 600;
}

.acw-quote-total {
	font-size: 18px;
	font-weight: 700;
	border-top: 1px solid var(--acw-f-border);
	margin-top: 8px;
	padding-top: 16px;
	color: var(--acw-f-text);
}

.acw-quote-total strong {
	color: var(--acw-f-accent);
	font-size: 20px;
}

.acw-quote-error {
	color: var(--acw-f-danger);
	padding: 14px 16px;
	background: var(--acw-f-danger-bg);
	border-radius: var(--acw-f-radius-sm);
	font-size: 14px;
}

/* === Bank details === */
.acw-bank-details {
	background: var(--acw-f-surface);
	border: 1px solid var(--acw-f-border);
	border-radius: var(--acw-f-radius-sm);
	padding: 18px 20px;
	margin: 18px 0;
}

.acw-bank-details h3 {
	margin: 0 0 12px;
	font-size: 14px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--acw-f-text-muted);
}

.acw-bank-details p {
	margin: 6px 0;
	font-size: 14px;
	color: var(--acw-f-text);
	display: flex;
	gap: 8px;
}

.acw-bank-details p strong {
	min-width: 70px;
	color: var(--acw-f-text-muted);
	font-weight: 500;
}

.acw-bank-details code {
	background: var(--acw-f-bg);
	padding: 2px 8px;
	border-radius: 4px;
	font-size: 13px;
	color: var(--acw-f-text);
	border: 1px solid var(--acw-f-border);
	font-family: 'SF Mono', Monaco, 'Cascadia Mono', 'Roboto Mono', Consolas, monospace;
	/* CBUs (22 dígitos) y alias largos: permitir wrap dentro del badge para
	   que no se escapen del card en mobile. */
	word-break: break-all;
	overflow-wrap: anywhere;
	display: inline-block;
	max-width: 100%;
}

/* === Success box === */
.acw-success-box {
	padding: 32px 24px;
	text-align: center;
	background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
	border-radius: var(--acw-f-radius-sm);
	border: 1px solid #a7f3d0;
}

.acw-success-box h2 {
	color: var(--acw-f-success);
	margin: 0 0 12px;
	font-size: 24px;
}

.acw-success-box p {
	color: var(--acw-f-text);
	font-size: 15px;
	line-height: 1.5;
	margin: 8px 0;
}

/* === Responsive === */
@media (max-width: 640px) {
	.acw-form-wrap { margin: 16px; }
	.acw-form { padding: 18px; border-radius: var(--acw-f-radius-sm); }
	.acw-grid-2 { grid-template-columns: 1fr; }
	.acw-tipo-options { grid-template-columns: 1fr; }
	.acw-actions { flex-direction: column-reverse; }
	.acw-btn, .acw-btn-secondary { width: 100%; }

	/* Paso 5 (cotización + datos bancarios): reducir paddings internos para
	   ganar ancho útil en pantallas chicas y prevenir overflow horizontal. */
	#acw-quote-result { padding: 16px; }
	.acw-bank-details { padding: 14px 16px; }

	/* Datos bancarios: apilar label + valor en lugar de flex horizontal.
	   Con CBU de 22 dígitos el flex horizontal forzaba overflow del card. */
	.acw-bank-details p {
		flex-direction: column;
		align-items: flex-start;
		gap: 4px;
	}
	.acw-bank-details p strong {
		min-width: 0;
	}

	/* Bloques de aviso (upload comprobante, no-payment-needed) y cualquier
	   contenido del step pueden tener strings largos sin espacios. */
	.acw-step,
	.acw-step p,
	.acw-step small,
	.acw-step .acw-quote-line,
	.acw-step .acw-quote-line strong {
		overflow-wrap: anywhere;
		word-break: break-word;
	}

	/* Inputs y textareas full-width sin scroll horizontal */
	.acw-step input,
	.acw-step textarea,
	.acw-step select {
		max-width: 100%;
	}
}
