/* ==========================================================================
   CH Ideia 2001 — Carrinho de Solicitação de Orçamento
   FAB flutuante, drawer lateral à direita, formulário em etapas e botões.
   Independente do style.css do catálogo (carregamento condicional).
   ========================================================================== */

/* ----- Variáveis -------------------------------------------------------- */
:root {
	--ch-orc-bg: #ffffff;
	--ch-orc-fg: #1d2939;
	--ch-orc-muted: #667085;
	--ch-orc-border: #e4e7ec;
	--ch-orc-primary: #0086ff;
	--ch-orc-primary-hover: #006fd6;
	--ch-orc-primary-soft: rgba(0, 134, 255, .15);
	--ch-orc-success: #079455;
	--ch-orc-error: #d92d20;
	--ch-orc-shadow: 0 24px 48px -12px rgba(16, 24, 40, .25);
	--ch-orc-radius: 8px;
	--ch-orc-z-fab: 100000;
	--ch-orc-z-backdrop: 100001;
	--ch-orc-z-drawer: 100002;
}

/* ----- Reset escopo ----------------------------------------------------- */
.ch-orc-drawer *,
.ch-orc-fab,
.ch-orc-backdrop {
	box-sizing: border-box;
}

/* O atributo `hidden` deve sempre esconder, mesmo quando o elemento tem
   `display: flex` por classe (a especificidade do seletor de classe vence o
   UA stylesheet). Sem isto, as etapas do drawer (cart/form/success) ficam
   todas visíveis ao mesmo tempo. */
.ch-orc-drawer[hidden],
.ch-orc-drawer [hidden],
.ch-orc-backdrop[hidden],
.ch-orc-fab[hidden] {
	display: none !important;
}

/* ----- Botão "Adicionar ao Orçamento" no card -------------------------- */
.card-produto .btn-add-orcamento {
	position: absolute;
	right: 8px;
	top: 8px;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	border: 1px solid var(--ch-orc-border);
	background: rgba(255, 255, 255, .96);
	color: var(--ch-orc-primary);
	font-size: 20px;
	font-weight: 600;
	line-height: 1;
	cursor: pointer;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 1px 2px rgba(16, 24, 40, .12);
	transition: transform .12s ease, background .12s ease, color .12s ease;
}
.card-produto .btn-add-orcamento:hover {
	background: var(--ch-orc-primary);
	color: #fff;
	transform: scale(1.06);
}
.card-produto .btn-add-orcamento.is-added {
	background: var(--ch-orc-success);
	color: #fff;
	border-color: var(--ch-orc-success);
}
.card-produto .btn-add-orcamento.is-added:hover {
	background: var(--ch-orc-error);
	border-color: var(--ch-orc-error);
	color: #fff;
}
.card-produto .btn-add-orcamento svg {
	width: 18px;
	height: 18px;
}

@media (max-width: 720px) {
	.card-produto .btn-add-orcamento {
		width: 28px;
		height: 28px;
		right: 4px;
		top: 4px;
		font-size: 16px;
	}
	.card-produto .btn-add-orcamento svg {
		width: 15px;
		height: 15px;
	}
}

/* ----- FAB flutuante ---------------------------------------------------- */
.ch-orc-fab {
	position: fixed;
	right: 20px;
	bottom: 20px;
	width: 60px;
	height: 60px;
	border-radius: 50%;
	border: 0;
	background: var(--ch-orc-primary);
	color: #fff;
	cursor: pointer;
	box-shadow: var(--ch-orc-shadow);
	z-index: var(--ch-orc-z-fab);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: transform .15s ease, background .15s ease;
}
.ch-orc-fab:hover {
	transform: translateY(-2px);
	background: var(--ch-orc-primary-hover);
}
.ch-orc-fab__count {
	position: absolute;
	top: -4px;
	right: -4px;
	background: #fff;
	color: var(--ch-orc-primary);
	font-size: 12px;
	font-weight: 700;
	min-width: 22px;
	height: 22px;
	padding: 0 6px;
	border-radius: 999px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 2px solid var(--ch-orc-primary);
}
.ch-orc-fab.is-pulse {
	animation: chOrcPulse .35s ease;
}
@keyframes chOrcPulse {
	0%   { transform: scale(1); }
	50%  { transform: scale(1.12); }
	100% { transform: scale(1); }
}

/* ----- Backdrop --------------------------------------------------------- */
.ch-orc-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(16, 24, 40, .55);
	z-index: var(--ch-orc-z-backdrop);
	opacity: 0;
	transition: opacity .2s ease;
}
.ch-orc-backdrop.is-visible {
	opacity: 1;
}

