/* ==========================================================================
   Catálogo Abril - tema
   Neutro + acento naranja. Mobile first.
   ========================================================================== */

:root {
	--accent: #d9480f;
	--accent-hover: #b93c0b;
	--accent-ink: #c2410c;
	--accent-soft: #fff1e8;
	--ink: #1f2328;
	--ink-muted: #656d76;
	--surface: #ffffff;
	--page: #f5f6f8;
	--line: #e3e6ea;
	--header: #16181d;
	--ok: #1a7f37;
	--radius: 12px;
	--shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
	--shadow-hover: 0 6px 16px rgba(16, 24, 40, .12);
	--bottom-nav-h: 64px;

	--bs-body-bg: var(--page);
	--bs-body-color: var(--ink);
	--bs-border-color: var(--line);
	--bs-border-radius: 10px;
	--bs-link-color: var(--accent-ink);
	--bs-link-color-rgb: 194, 65, 12;
	--bs-link-hover-color: var(--accent-hover);
	--bs-link-hover-color-rgb: 185, 60, 11;
	--bs-body-font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
	background: var(--page);
	color: var(--ink);
	-webkit-font-smoothing: antialiased;
}

body.has-bottom-nav {
	padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom));
}

@media (min-width: 992px) {
	body.has-bottom-nav { padding-bottom: 0; }
}

main { min-height: 60vh; }

/* Evita el zoom automatico de iOS al enfocar inputs */
.form-control, .form-select, input, select, textarea { font-size: 16px; }

.form-control, .form-select { min-height: 44px; }

.form-control:focus, .form-select:focus {
	border-color: var(--accent);
	box-shadow: 0 0 0 .2rem rgba(217, 72, 15, .18);
}

/* ---------- Botones ---------- */
.btn { min-height: 44px; font-weight: 600; border-radius: 10px; }
.btn-sm { min-height: 36px; }

.btn-accent {
	--bs-btn-color: #fff;
	--bs-btn-bg: var(--accent);
	--bs-btn-border-color: var(--accent);
	--bs-btn-hover-color: #fff;
	--bs-btn-hover-bg: var(--accent-hover);
	--bs-btn-hover-border-color: var(--accent-hover);
	--bs-btn-active-color: #fff;
	--bs-btn-active-bg: var(--accent-hover);
	--bs-btn-active-border-color: var(--accent-hover);
	--bs-btn-disabled-color: #fff;
	--bs-btn-disabled-bg: var(--accent);
	--bs-btn-disabled-border-color: var(--accent);
	--bs-btn-focus-shadow-rgb: 217, 72, 15;
}

.btn-dark {
	--bs-btn-bg: var(--header);
	--bs-btn-border-color: var(--header);
}

/* ---------- Header ---------- */
.site-header {
	background: var(--header);
	z-index: 1030;
}

.site-header .navbar { min-height: 60px; }

.site-header .brand-logo {
	max-height: 40px;
	max-width: 160px;
	width: auto;
	object-fit: contain;
}

.site-header .brand-text {
	color: #fff;
	font-weight: 700;
	letter-spacing: .02em;
}

.site-header .nav-link {
	color: rgba(255, 255, 255, .78);
	font-weight: 500;
	display: flex;
	align-items: center;
	gap: .4rem;
	padding: .6rem .8rem;
	border-radius: 8px;
}

.site-header .nav-link:hover,
.site-header .nav-link.active {
	color: #fff;
	background: rgba(255, 255, 255, .08);
}

.header-cart {
	position: relative;
	color: #fff;
	font-size: 1.4rem;
	width: 44px;
	height: 44px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 10px;
}

