/**
 * QP Quote Page — Estilos
 *
 * Tabla de productos + formulario de contacto.
 * Prefijo: .qp- — Colores QP: azul #1a3a5c, naranja #F5A623
 */

/* ================================================================
   SECCIONES
   ================================================================ */

.qp-quote-section {
	margin-bottom: 40px;
}

.qp-section-title {
	font-size: 1.4em;
	font-weight: 700;
	color: #1a3a5c;
	margin-bottom: 20px;
	padding-bottom: 10px;
	border-bottom: 2px solid #F5A623;
}

/* ================================================================
   ESTADO VACÍO
   ================================================================ */

.qp-quote-empty {
	text-align: center;
	padding: 60px 20px;
}

.qp-quote-empty h3 {
	font-size: 1.3em;
	color: #333333;
	margin: 16px 0 8px;
}

.qp-quote-empty p {
	color: #666666;
	margin-bottom: 24px;
}

/* ================================================================
   BOTONES
   ================================================================ */

.qp-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 12px 24px;
	border-radius: 4px;
	font-size: 1em;
	font-weight: 600;
	font-family: inherit;
	line-height: 1;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
	white-space: nowrap;
	border: 2px solid transparent;
}

.qp-btn-primary {
	background-color: #F5A623;
	color: #ffffff;
	border-color: #F5A623;
}

.qp-btn-primary:hover {
	background-color: #d4891a;
	border-color: #d4891a;
	color: #ffffff;
}

.qp-btn-secondary {
	background-color: #1a3a5c;
	color: #ffffff;
	border-color: #1a3a5c;
}

.qp-btn-secondary:hover {
	background-color: #2a5a8c;
	border-color: #2a5a8c;
	color: #ffffff;
}

.qp-btn-outline {
	background-color: transparent;
	color: #1a3a5c;
	border-color: #1a3a5c;
}

.qp-btn-outline:hover {
	background-color: #1a3a5c;
	color: #ffffff;
}

.qp-btn-lg {
	padding: 16px 32px;
	font-size: 1.1em;
	min-height: 52px;
}

.qp-btn:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

/* ================================================================
   TABLA DE PRODUCTOS
   ================================================================ */

.qp-quote-table {
	width: 100%;
	border-collapse: collapse;
	margin-bottom: 20px;
}

.qp-quote-table thead th {
	background-color: #f7f7f7;
	color: #1a3a5c;
	font-weight: 600;
	font-size: 0.9em;
	text-align: left;
	padding: 12px 10px;
	border-bottom: 2px solid #e0e0e0;
}

.qp-quote-table tbody td {
	padding: 14px 10px;
	vertical-align: middle;
	border-bottom: 1px solid #eeeeee;
}

.qp-quote-table tbody tr:hover {
	background-color: #fafafa;
}

/* Columnas */
.qp-col-image {
	width: 80px;
}

.qp-col-image img {
	width: 70px;
	height: 70px;
	object-fit: cover;
	border-radius: 4px;
}

.qp-col-product {
	min-width: 150px;
}

.qp-product-name {
	display: block;
	font-weight: 600;
	color: #1a3a5c;
	text-decoration: none;
}

.qp-product-name:hover {
	color: #F5A623;
}

.qp-product-sku {
	display: block;
	font-size: 0.8em;
	color: #999999;
	margin-top: 2px;
}

.qp-col-attributes {
	min-width: 120px;
}

.qp-attribute-list {
	list-style: none;
	margin: 0;
	padding: 0;
	font-size: 0.9em;
}

.qp-attribute-list li {
	margin-bottom: 2px;
}

.qp-no-attributes {
	color: #cccccc;
}

/* Cantidad */
.qp-col-quantity {
	width: 80px;
}

.qp-item-quantity {
	width: 65px;
	padding: 8px 6px;
	text-align: center;
	border: 1px solid #dddddd;
	border-radius: 4px;
	font-size: 1em;
}

/* Notas */
.qp-col-notes {
	min-width: 160px;
}