/* ----- Drawer ----------------------------------------------------------- */
.ch-orc-drawer {
	position: fixed;
	top: 0;
	right: 0;
	width: 100%;
	max-width: 440px;
	height: 100vh;
	background: var(--ch-orc-bg);
	color: var(--ch-orc-fg);
	z-index: var(--ch-orc-z-drawer);
	display: flex;
	flex-direction: column;
	transform: translateX(100%);
	transition: transform .25s ease;
	box-shadow: var(--ch-orc-shadow);
	font-family: inherit;
}
.ch-orc-drawer.is-open {
	transform: translateX(0);
}
.ch-orc-drawer__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 20px;
	border-bottom: 1px solid var(--ch-orc-border);
}
.ch-orc-drawer__title {
	margin: 0;
	font-size: 18px;
	font-weight: 700;
}
.ch-orc-drawer__close {
	background: transparent;
	border: 0;
	font-size: 28px;
	line-height: 1;
	color: var(--ch-orc-muted);
	cursor: pointer;
	padding: 4px 8px;
	border-radius: 4px;
}
.ch-orc-drawer__close:hover {
	background: #f2f4f7;
	color: var(--ch-orc-fg);
}
.ch-orc-drawer__list-wrap,
.ch-orc-drawer__form-wrap,
.ch-orc-drawer__success {
	flex: 1;
	overflow-y: auto;
	padding: 16px 20px;
	display: flex;
	flex-direction: column;
}
.ch-orc-drawer__success {
	justify-content: center;
}

/* ----- Lista de itens --------------------------------------------------- */
.ch-orc-drawer__empty {
	color: var(--ch-orc-muted);
	font-size: 14px;
	text-align: center;
	padding: 28px 8px 16px;
	margin: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
}
.ch-orc-drawer__empty-title {
	margin: 0;
	color: var(--ch-orc-fg);
	font-size: 16px;
	font-weight: 650;
}
.ch-orc-drawer__empty-text {
	margin: 0 0 8px;
	line-height: 1.45;
	max-width: 32ch;
}
.ch-orc-drawer__empty .ch-orc-btn {
	margin-top: 4px;
}

@keyframes ch-orc-hint-pulse {
	0%, 100% { box-shadow: 0 0 0 0 rgba(0, 134, 255, .55); transform: scale(1); }
	50% { box-shadow: 0 0 0 8px rgba(0, 134, 255, 0); transform: scale(1.08); }
}
body.ch-orc-hint-add .card-produto .btn-add-orcamento:not(.is-added) {
	animation: ch-orc-hint-pulse 1.15s ease-in-out 4;
}
.ch-orc-list {
	list-style: none;
	margin: 0 0 16px;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 10px;
	flex: 1;
}
.ch-orc-item {
	display: grid;
	grid-template-columns: 56px 1fr auto;
	gap: 12px;
	align-items: center;
	padding: 10px;
	border: 1px solid var(--ch-orc-border);
	border-radius: var(--ch-orc-radius);
	background: #fafbfc;
}
.ch-orc-item__img {
	width: 56px;
	height: 56px;
	border-radius: 6px;
	background: #fff center/contain no-repeat;
	border: 1px solid var(--ch-orc-border);
}
.ch-orc-item__body {
	min-width: 0;
}
.ch-orc-item__title {
	font-size: 13px;
	font-weight: 600;
	margin: 0 0 2px;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.ch-orc-item__sku {
	font-size: 11px;
	color: var(--ch-orc-muted);
	margin: 0 0 6px;
}
.ch-orc-item__qty {
	display: inline-flex;
	align-items: center;
	gap: 4px;
}
.ch-orc-item__qty button {
	width: 24px;
	height: 24px;
	border: 1px solid var(--ch-orc-border);
	background: #fff;
	border-radius: 4px;
	cursor: pointer;
	font-size: 14px;
	line-height: 1;
	color: var(--ch-orc-fg);
	display: inline-flex;
	align-items: center;
	justify-content: center;
}
.ch-orc-item__qty button:hover {
	border-color: var(--ch-orc-primary);
	color: var(--ch-orc-primary);
}
.ch-orc-item__qty input {
	width: 44px;
	height: 24px;
	border: 1px solid var(--ch-orc-border);
	border-radius: 4px;
	text-align: center;
	font-size: 13px;
	-moz-appearance: textfield;
}
.ch-orc-item__qty input::-webkit-outer-spin-button,
.ch-orc-item__qty input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}
.ch-orc-item__remove {
	background: transparent;
	border: 0;
	color: var(--ch-orc-muted);
	font-size: 18px;
	cursor: pointer;
	padding: 4px 6px;
	line-height: 1;
	align-self: start;
}
.ch-orc-item__remove:hover {
	color: var(--ch-orc-error);
}

