/* ======================================================= */
/* ADAMANT COMMUNITY — GLOBAL STYLES & DEFENSIVE GUARDS    */
/* ======================================================= */

html, body {
	overflow-x: hidden !important;
	max-width: 100vw !important;
	width: 100% !important;
	font-family: 'Outfit', 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
	background-color: var(--mud-palette-background);
	color: var(--mud-palette-text-primary);
	margin: 0;
	padding: 0;
	-webkit-font-smoothing: antialiased;
}

/* Guardrail estricto contra SVGs sin estilo / tamaño desbordado */
svg.mud-icon-root {
	max-width: 2.5rem;
	max-height: 2.5rem;
	display: inline-block;
	vertical-align: middle;
	flex-shrink: 0;
}

.mud-icon-size-small {
	font-size: 1.25rem !important;
	width: 1.25rem !important;
	height: 1.25rem !important;
}

.mud-icon-size-medium {
	font-size: 1.5rem !important;
	width: 1.5rem !important;
	height: 1.5rem !important;
}

.mud-icon-size-large {
	font-size: 2.25rem !important;
	width: 2.25rem !important;
	height: 2.25rem !important;
}

/* Scrollbar estilizada y moderna */
::-webkit-scrollbar {
	width: 6px;
	height: 6px;
}
::-webkit-scrollbar-track {
	background: rgba(0, 0, 0, 0.05);
}
::-webkit-scrollbar-thumb {
	background: rgba(100, 116, 139, 0.3);
	border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
	background: rgba(100, 116, 139, 0.5);
}

/* Contenedor estándar de pantallas de inventario y tablones */
.inventory-container {
	display: flex;
	flex-direction: column;
	gap: 16px;
	width: 100%;
}

.inventory-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	background: var(--mud-palette-surface);
	padding: 16px 20px;
	border-radius: 12px;
	border: 1px solid var(--mud-palette-divider);
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.header-title {
	font-size: 1.35rem;
	font-weight: 700;
	color: var(--mud-palette-text-primary);
	margin: 0;
}

.header-subtitle {
	font-size: 0.85rem;
	color: var(--mud-palette-text-secondary);
	margin: 4px 0 0 0;
}

/* Grillas corporativas y envoltorios */
.app-grid-wrapper {
	background: var(--mud-palette-surface);
	border-radius: 12px;
	border: 1px solid var(--mud-palette-divider);
	overflow: hidden;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
}

.app-premium-grid {
	background: transparent !important;
}

.app-premium-grid th.mud-table-cell {
	background: var(--mud-palette-surface) !important;
	color: var(--mud-palette-text-secondary) !important;
	font-weight: 600 !important;
	text-transform: uppercase;
	font-size: 11px !important;
	letter-spacing: 0.5px;
	border-bottom: 1px solid var(--mud-palette-divider) !important;
}

.app-premium-grid td.mud-table-cell {
	color: var(--mud-palette-text-primary) !important;
	font-size: 13.5px !important;
	border-bottom: 1px solid var(--mud-palette-divider) !important;
}

.border-t {
	border-top: 1px solid var(--mud-palette-divider);
}

.border-b {
	border-bottom: 1px solid var(--mud-palette-divider);
}

/* ======================================================= */
/* ADAMANT COMMUNITY — UNIFIED PAGE & BANNER ARCHITECTURE  */
/* ======================================================= */

.community-page-container {
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: 100%;
	padding: 1.25rem 0.5rem;
}

