/* =========================================================
   BARCELONA ILUMINA — Estilo app nativa móvil (v2)
   ========================================================= */
:root {
	--bi-primary: #2563EB;
	--bi-primary-dark: #1D4ED8;
	--bi-primary-tint: #EAF1FF;
	--bi-orange: #FF7A00;
	--bi-orange-dark: #E06800;
	--bi-blue: #0B3D91;
	--bi-bg: #F4F6F9;
	--bi-card: #FFFFFF;
	--bi-text: #1C2430;
	--bi-text-light: #6B7280;
	--bi-radius: 18px;
	--bi-shadow: 0 8px 24px rgba(16, 24, 40, 0.08);
	--bi-app-height: min(88vh, 780px);
}

/* ---------------------------------------------------------
   CONTENEDOR PRINCIPAL: altura fija + layout en columna, para
   que el menú inferior quede SIEMPRE visible y solo el
   contenido interior (.bi-view) haga scroll.
   --------------------------------------------------------- */
.bi-app {
	max-width: 460px;
	margin: 0 auto;
	background: var(--bi-bg);
	border-radius: 28px;
	overflow: hidden;
	box-shadow: var(--bi-shadow);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--bi-text);
	height: var(--bi-app-height);
	display: flex;
	flex-direction: column;
	position: relative;
	border: 1px solid #eaecef;
}

.bi-screen {
	display: flex;
	flex-direction: column;
	padding: 28px 22px;
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
}

.bi-topbar {
	display: flex;
	align-items: center;
	justify-content: center;
	margin-bottom: 18px;
	min-height: 76px;
	flex: 0 0 auto;
	background: #fff;
	border-bottom: 1px solid #EEF0F3;
	padding-bottom: 10px;
}
.bi-topbar-app { justify-content: space-between; }

.bi-logo { max-height: 76px; max-width: 240px; object-fit: contain; }
.bi-logo-placeholder {
	font-weight: 800;
	font-size: 24px;
	color: var(--bi-blue);
	letter-spacing: 0.5px;
}

.bi-title { font-size: 22px; font-weight: 800; margin: 6px 0 4px; text-align: center; }
.bi-subtitle { font-size: 14px; color: var(--bi-text-light); text-align: center; margin: 0 0 20px; }

.bi-form { display: flex; flex-direction: column; gap: 10px; }
.bi-label { font-size: 13px; font-weight: 700; margin-top: 10px; color: var(--bi-text); }

.bi-input {
	width: 100%;
	padding: 13px 16px;
	border-radius: 14px;
	border: 1.5px solid #E3E7EE;
	font-size: 15px;
	background: var(--bi-card);
	box-sizing: border-box;
	outline: none;
	transition: border-color .15s ease, box-shadow .15s ease;
}
.bi-input:focus { border-color: var(--bi-primary); box-shadow: 0 0 0 4px var(--bi-primary-tint); }

/* ---------------------------------------------------------
   TARJETAS DE OPCIÓN CON ÍCONO (tipo de falla / quién reporta)
   --------------------------------------------------------- */