.qp-item-notes {
	width: 100%;
	padding: 8px;
	border: 1px solid #dddddd;
	border-radius: 4px;
	font-size: 0.9em;
	font-family: inherit;
	resize: vertical;
}

/* Eliminar */
.qp-col-actions {
	width: 40px;
	text-align: center;
}

.qp-remove-item {
	background: none;
	border: none;
	font-size: 1.5em;
	color: #cc0000;
	cursor: pointer;
	padding: 4px 8px;
	line-height: 1;
	transition: color 0.2s ease;
}

.qp-remove-item:hover {
	color: #ff0000;
}

/* Acciones debajo de tabla */
.qp-table-actions {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
}

/* Mensajes de feedback */
.qp-table-message,
.qp-form-message {
	padding: 12px 16px;
	border-radius: 4px;
	font-size: 0.95em;
	margin-top: 16px;
}

.qp-message-success {
	background-color: #ecfdf5;
	border: 1px solid #a7f3d0;
	color: #065f46;
}

.qp-message-error {
	background-color: #fef2f2;
	border: 1px solid #fecaca;
	color: #dc2626;
}

/* ================================================================
   FORMULARIO DE CONTACTO
   ================================================================ */

.qp-contact-form {
	max-width: 100%;
}

/* Layout 2 columnas */
.qp-form-layout {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 24px;
	align-items: start;
}

.qp-form-left,
.qp-form-right {
	min-width: 0;
}

.qp-form-row {
	margin-bottom: 18px;
}

.qp-form-row-2 {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
}

.qp-form-field label {
	display: block;
	font-weight: 600;
	color: #333333;
	margin-bottom: 6px;
	font-size: 0.95em;
}

.qp-required {
	color: #dc2626;
}

.qp-form-field input[type="text"],
.qp-form-field input[type="email"],
.qp-form-field input[type="tel"],
.qp-form-field select,
.qp-form-field textarea {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid #dddddd;
	border-radius: 4px;
	font-size: 1em;
	font-family: inherit;
	transition: border-color 0.2s ease;
	box-sizing: border-box;
}

.qp-form-field input:focus,
.qp-form-field select:focus,
.qp-form-field textarea:focus {
	outline: none;
	border-color: #1a3a5c;
	box-shadow: 0 0 0 2px rgba(26, 58, 92, 0.15);
}

.qp-form-field input.qp-field-error,
.qp-form-field select.qp-field-error,
.qp-form-field textarea.qp-field-error {
	border-color: #dc2626;
}

.qp-field-error-msg {
	color: #dc2626;
	font-size: 0.85em;
	margin-top: 4px;
}

.qp-field-hint {
	color: #888888;
	font-size: 0.85em;
	margin-top: 4px;
}

/* Checkbox */
.qp-form-checkbox label {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	font-weight: 400;
	cursor: pointer;
}

.qp-form-checkbox input[type="checkbox"] {
	margin-top: 3px;
	flex-shrink: 0;
}

/* Botón pequeño */
.qp-btn-sm {
	padding: 8px 16px;
	font-size: 0.9em;
}

/* ================================================================
   DROPZONE — Subida de archivo
   ================================================================ */

.qp-file-upload-area {
	height: 100%;
	display: flex;
	flex-direction: column;
}

.qp-file-dropzone {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 30px 20px;
	border: 2px dashed #dddddd;
	border-radius: 8px;
	text-align: center;
	transition: border-color 0.2s ease, background-color 0.2s ease;
	flex: 1;
	min-height: 200px;
}

.qp-file-dropzone:hover,
.qp-file-dropzone.qp-dragover {
	border-color: #F5A623;
	background-color: rgba(245, 166, 35, 0.04);
}

.qp-dropzone-icon {
	margin-bottom: 12px;
}

.qp-dropzone-text {
	color: #666666;
	margin-bottom: 12px;
	font-size: 0.95em;
}