.header-cart:hover { color: #fff; background: rgba(255, 255, 255, .08); }

.count-badge {
	position: absolute;
	top: 2px;
	right: 0;
	min-width: 20px;
	height: 20px;
	padding: 0 5px;
	border-radius: 10px;
	background: var(--accent);
	color: #fff;
	font-size: .72rem;
	font-weight: 700;
	line-height: 20px;
	text-align: center;
	border: 2px solid var(--header);
}

.count-inline {
	background: var(--accent);
	color: #fff;
	border-radius: 10px;
	font-size: .72rem;
	font-weight: 700;
	padding: .1rem .45rem;
}

.count-bump { animation: bump .45s ease; }

@keyframes bump {
	0% { transform: scale(1); }
	40% { transform: scale(1.45); }
	100% { transform: scale(1); }
}

.announce-bar {
	background: var(--accent-soft);
	color: var(--accent-ink);
	border-bottom: 1px solid #fcd9c4;
	font-weight: 600;
	font-size: .92rem;
	text-align: center;
	padding: .5rem 1rem;
}

/* ---------- Bottom nav (mobile) ---------- */
.bottom-nav {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 1030;
	height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom));
	padding-bottom: env(safe-area-inset-bottom);
	background: var(--surface);
	border-top: 1px solid var(--line);
	display: flex;
	box-shadow: 0 -2px 10px rgba(16, 24, 40, .06);
}

.bottom-nav a {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
	color: var(--ink-muted);
	text-decoration: none;
	font-size: .72rem;
	font-weight: 600;
}

.bottom-nav a i { font-size: 1.35rem; position: relative; }
.bottom-nav a.active { color: var(--accent-ink); }

.bottom-nav .count-badge {
	top: -6px;
	right: -14px;
	border-color: var(--surface);
	font-style: normal;
	font-family: var(--bs-body-font-family);
}

/* ---------- Toasts ---------- */
.toast-stack {
	position: fixed;
	left: 50%;
	transform: translateX(-50%);
	bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom) + 12px);
	z-index: 1090;
	width: min(420px, calc(100% - 24px));
	display: flex;
	flex-direction: column;
	gap: 8px;
}

@media (min-width: 992px) {
	.toast-stack { bottom: 24px; }
}

.toast-flash {
	width: 100%;
	border: 0;
	border-left: 5px solid var(--ink-muted);
	border-radius: 10px;
	box-shadow: var(--shadow-hover);
	background: var(--surface);
	font-weight: 500;
}