/* ----- Footer / botões -------------------------------------------------- */
.ch-orc-drawer__foot {
	display: flex;
	gap: 10px;
	padding-top: 12px;
	border-top: 1px solid var(--ch-orc-border);
	margin-top: auto;
}
.ch-orc-btn {
	flex: 1;
	padding: 12px 16px;
	border-radius: var(--ch-orc-radius);
	font-weight: 600;
	font-size: 14px;
	cursor: pointer;
	border: 1px solid transparent;
	transition: background .15s ease, color .15s ease, border-color .15s ease, opacity .15s ease;
	font-family: inherit;
}
.ch-orc-btn--primary {
	background: var(--ch-orc-primary);
	color: #fff;
}
.ch-orc-btn--primary:hover:not(:disabled) {
	background: var(--ch-orc-primary-hover);
}
.ch-orc-btn--primary:disabled {
	opacity: .5;
	cursor: not-allowed;
}
.ch-orc-btn--ghost {
	background: #fff;
	color: var(--ch-orc-fg);
	border-color: var(--ch-orc-border);
}
.ch-orc-btn--ghost:hover {
	background: #f2f4f7;
}

/* ----- Formulário ------------------------------------------------------- */
.ch-orc-form {
	display: flex;
	flex-direction: column;
	gap: 12px;
	flex: 1;
}
.ch-orc-field {
	display: flex;
	flex-direction: column;
	gap: 4px;
}
.ch-orc-field__label {
	font-size: 12px;
	font-weight: 600;
	color: var(--ch-orc-fg);
}
.ch-orc-field__label em {
	color: var(--ch-orc-error);
	font-style: normal;
}
.ch-orc-field input,
.ch-orc-field textarea {
	width: 100%;
	padding: 10px 12px;
	font-size: 14px;
	border: 1px solid var(--ch-orc-border);
	border-radius: 6px;
	font-family: inherit;
	background: #fff;
	color: var(--ch-orc-fg);
}
.ch-orc-field input:focus,
.ch-orc-field textarea:focus {
	outline: 0;
	border-color: var(--ch-orc-primary);
	box-shadow: 0 0 0 3px var(--ch-orc-primary-soft);
}
.ch-orc-field.has-error input,
.ch-orc-field.has-error textarea {
	border-color: var(--ch-orc-error);
}
.ch-orc-consent {
	display: flex;
	gap: 8px;
	align-items: flex-start;
	font-size: 12px;
	color: var(--ch-orc-muted);
	line-height: 1.5;
}
.ch-orc-consent input {
	margin-top: 2px;
	flex-shrink: 0;
}
.ch-orc-consent a {
	color: var(--ch-orc-primary);
	text-decoration: underline;
}
.ch-orc-honeypot {
	position: absolute !important;
	left: -9999px !important;
	top: -9999px !important;
	width: 1px !important;
	height: 1px !important;
	overflow: hidden !important;
}
.ch-orc-feedback {
	padding: 10px 12px;
	border-radius: 6px;
	font-size: 13px;
	line-height: 1.45;
}
.ch-orc-feedback.is-error {
	background: #fef3f2;
	color: var(--ch-orc-error);
	border: 1px solid #fecdca;
}
.ch-orc-feedback.is-info {
	background: #eff8ff;
	color: #175cd3;
	border: 1px solid #b2ddff;
}

/* ----- Sucesso ---------------------------------------------------------- */
.ch-orc-success {
	text-align: center;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
}
.ch-orc-success svg {
	color: var(--ch-orc-success);
}
.ch-orc-success h3 {
	margin: 0;
	font-size: 20px;
	font-weight: 700;
}
.ch-orc-success p {
	margin: 0;
	color: var(--ch-orc-muted);
	font-size: 14px;
}
.ch-orc-success .ch-orc-btn {
	flex: 0 0 auto;
	min-width: 160px;
	margin-top: 12px;
}

/* ----- Compatibilidade screen-reader ----------------------------------- */
.ch-orc-drawer .screen-reader-text,
.ch-orc-fab .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ----- Mobile ----------------------------------------------------------- */
@media (max-width: 480px) {
	.ch-orc-drawer { max-width: 100%; }
	.ch-orc-fab { right: 16px; bottom: 16px; }
}

/* ----- Lock scroll do body --------------------------------------------- */
body.ch-orc-locked {
	overflow: hidden !important;
}