.qp-file-input-hidden,
input[type="file"].qp-file-input-hidden {
	display: none !important;
	width: 0 !important;
	height: 0 !important;
	opacity: 0 !important;
	position: absolute !important;
	overflow: hidden !important;
}

/* ================================================================
   PREVIEW — Previsualización del archivo
   ================================================================ */

.qp-file-preview {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 16px;
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	background-color: #fafafa;
	margin-top: 12px;
}

.qp-preview-image {
	width: 80px;
	height: 80px;
	border-radius: 4px;
	overflow: hidden;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background-color: #f0f0f0;
}

.qp-preview-image img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
}

.qp-preview-image .qp-file-icon {
	font-size: 2em;
	color: #999999;
}

.qp-preview-info {
	flex: 1;
	min-width: 0;
}

.qp-preview-name {
	display: block;
	font-weight: 600;
	color: #333333;
	font-size: 0.9em;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.qp-preview-size {
	display: block;
	color: #888888;
	font-size: 0.8em;
	margin-top: 2px;
}

.qp-preview-remove {
	background: none;
	border: none;
	font-size: 1.4em;
	color: #cc0000;
	cursor: pointer;
	padding: 4px 8px;
	line-height: 1;
	flex-shrink: 0;
	transition: color 0.2s ease;
}

.qp-preview-remove:hover {
	color: #ff0000;
}

/* Submit */
.qp-form-submit {
	margin-top: 24px;
}

/* ================================================================
   CONFIRMACIÓN POST-ENVÍO
   ================================================================ */

.qp-confirmation {
	text-align: center;
	padding: 48px 24px;
	max-width: 600px;
	margin: 0 auto;
	animation: qpConfirmFadeIn 0.5s ease both;
}

@keyframes qpConfirmFadeIn {
	from {
		opacity: 0;
		transform: translateY(20px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* Checkmark animado */
.qp-confirmation-checkmark {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 80px;
	height: 80px;
	border-radius: 50%;
	background-color: #ecfdf5;
	margin-bottom: 24px;
	animation: qpCheckScale 0.4s 0.2s ease both;
}

@keyframes qpCheckScale {
	from {
		transform: scale(0.5);
		opacity: 0;
	}
	to {
		transform: scale(1);
		opacity: 1;
	}
}

.qp-confirmation-checkmark svg {
	width: 44px;
	height: 44px;
}

/* Título */
.qp-confirmation-title {
	font-size: 1.6em;
	font-weight: 700;
	color: #1a3a5c;
	margin: 0 0 20px;
}

/* Referencia */
.qp-confirmation-ref {
	display: inline-block;
	background-color: #fff8ee;
	border: 1px solid #fde6c4;
	border-radius: 8px;
	padding: 12px 24px;
	margin-bottom: 24px;
}

.qp-confirmation-ref-label {
	display: block;
	font-size: 0.8em;
	color: #888888;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	margin-bottom: 4px;
}

.qp-confirmation-ref-number {
	display: block;
	font-size: 1.4em;
	font-weight: 700;
	color: #F5A623;
}

/* Detalles */
.qp-confirmation-details {
	background-color: #f8f9fa;
	border-radius: 8px;
	padding: 20px 24px;
	margin-bottom: 28px;
	text-align: left;
}

.qp-confirmation-detail-item {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 8px 0;
	color: #444444;
	font-size: 0.95em;
	line-height: 1.4;
}

.qp-confirmation-detail-item + .qp-confirmation-detail-item {
	border-top: 1px solid #e9ecef;
}

.qp-confirmation-detail-icon {
	font-size: 1.2em;
	flex-shrink: 0;
	width: 24px;
	text-align: center;
}

/* Botones de acción */
.qp-confirmation-actions {
	display: flex;
	gap: 12px;
	justify-content: center;
	flex-wrap: wrap;
}

.qp-btn-whatsapp {
	background-color: #25D366;
	color: #ffffff;
	border-color: #25D366;
	display: inline-flex;
	align-items: center;
}

.qp-btn-whatsapp:hover {
	background-color: #1da851;
	border-color: #1da851;
	color: #ffffff;
}

/* ================================================================
   MODAL DE CONFIRMACIÓN
   ================================================================ */

.qp-modal-overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	background-color: rgba(0, 0, 0, 0);
	transition: background-color 0.25s ease;
	padding: 20px;
}

.qp-modal-overlay.qp-modal-visible {
	background-color: rgba(0, 0, 0, 0.5);
}

.qp-modal {
	background: #ffffff;
	border-radius: 12px;
	padding: 32px;
	max-width: 400px;
	width: 100%;
	text-align: center;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
	transform: scale(0.9) translateY(10px);
	opacity: 0;
	transition: transform 0.25s ease, opacity 0.25s ease;
}

.qp-modal-visible .qp-modal {
	transform: scale(1) translateY(0);
	opacity: 1;
}

.qp-modal-icon {
	font-size: 2.5em;
	margin-bottom: 12px;
	line-height: 1;
}

.qp-modal-title {
	font-size: 1.2em;
	font-weight: 700;
	color: #1a3a5c;
	margin: 0 0 8px;
}

.qp-modal-message {
	color: #555555;
	font-size: 0.95em;
	margin: 0 0 6px;
}

.qp-modal-detail {
	color: #1a3a5c;
	font-weight: 600;
	font-size: 0.95em;
	margin: 0 0 24px;
}

.qp-modal-actions {
	display: flex;
	gap: 12px;
	justify-content: center;
}

.qp-modal-actions .qp-btn {
	flex: 1;
	min-width: 0;
}

/* Botón rojo de eliminar */
.qp-btn-danger {
	background-color: #dc2626;
	color: #ffffff;
	border-color: #dc2626;
}

.qp-btn-danger:hover {
	background-color: #b91c1c;
	border-color: #b91c1c;
	color: #ffffff;
}

/* ================================================================
   RESPONSIVE — Contenedor con overflow (tablet)
   ================================================================ */

.qp-table-wrapper {
	width: 100%;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

/* ================================================================
   RESPONSIVE — Tablet (≤ 768px)
   ================================================================ */

@media (max-width: 768px) {
	.qp-form-layout {
		grid-template-columns: 1fr !important;
	}

	.qp-form-row-2 {
		grid-template-columns: 1fr !important;
	}

	.qp-table-actions {
		flex-direction: column;
		align-items: stretch;
	}

	.qp-table-actions .qp-btn {
		text-align: center;
	}

	.qp-file-dropzone {
		min-height: 150px;
	}

	.qp-btn-lg {
		width: 100%;
	}
}

/* ================================================================
   RESPONSIVE — Móvil (≤ 600px) — Tabla a cards
   ================================================================ */

@media (max-width: 600px) {

	/* ---- Tabla: destruir estructura de tabla ---- */
	table.qp-quote-table,
	table.qp-quote-table thead,
	table.qp-quote-table tbody,
	table.qp-quote-table tfoot,
	table.qp-quote-table tr,
	table.qp-quote-table th,
	table.qp-quote-table td {
		display: block !important;
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
		box-sizing: border-box !important;
	}

	table.qp-quote-table {
		border: none !important;
		border-collapse: separate !important;
	}

	table.qp-quote-table thead {
		display: none !important;
	}

	/* ---- Card: cada <tr> es una tarjeta ---- */
	table.qp-quote-table tbody tr.qp-quote-item {
		display: block !important;
		position: relative !important;
		padding: 16px !important;
		padding-right: 44px !important;
		margin-bottom: 16px !important;
		border: 1px solid #e0e0e0 !important;
		border-radius: 10px !important;
		background: #ffffff !important;
		box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
	}

	table.qp-quote-table tbody tr.qp-quote-item:hover {
		background: #ffffff !important;
	}

	/* ---- Celdas: apiladas verticalmente ---- */
	table.qp-quote-table tbody td {
		display: block !important;
		padding: 4px 0 !important;
		border: none !important;
		border-bottom: none !important;
		text-align: left !important;
	}

	/* Pseudo-label para cada celda */
	table.qp-quote-table tbody td::before {
		content: attr(data-label);
		display: block;
		font-weight: 700;
		font-size: 0.75em;
		color: #1a3a5c;
		text-transform: uppercase;
		letter-spacing: 0.05em;
		margin-bottom: 4px;
	}

	/* Ocultar label cuando data-label está vacío */
	table.qp-quote-table tbody td[data-label=""]::before {
		display: none !important;
	}

	/* ---- Imagen: centrada ---- */
	td.qp-col-image {
		text-align: center !important;
		padding-bottom: 8px !important;
	}

	td.qp-col-image img {
		width: 90px !important;
		height: 90px !important;
		border-radius: 6px;
	}

	/* ---- Producto: nombre grande ---- */
	td.qp-col-product {
		padding-bottom: 8px !important;
	}

	td.qp-col-product .qp-product-name {
		font-size: 1.05em;
		display: block;
	}

	td.qp-col-product .qp-product-sku {
		font-size: 0.8em;
	}

	/* ---- Atributos ---- */
	td.qp-col-attributes .qp-attribute-list {
		display: flex;
		flex-wrap: wrap;
		gap: 4px 12px;
		font-size: 0.88em;
		margin: 0;
		padding: 0;
	}

	td.qp-col-attributes .qp-attribute-list li {
		margin: 0;
	}

	/* ---- Cantidad y Notas: inline row ---- */
	td.qp-col-quantity {
		display: inline-block !important;
		width: auto !important;
		vertical-align: top;
		padding-right: 16px !important;
	}

	td.qp-col-quantity .qp-item-quantity {
		width: 70px;
		padding: 10px 8px;
	}

	td.qp-col-notes {
		display: block !important;
		padding-top: 4px !important;
	}

	td.qp-col-notes .qp-item-notes {
		width: 100% !important;
		min-height: 50px;
	}

	/* ---- Botón eliminar: esquina superior derecha de la card ---- */
	table.qp-quote-table tbody td.qp-col-actions {
		position: absolute !important;
		top: 14px !important;
		right: 10px !important;
		left: auto !important;
		width: auto !important;
		max-width: 40px !important;
		padding: 0 !important;
		margin: 0 !important;
		text-align: center !important;
	}

	table.qp-quote-table tbody td.qp-col-actions .qp-remove-item {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 30px;
		height: 30px;
		font-size: 1.4em;
		padding: 0;
		border-radius: 50%;
		background: #f5f5f5;
		color: #cc0000;
		line-height: 1;
		transition: background 0.2s ease;
	}

	table.qp-quote-table tbody td.qp-col-actions .qp-remove-item:hover {
		background: #fee2e2;
		color: #dc2626;
	}

	/* ---- Sección título ---- */
	.qp-section-title {
		font-size: 1.15em;
	}

	/* ---- Formulario ---- */
	.qp-contact-form {
		max-width: 100% !important;
	}

	.qp-form-submit .qp-btn,
	.qp-form-submit button {
		width: 100% !important;
	}

	/* Dropzone compacto */
	.qp-file-dropzone {
		padding: 20px 16px;
		min-height: 120px;
	}

	.qp-file-preview {
		flex-wrap: wrap;
	}

	.qp-preview-image {
		width: 60px;
		height: 60px;
	}

	/* Botones de acción */
	.qp-table-actions {
		flex-direction: column !important;
		gap: 10px;
	}

	.qp-table-actions .qp-btn {
		width: 100%;
		text-align: center;
		justify-content: center;
	}

	/* Confirmación responsive */
	.qp-confirmation {
		padding: 32px 16px;
	}

	.qp-confirmation-title {
		font-size: 1.3em;
	}

	.qp-confirmation-actions {
		flex-direction: column;
	}

	.qp-confirmation-actions .qp-btn {
		width: 100%;
		justify-content: center;
	}
}