.toast-flash .toast-body { display: flex; gap: .6rem; align-items: center; padding: .85rem 1rem; }
.toast-flash .toast-icon { font-size: 1.2rem; }
.toast-flash[data-flash="success"] { border-left-color: var(--ok); }
.toast-flash[data-flash="success"] .toast-icon { color: var(--ok); }
.toast-flash[data-flash="info"] { border-left-color: #0969da; }
.toast-flash[data-flash="info"] .toast-icon { color: #0969da; }
.toast-flash[data-flash="warning"] { border-left-color: #bf8700; }
.toast-flash[data-flash="warning"] .toast-icon { color: #9a6700; }
.toast-flash[data-flash="danger"] { border-left-color: #cf222e; }
.toast-flash[data-flash="danger"] .toast-icon { color: #cf222e; }

/* ---------- Superficies ---------- */
.surface {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
}

.page-title {
	font-size: 1.35rem;
	font-weight: 700;
	margin: 0;
}

.text-muted-2 { color: var(--ink-muted) !important; }

/* ---------- Buscador ---------- */
.search-bar {
	background: var(--surface);
	border-bottom: 1px solid var(--line);
	padding: .75rem 0;
}

@media (min-width: 768px) {
	.search-bar {
		position: sticky;
		top: 60px;
		z-index: 1020;
	}
}

.search-bar .input-group-text {
	background: var(--surface);
	color: var(--ink-muted);
}

/* ---------- Banners ---------- */
.banner-carousel {
	border-radius: var(--radius);
	overflow: hidden;
	background: var(--surface);
	box-shadow: var(--shadow);
}

.banner-carousel .carousel-item img {
	display: block;
	margin: 0 auto;
	max-height: 340px;
	width: auto;
	max-width: 100%;
	object-fit: contain;
}

.banner-carousel .carousel-indicators [data-bs-target] { background-color: var(--accent); }

/* ---------- Tarjeta de producto ---------- */
.product-card {
	height: 100%;
	display: flex;
	flex-direction: column;
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	overflow: hidden;
	transition: box-shadow .15s ease, transform .15s ease;
}

@media (hover: hover) {
	.product-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
}

.product-media {
	position: relative;
	display: block;
	width: 100%;
	padding: 0;
	border: 0;
	background: #fff;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	cursor: zoom-in;
}

/* Absoluta: el tamaño real de la foto (vertical, horizontal) no estira la tarjeta */
.product-media img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: contain;
	padding: 8px;
}

.product-media img.is-placeholder { padding: 22%; opacity: .5; }

.product-badges {
	position: absolute;
	z-index: 1;
	top: 8px;
	left: 8px;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 4px;
}

.badge-offer {
	background: var(--accent);
	color: #fff;
	font-weight: 800;
	letter-spacing: .04em;
	font-size: .7rem;
	padding: .3rem .5rem;
	border-radius: 6px;
}

.badge-pack {
	background: var(--header);
	color: #fff;
	font-weight: 600;
	font-size: .7rem;
	padding: .3rem .5rem;
	border-radius: 6px;
}

.product-body {
	padding: .75rem;
	display: flex;
	flex-direction: column;
	gap: .25rem;
	flex: 1;
}

.product-brand {
	font-size: .7rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .05em;
	color: var(--ink-muted);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.product-title {
	font-size: .92rem;
	font-weight: 600;
	line-height: 1.3;
	margin: 0;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	min-height: 2.6em;
}

.product-code { font-size: .75rem; color: var(--ink-muted); }

.product-price { margin-top: auto; padding-top: .35rem; }

.price-now {
	font-size: 1.2rem;
	font-weight: 800;
	line-height: 1.1;
	letter-spacing: -.01em;
}

.price-now.is-offer { color: var(--accent-ink); }

.price-before {
	font-size: .8rem;
	color: var(--ink-muted);
}

.offer-note {
	font-size: .72rem;
	font-weight: 600;
	color: var(--accent-ink);
}

.stock-pill {
	display: inline-flex;
	align-items: center;
	gap: .3rem;
	font-size: .72rem;
	font-weight: 600;
}

.stock-pill::before {
	content: "";
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: currentColor;
}

.stock-pill.in { color: var(--ok); }
.stock-pill.out { color: var(--ink-muted); }

.product-actions {
	padding: 0 .75rem .75rem;
	display: flex;
	flex-direction: column;
	gap: .5rem;
}

@media (min-width: 576px) {
	.product-actions { flex-direction: row; }
	.product-actions .btn-add { flex: 1; }
}

/* ---------- Stepper de cantidad ---------- */
.qty {
	display: flex;
	align-items: stretch;
	border: 1px solid var(--line);
	border-radius: 10px;
	overflow: hidden;
	background: var(--surface);
	height: 44px;
}

.qty button {
	width: 40px;
	border: 0;
	background: var(--page);
	color: var(--ink);
	font-size: 1.1rem;
	font-weight: 700;
}

.qty button:active { background: var(--line); }

.qty input {
	width: 100%;
	min-width: 44px;
	border: 0;
	text-align: center;
	font-weight: 700;
	-moz-appearance: textfield;
	appearance: textfield;
}

.qty input::-webkit-outer-spin-button,
.qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.qty input:focus { outline: none; }
.qty:focus-within { border-color: var(--accent); box-shadow: 0 0 0 .2rem rgba(217, 72, 15, .18); }

@media (min-width: 576px) {
	.product-actions .qty { width: 124px; flex: none; }
}

/* ---------- Paginacion ---------- */
.pager .page-link {
	min-width: 44px;
	min-height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--ink);
	border-color: var(--line);
}

.pager .page-item.active .page-link {
	background: var(--header);
	border-color: var(--header);
	color: #fff;
}

.pager .page-item.disabled .page-link { color: #b6bcc3; }

/* ---------- Modal producto ---------- */
.product-modal .modal-content { border: 0; border-radius: var(--radius); }

.product-modal .modal-img {
	width: 100%;
	max-width: 100%;
	height: auto;
	max-height: 60vh;
	object-fit: contain;
	background: #fff;
}

/* ---------- Carrito / pedidos ---------- */
.line-item {
	display: flex;
	gap: .75rem;
	padding: .9rem 1rem;
	border-bottom: 1px solid var(--line);
}

.line-item:last-child { border-bottom: 0; }

.line-thumb {
	width: 64px;
	height: 64px;
	flex: none;
	border-radius: 8px;
	border: 1px solid var(--line);
	object-fit: contain;
	background: #fff;
}

.line-thumb.is-placeholder { padding: 14px; opacity: .5; }

.line-title {
	font-weight: 600;
	font-size: .95rem;
	line-height: 1.3;
}

.line-total { font-weight: 800; white-space: nowrap; }

.summary-card { padding: 1.25rem; }

.summary-total {
	font-size: 1.6rem;
	font-weight: 800;
	letter-spacing: -.01em;
}

/* En mobile el resumen queda pegado abajo, arriba de la bottom nav */
@media (max-width: 991.98px) {
	.summary-sticky {
		position: sticky;
		bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom));
		z-index: 1010;
		border-radius: var(--radius) var(--radius) 0 0;
		box-shadow: 0 -6px 18px rgba(16, 24, 40, .1);
	}
}

@media (min-width: 992px) {
	.summary-sticky { position: sticky; top: 84px; }
}

.table-clean { margin: 0; }
.table-clean th {
	font-size: .75rem;
	text-transform: uppercase;
	letter-spacing: .05em;
	color: var(--ink-muted);
	font-weight: 700;
	background: var(--page);
}
.table-clean td, .table-clean th { padding: .8rem 1rem; vertical-align: middle; }

.status-badge {
	font-weight: 700;
	font-size: .75rem;
	padding: .35rem .6rem;
	border-radius: 999px;
}

/* ---------- Estados vacios ---------- */
.empty-state {
	text-align: center;
	padding: 3rem 1rem;
}

.empty-state .bi {
	font-size: 3rem;
	color: #c2c8cf;
}

/* ---------- Auth ---------- */
.auth-wrap { padding: 2rem 0; }

.auth-card { padding: 1.5rem; }

@media (min-width: 576px) {
	.auth-card { padding: 2rem; }
}

.auth-card .form-label { font-weight: 600; font-size: .9rem; }

.divider-text {
	display: flex;
	align-items: center;
	gap: .75rem;
	color: var(--ink-muted);
	font-size: .85rem;
}

.divider-text::before, .divider-text::after {
	content: "";
	flex: 1;
	border-top: 1px solid var(--line);
}

/* ---------- Admin banners ---------- */
.banner-thumb {
	width: 100%;
	aspect-ratio: 1 / 1;
	object-fit: cover;
	border-radius: 8px 8px 0 0;
	background: #fff;
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation: none !important; transition: none !important; }
}

.min-w-0 { min-width: 0; }

/* Inputs blancos (en BS 5.3 heredan el fondo gris de la pagina) */
.form-control, .form-select { background-color: var(--surface); }

.pager .page-item.disabled .page-link { background: var(--surface); }
.pager .pager-label { color: var(--ink) !important; font-weight: 600; }

.product-media img.is-placeholder { padding: 30%; }

@media (max-width: 575.98px) {
	.banner-carousel .carousel-item img { max-height: 220px; }
}