.community-header-banner {
	border: 1px solid var(--mud-palette-divider);
	border-radius: 16px;
	padding: 1.75rem 2rem;
	margin-bottom: 1.5rem;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.community-tabs-wrapper {
	background: var(--mud-palette-surface);
	border: 1px solid var(--mud-palette-divider);
	border-radius: 12px;
	padding: 0.5rem;
	margin-bottom: 1.5rem;
}

/* ======================================================= */
/* STANDARDIZED MUDTABS & ACTIVE TAB HIGHLIGHTING          */
/* ======================================================= */
.mud-tabs-tabbar {
	overflow-x: auto !important;
	scrollbar-width: thin;
	background: transparent !important;
}

.mud-tabs .mud-tab {
	text-transform: none !important;
	font-weight: 500 !important;
	font-size: 0.875rem !important;
	letter-spacing: normal !important;
	padding: 0.5rem 1.1rem !important;
	min-width: 0 !important;
	white-space: nowrap !important;
	border-radius: 8px !important;
	margin: 2px 4px !important;
	border: 1px solid transparent !important;
	color: var(--mud-palette-text-secondary) !important;
	transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.mud-tabs .mud-tab:hover:not(.mud-tab-active) {
	background-color: rgba(255, 255, 255, 0.05) !important;
	color: var(--mud-palette-text-primary) !important;
}

/* Tab Activo Estándar (Primary / Cyan) */
.mud-tabs .mud-tab.mud-tab-active {
	background-color: rgba(0, 188, 212, 0.14) !important;
	color: var(--mud-palette-primary) !important;
	font-weight: 700 !important;
	border: 1px solid rgba(0, 188, 212, 0.35) !important;
	box-shadow: 0 2px 8px rgba(0, 188, 212, 0.12) !important;
}

.mud-tabs .mud-tab.mud-tab-active .mud-tab-icon,
.mud-tabs .mud-tab.mud-tab-active .mud-icon-root {
	color: var(--mud-palette-primary) !important;
}

/* Tab Activo Warning (Marketplace / RFQ) */
.mud-tabs-tabbar-warning .mud-tab.mud-tab-active,
.mud-tabs:has(.mud-tab-slider-warning) .mud-tab.mud-tab-active,
.mud-tabs .mud-tab.mud-tab-active.mud-warning-text,
.mud-tabs .mud-tab.mud-tab-active:has(.mud-warning-text) {
	background-color: rgba(255, 160, 0, 0.14) !important;
	color: var(--mud-palette-warning) !important;
	border: 1px solid rgba(255, 160, 0, 0.35) !important;
	box-shadow: 0 2px 8px rgba(255, 160, 0, 0.12) !important;
}

.mud-tabs-tabbar-warning .mud-tab.mud-tab-active .mud-tab-icon,
.mud-tabs-tabbar-warning .mud-tab.mud-tab-active .mud-icon-root,
.mud-tabs:has(.mud-tab-slider-warning) .mud-tab.mud-tab-active .mud-icon-root,
.mud-tabs .mud-tab.mud-tab-active.mud-warning-text .mud-icon-root {
	color: var(--mud-palette-warning) !important;
}

/* Tab Activo Success (Surplus Food) */
.mud-tabs-tabbar-success .mud-tab.mud-tab-active,
.mud-tabs:has(.mud-tab-slider-success) .mud-tab.mud-tab-active,
.mud-tabs .mud-tab.mud-tab-active.mud-success-text,
.mud-tabs .mud-tab.mud-tab-active:has(.mud-success-text) {
	background-color: rgba(76, 175, 80, 0.14) !important;
	color: var(--mud-palette-success) !important;
	border: 1px solid rgba(76, 175, 80, 0.35) !important;
	box-shadow: 0 2px 8px rgba(76, 175, 80, 0.12) !important;
}

.mud-tabs-tabbar-success .mud-tab.mud-tab-active .mud-tab-icon,
.mud-tabs-tabbar-success .mud-tab.mud-tab-active .mud-icon-root,
.mud-tabs:has(.mud-tab-slider-success) .mud-tab.mud-tab-active .mud-icon-root,
.mud-tabs .mud-tab.mud-tab-active.mud-success-text .mud-icon-root {
	color: var(--mud-palette-success) !important;
}

/* Slider inferior más visible y acentuado */
.mud-tab-slider {
	height: 3px !important;
	border-radius: 3px 3px 0 0 !important;
}

.community-card {
	border-radius: 16px;
	border: 1px solid var(--mud-palette-divider);
	background: var(--mud-palette-surface);
	transition: transform 0.25s ease, box-shadow 0.25s ease;
	display: flex;
	flex-direction: column;
	height: 100%;
	overflow: hidden;
}

.community-card:hover {
	transform: translateY(-4px);
	box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
}

/* ======================================================= */
/* ADAMANT COMMUNITY — MOBILE FIRST & XS BREAKPOINT RULES  */
/* ======================================================= */

@media (max-width: 600px) {
	/* Contenedor principal con padding adaptado */
	.community-page-container {
		padding: 0.5rem 0.25rem !important;
	}

	/* Encabezados y banners ultra-compactos en smartphones */
	.community-header-banner,
	.feed-header-banner,
	.marketplace-header-banner,
	.pools-header-banner,
	.requests-header-banner,
	.surplus-header-banner,
	.partnerships-header-banner,
	.articles-header-banner,
	.jobs-header-banner,
	.directory-header-banner,
	.messages-header-banner,
	.pricing-header-banner {
		padding: 0.75rem 0.85rem !important;
		margin-bottom: 0.75rem !important;
		border-radius: 12px !important;
	}

	/* En celular ocultamos la descripción larga de los banners para dar paso inmediato al contenido */
	.community-header-banner .mud-typography-body1,
	.feed-header-banner .mud-typography-body1,
	.marketplace-header-banner .mud-typography-body1,
	.pools-header-banner .mud-typography-body1,
	.requests-header-banner .mud-typography-body1,
	.surplus-header-banner .mud-typography-body1,
	.partnerships-header-banner .mud-typography-body1,
	.articles-header-banner .mud-typography-body1,
	.jobs-header-banner .mud-typography-body1,
	.directory-header-banner .mud-typography-body1,
	.messages-header-banner .mud-typography-body1 {
		display: none !important;
	}

	/* Tipografía adaptada */
	.header-title,
	.mud-typography-h4 {
		font-size: 1.15rem !important;
		line-height: 1.25 !important;
	}

	.header-subtitle,
	.mud-typography-body1 {
		font-size: 0.82rem !important;
		line-height: 1.35 !important;
	}

	/* Botones de acción en banners a ancho completo */
	.inventory-header {
		flex-direction: column !important;
		align-items: stretch !important;
		gap: 10px !important;
		padding: 10px 12px !important;
	}

	.inventory-header .header-actions {
		width: 100% !important;
		display: flex !important;
	}

	.inventory-header .header-actions .mud-button-root {
		width: 100% !important;
		min-height: 44px !important;
	}

	/* Pestañas MudTabs optimizadas para scroll táctil */
	.community-tabs-wrapper {
		padding: 0.2rem !important;
		margin-bottom: 0.75rem !important;
		border-radius: 10px !important;
	}

	.mud-tabs .mud-tab {
		padding: 0.35rem 0.6rem !important;
		font-size: 0.78rem !important;
		margin: 2px 2px !important;
	}

	.mud-tabs-tabbar {
		-webkit-overflow-scrolling: touch !important;
	}

	/* Tarjetas compactas en móvil */
	.feed-card,
	.community-card,
	.offer-card {
		padding: 12px 10px !important;
		border-radius: 12px !important;
	}

	/* Touch Targets mínimos de 44px para botones de acción */
	.mud-icon-button {
		min-width: 44px !important;
		min-height: 44px !important;
	}
}

/* ======================================================= */
/* HORIZONTAL PILLS SCROLL (Filtros Táctiles Tipo Mobile)    */
/* ======================================================= */
.community-pills-scroll {
	display: flex;
	align-items: center;
	gap: 8px;
	overflow-x: auto;
	white-space: nowrap;
	padding: 4px 2px 8px 2px;
	margin-bottom: 12px;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	-ms-overflow-style: none;
}

.community-pills-scroll::-webkit-scrollbar {
	display: none;
}

.community-pill-btn {
	border-radius: 20px !important;
	padding: 5px 14px !important;
	font-size: 0.8rem !important;
	font-weight: 600 !important;
	white-space: nowrap !important;
	flex-shrink: 0 !important;
	min-height: 38px !important;
	text-transform: none !important;
}

/* ======================================================= */
/* FLOATING ACTION BUTTON (Thumb Zone para Móviles)        */
/* ======================================================= */
.community-fab {
	position: fixed !important;
	bottom: calc(70px + env(safe-area-inset-bottom, 0px));
	right: 16px;
	z-index: 1220 !important;
	box-shadow: 0 4px 16px rgba(0, 188, 212, 0.45) !important;
	width: 48px !important;
	height: 48px !important;
	min-width: 48px !important;
	min-height: 48px !important;
	max-width: 48px !important;
	max-height: 48px !important;
	aspect-ratio: 1 / 1 !important;
	border-radius: 50% !important;
	padding: 0 !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	touch-action: none;
	user-select: none;
	-webkit-user-select: none;
	cursor: grab;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.community-fab:active,
.community-fab.is-dragging {
	cursor: grabbing;
	transform: scale(1.12) !important;
	box-shadow: 0 8px 24px rgba(0, 188, 212, 0.65) !important;
}

@media (min-width: 960px) {
	.community-fab {
		bottom: 28px !important;
		right: 28px !important;
		width: 52px !important;
		height: 52px !important;
		min-width: 52px !important;
		min-height: 52px !important;
	}
}

/* ======================================================= */
/* ALINEACIÓN UNIFICADA DE FILTROS Y BÚSQUEDAS (PIXEL PERFECT) */
/* ======================================================= */
.community-filter-row {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
	width: 100%;
}

.community-filter-row .mud-input-control {
	margin-top: 0 !important;
	margin-bottom: 0 !important;
}

.community-filter-row .mud-input-control-margin-dense {
	margin-top: 0 !important;
	margin-bottom: 0 !important;
}

.community-filter-row .mud-input-outlined {
	height: 40px !important;
	min-height: 40px !important;
}

.community-filter-row .mud-input-outlined-border {
	top: 0 !important;
}

.community-filter-row .mud-input-slot {
	height: 40px !important;
	line-height: 40px !important;
	padding-top: 0 !important;
	padding-bottom: 0 !important;
	font-size: 0.875rem !important;
}

.community-filter-row .mud-select .mud-input-slot {
	padding-top: 0 !important;
	padding-bottom: 0 !important;
}

.community-fab .mud-button-label span:not(.mud-icon-root) {
	display: none !important;
}

.community-fab .mud-icon-root {
	margin: 0 !important;
	font-size: 1.4rem !important;
	flex-shrink: 0 !important;
}

.header-add-btn {
	min-width: 38px !important;
	max-width: 38px !important;
	width: 38px !important;
	min-height: 38px !important;
	max-height: 38px !important;
	height: 38px !important;
	aspect-ratio: 1 / 1 !important;
	border-radius: 50% !important;
	flex-shrink: 0 !important;
	box-shadow: 0 2px 10px rgba(0, 188, 212, 0.4) !important;
	padding: 0 !important;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	overflow: hidden !important;
	transition: transform 0.2s ease, box-shadow 0.2s ease !important;
}

.header-add-btn:hover {
	transform: scale(1.08) !important;
}

.header-add-btn .mud-button-label {
	width: 100% !important;
	height: 100% !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	padding: 0 !important;
	margin: 0 !important;
}

.header-add-btn .mud-icon-root {
	width: 22px !important;
	height: 22px !important;
	font-size: 22px !important;
	margin: 0 !important;
	flex-shrink: 0 !important;
}

/* ======================================================= */
/* OCULTAR BOTTOM-NAV Y FAB CUANDO UN DIÁLOGO ESTÁ ABIERTO */
/* ======================================================= */
body:has(.mud-dialog-container) .community-bottom-nav,
body:has(.mud-overlay-dialog) .community-bottom-nav,
body:has(.mud-dialog) .community-bottom-nav,
body:has(.mud-dialog-container) .community-fab,
body:has(.mud-overlay-dialog) .community-fab,
body:has(.mud-dialog) .community-fab {
	display: none !important;
}

/* ======================================================= */
/* DIÁLOGOS RESPONSIVOS BOTTOM-SHEET / FULLSCREEN EN MÓVIL */
/* ======================================================= */
.mud-dialog.community-login-dialog {
	max-width: 580px !important;
	width: 100% !important;
	border-radius: 16px !important;
}

/* ======================================================= */
/* Z-INDEX STACK & DIALOG / DRAWER HIERARCHY               */
/* ======================================================= */
.mud-drawer {
	z-index: 1300 !important;
}

.mud-drawer-overlay {
	z-index: 1290 !important;
}

.mud-dialog-container {
	z-index: 1400 !important;
}

.mud-dialog {
	position: relative !important;
	z-index: 1405 !important;
	pointer-events: auto !important;
}

@media (max-width: 959px) {
	/* Espaciado inferior de seguridad amplio para que la última tarjeta quede 100% visible por encima del menú inferior */
	.mud-main-content,
	.community-main-content,
	.main-container-responsive,
	.inventory-container,
	.feed-container,
	.community-feed-container,
	.pools-container,
	.marketplace-container,
	.requests-container,
	.surplus-container,
	.partnerships-container,
	.articles-container,
	.jobs-container,
	.directory-container,
	.messages-container,
	.pricing-container,
	.profile-container {
		padding-bottom: calc(110px + env(safe-area-inset-bottom, 24px)) !important;
	}
}

@media (max-width: 600px) {
	.mud-dialog-container {
		align-items: flex-end !important;
	}

	.mud-dialog {
		margin: 0 !important;
		max-width: 100vw !important;
		width: 100vw !important;
		max-height: 92dvh !important;
		border-radius: 20px 20px 0 0 !important;
		display: flex !important;
		flex-direction: column !important;
		box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.4) !important;
		padding-bottom: env(safe-area-inset-bottom, 12px) !important;
		background: var(--mud-palette-surface) !important;
		border-top: 1px solid var(--mud-palette-divider) !important;
	}

	.mud-dialog-title {
		padding: 14px 18px !important;
		border-bottom: 1px solid var(--mud-palette-divider) !important;
		flex-shrink: 0 !important;
	}

	.mud-dialog-content {
		padding: 16px 18px !important;
		overflow-y: auto !important;
		-webkit-overflow-scrolling: touch !important;
		flex-grow: 1 !important;
	}

	.mud-dialog-actions {
		padding: 12px 18px !important;
		border-top: 1px solid var(--mud-palette-divider) !important;
		flex-shrink: 0 !important;
		background: var(--mud-palette-surface) !important;
		gap: 8px !important;
		display: flex !important;
		justify-content: stretch !important;
	}

	.mud-dialog-actions .mud-button-root {
		min-height: 44px !important;
		flex: 1 !important;
	}
}

/* ======================================================= */
/* MOBILE LIST CARDS (Para tablas convertidas en celular)  */
/* ======================================================= */
.mobile-data-card {
	background: var(--mud-palette-surface);
	border: 1px solid var(--mud-palette-divider);
	border-radius: 12px;
	padding: 12px;
	margin-bottom: 8px;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

/* ======================================================= */
/* CHAT & MENSAJES MÓVIL (WhatsApp/Telegram Style)         */
/* ======================================================= */
.chat-conversation-paper {
	background: var(--mud-palette-surface);
	border: 1px solid var(--mud-palette-divider);
	border-radius: 16px;
	height: calc(100vh - 180px);
	min-height: 480px;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.chat-conversations-list-paper {
	background: var(--mud-palette-surface);
	border: 1px solid var(--mud-palette-divider);
	border-radius: 16px;
	height: calc(100vh - 180px);
	min-height: 480px;
	overflow-y: auto;
}

@media (max-width: 600px) {
	.chat-conversation-paper {
		height: calc(100dvh - 145px) !important;
		min-height: 380px !important;
		border-radius: 12px !important;
	}

	.chat-conversations-list-paper {
		height: calc(100dvh - 200px) !important;
		min-height: 300px !important;
		border-radius: 12px !important;
	}

	.chat-conversation-active .messages-header-banner {
		display: none !important;
	}
}

/* ======================================================= */
/* MOSAICO MULTI-IMAGEN SOCIAL (Menús, Obras, Flyers)      */
/* ======================================================= */
.community-gallery-container {
	border-radius: 12px;
	overflow: hidden;
	border: 1px solid var(--mud-palette-divider);
	background: var(--mud-palette-background);
}

.hover-zoom-img {
	transition: transform 0.35s ease, filter 0.35s ease;
}

.hover-zoom-img:hover {
	transform: scale(1.04);
	filter: brightness(1.03);
}