.bi-options {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
}
.bi-radio-card {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	gap: 8px;
	padding: 18px 10px 14px;
	border-radius: 16px;
	border: 1.5px solid #E3E7EE;
	background: var(--bi-card);
	cursor: pointer;
	font-size: 13px;
	color: var(--bi-text);
	transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.bi-radio-card .bi-option-icon {
	width: 40px; height: 40px; border-radius: 50%;
	background: #F1F3F6; color: var(--bi-text-light);
	display: flex; align-items: center; justify-content: center;
	transition: background .15s ease, color .15s ease;
}
.bi-radio-card .bi-option-icon svg { width: 22px; height: 22px; }
.bi-radio-card input {
	position: absolute; top: 8px; right: 8px;
	accent-color: var(--bi-primary); width: 16px; height: 16px; margin: 0;
}
.bi-radio-card span { font-weight: 600; line-height: 1.25; }
.bi-radio-card:has(input:checked) {
	border-color: var(--bi-primary);
	background: var(--bi-primary-tint);
	font-weight: 700;
	box-shadow: 0 4px 14px rgba(37, 99, 235, 0.15);
}
.bi-radio-card:has(input:checked) .bi-option-icon {
	background: var(--bi-primary);
	color: #fff;
}

.bi-btn-primary {
	background: linear-gradient(135deg, var(--bi-primary), var(--bi-primary-dark));
	color: #fff;
	border: none;
	padding: 15px 18px;
	border-radius: 16px;
	font-weight: 800;
	font-size: 15.5px;
	cursor: pointer;
	box-shadow: 0 6px 16px rgba(37, 99, 235, 0.30);
	transition: transform .12s ease;
}
.bi-btn-primary:active { transform: scale(0.98); }
.bi-btn-block { width: 100%; margin-top: 18px; }

.bi-btn-secondary {
	background: #fff;
	color: var(--bi-text);
	border: 1.5px solid #E3E7EE;
	padding: 13px 18px;
	border-radius: 16px;
	font-weight: 700;
	font-size: 14.5px;
	cursor: pointer;
	margin-top: 10px;
}

.bi-screen-success { align-items: center; justify-content: center; text-align: center; }
.bi-success-icon {
	width: 70px; height: 70px; border-radius: 50%;
	background: #E9FBF0; color: #16A34A;
	display: flex; align-items: center; justify-content: center;
	font-size: 34px; margin-bottom: 16px;
}

/* -------------------- LOGIN -------------------- */
.bi-screen-login, #bi-screen-login, #biapp-view-login { display: flex; align-items: center; justify-content: center; }
.bi-login-box { width: 100%; text-align: center; }
.bi-login-error {
	background: #FEECEC; color: #C0392B; padding: 10px 14px; border-radius: 12px;
	font-size: 13.5px; margin-top: 6px;
}

/* -------------------- DASHBOARD APP -------------------- */
.bi-screen-dashboard { padding: 0; display: flex; flex-direction: column; height: 100%; }
.bi-screen-dashboard .bi-topbar, .bi-app-unified > .bi-topbar { padding: 18px 20px 10px; min-height: 90px; }
.bi-logout-btn {
	background: #fff; border: 1.5px solid #E3E7EE; border-radius: 12px;
	width: 38px; height: 38px; font-size: 16px; cursor: pointer; flex: 0 0 auto;
}

.bi-view {
	padding: 6px 20px 24px;
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
}
.bi-view-title { font-size: 19px; font-weight: 800; margin: 6px 0 14px; }
.bi-view-subtitle { font-size: 15px; font-weight: 700; margin: 18px 0 8px; }

/* ---------------------------------------------------------
   TARJETAS DE ESTADÍSTICAS CON ÍCONO
   --------------------------------------------------------- */
.bi-stats-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
}
.bi-stat {
	background: var(--bi-card);
	border-radius: 16px;
	padding: 16px;
	box-shadow: var(--bi-shadow);
	display: flex; flex-direction: column; gap: 4px;
	position: relative;
}
.bi-stat-icon {
	position: absolute; top: 14px; right: 14px;
	width: 32px; height: 32px; border-radius: 10px;
	display: flex; align-items: center; justify-content: center;
	background: var(--bi-primary-tint); color: var(--bi-primary);
}
.bi-stat-icon svg { width: 17px; height: 17px; }
.bi-stat-icon.is-amber { background: #FFF3E0; color: #C77700; }
.bi-stat-icon.is-green { background: #E7F8EC; color: #1E9E4A; }
.bi-stat-icon.is-purple { background: #F1EBFC; color: #7C3AED; }

.bi-stat-num { font-size: 26px; font-weight: 800; color: var(--bi-text); }
.bi-stat-label { font-size: 12.5px; color: var(--bi-text-light); font-weight: 600; }

.bi-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.bi-list-item {
	background: var(--bi-card); border-radius: 14px; padding: 14px 16px;
	box-shadow: var(--bi-shadow); font-size: 13.5px;
}
.bi-list-item strong { display:block; font-size: 14.5px; margin-bottom: 3px; }
.bi-list-item .bi-meta { color: var(--bi-text-light); font-size: 12.5px; margin-top: 4px; }
.bi-list-item .bi-atender-btn-app {
	margin-top: 10px; background: var(--bi-primary); color: #fff; border: none;
	padding: 8px 14px; border-radius: 10px; font-size: 12.5px; font-weight: 700; cursor: pointer;
}

.bi-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.bi-tab {
	flex: 1; padding: 10px; border-radius: 12px; border: 1.5px solid #E3E7EE;
	background: #fff; font-weight: 700; font-size: 13px; cursor: pointer;
	color: var(--bi-text);
}
.bi-tab.active { background: var(--bi-primary); color: #fff; border-color: var(--bi-primary); }

.bi-codigo-display { background: var(--bi-primary-tint); color: var(--bi-primary-dark); padding: 10px 14px; border-radius: 12px; font-size: 14px; }

.bi-gps-box {
	display: flex; align-items: center; justify-content: space-between; gap: 10px;
	background: var(--bi-card); border: 1.5px solid #E3E7EE; border-radius: 12px;
	padding: 10px 14px; font-size: 12.5px; color: var(--bi-text-light); margin-bottom: 4px;
}
.bi-gps-retry {
	background: none; border: 1px solid var(--bi-primary); color: var(--bi-primary);
	border-radius: 10px; padding: 5px 10px; font-size: 11.5px; font-weight: 700; cursor: pointer; white-space: nowrap;
}

/* -------------------- ESCÁNER QR CON BOTÓN DE CIERRE -------------------- */
.bi-qr-reader-wrap {
	position: relative;
	margin-top: 12px;
	border-radius: 16px;
	overflow: hidden;
	background: #000;
	flex: 0 0 auto;
}
.bi-qr-reader-wrap #biapp-scan-poste-reader,
.bi-qr-reader-wrap #biapp-qr-reader,
.bi-qr-reader-wrap #bi-qr-reader,
.bi-qr-reader-wrap #bi-scan-poste-reader {
	width: 100%;
}
.bi-qr-close {
	position: absolute;
	top: 10px;
	right: 10px;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.55);
	color: #fff;
	border: none;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	z-index: 10;
	display: flex;
	align-items: center;
	justify-content: center;
}

/* ---------------------------------------------------------
   MENÚ INFERIOR — SIEMPRE FIJO (parte del flujo flex, no
   posicionamiento absoluto): al ser el último hijo de un
   contenedor de altura fija con overflow:hidden, nunca se
   mueve ni se tapa; solo .bi-view hace scroll por dentro.
   --------------------------------------------------------- */
.bi-bottom-nav {
	flex: 0 0 auto;
	display: flex; background: #fff; border-top: 1px solid #EEF0F3;
	padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
}
.bi-nav-item {
	flex: 1; background: none; border: none; display: flex; flex-direction: column;
	align-items: center; gap: 3px; font-size: 11px; color: var(--bi-text-light);
	cursor: pointer; padding: 6px 0; font-weight: 600;
	position: relative;
}
.bi-nav-item.active { color: var(--bi-primary); }
.bi-nav-item svg { color: inherit; }
.bi-nav-item .bi-nav-badge {
	position: absolute; top: 2px; right: calc(50% - 18px);
	background: var(--bi-orange); color: #fff; font-size: 9.5px; font-weight: 800;
	min-width: 15px; height: 15px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
	padding: 0 3px;
}

/* -------------------- BADGES -------------------- */
.bi-badge { padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 700; }
.bi-badge-pendiente { background: #FFF3E0; color: #C77700; }
.bi-badge-atendido { background: #E7F8EC; color: #1E9E4A; }

/* -------------------- BURBUJA FLOTANTE (instalación) -------------------- */
.bi-install-bubble {
	position: fixed;
	right: 20px;
	bottom: 100px;
	width: 58px;
	height: 58px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 8px 22px rgba(0,0,0,0.25);
	cursor: pointer;
	z-index: 99999;
	animation: bi-pulse 2.2s infinite;
}
@keyframes bi-pulse {
	0% { box-shadow: 0 0 0 0 rgba(255,122,0,0.45); }
	70% { box-shadow: 0 0 0 14px rgba(255,122,0,0); }
	100% { box-shadow: 0 0 0 0 rgba(255,122,0,0); }
}

.bi-install-modal {
	display: none;
	position: fixed; inset: 0; background: rgba(15,20,30,0.55);
	z-index: 999999; align-items: flex-end; justify-content: center;
}
.bi-install-modal.open { display: flex; }
.bi-install-modal-content {
	background: #fff; width: 100%; max-width: 460px;
	border-radius: 22px 22px 0 0; padding: 26px 24px calc(26px + env(safe-area-inset-bottom));
	position: relative;
	animation: bi-slideup .25s ease;
}
@keyframes bi-slideup { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.bi-install-close {
	position: absolute; top: 14px; right: 18px; background: none; border: none;
	font-size: 24px; cursor: pointer; color: var(--bi-text-light);
}
.bi-install-modal h3 { margin: 0 0 12px; font-size: 18px; }
.bi-install-block ol { padding-left: 18px; font-size: 14px; line-height: 1.7; }

/* -------------------- RESPONSIVE -------------------- */
@media (max-width: 480px) {
	.bi-app { border-radius: 0; max-width: 100%; height: 100dvh; }
}
