/* ========================================
   CosmoFE - Estilos Personalizados
   Usa variables validas del tema Radzen + overlays semi-transparentes
   ======================================== */

/* Ocultar flecha del SplitButton */
.rz-splitbutton-menubutton {
	display: none !important;
}

/* Variables globales */
:root {
	--rz-base-background-color: #ffffff !important;
	--rz-body-background-color: #ffffff !important;
	--rz-sidebar-width: 0px;
	--sidebar-width: 220px;
	--rz-border-radius: 8px;
}

html, body {
	background-color: #ffffff !important;
	color: var(--rz-text-color) !important;
}

/* Header principal */
.header-main {
	background: linear-gradient(135deg, #1a5fa0 0%, #2881c5 60%, #3d9de0 100%);
	border-bottom: 1px solid #1a5fa0;
	min-height: 48px;
	height: 48px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
	z-index: 200;
	position: relative;
}

.header-main .header-title {
	font-weight: 600;
	color: #ffffff;
	text-shadow: 0 2px 6px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.25);
}

.header-main .rz-icon,
.header-main .rz-button {
	color: #cbd5e1 !important;
}

.header-main .rz-icon:hover,
.header-main .rz-button:hover {
	color: #ffffff !important;
}

.header-main .rz-button {
	height: 40px !important;
	padding: 0 0.5rem !important;
}

.header-logo-circle {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: #b8d0ea;
	box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
	flex-shrink: 0;
	padding: 0.2rem;
}

/* Profile dropdown personalizado */
.profile-dropdown {
	position: relative;
	height: 40px;
	display: flex;
	align-items: center;
}

.profile-btn {
	background: rgba(255, 255, 255, 0.12);
	border: 1px solid rgba(255, 255, 255, 0.25);
	border-radius: 999px;
	cursor: pointer;
	padding: 0 0.85rem;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.4rem;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
	color: #ffffff;
	font-size: 0.9rem;
	transition: background 0.15s ease, box-shadow 0.15s ease;
}

.profile-btn:hover {
	background: rgba(255, 255, 255, 0.22);
	box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.profile-btn .material-icons {
	font-size: 1.4rem;
	color: #ffffff;
}

.profile-popup {
	position: absolute;
	top: 40px;
	right: 0;
	background: #ffffff;
	border: 1px solid var(--rz-border-color);
	border-radius: 6px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
	min-width: 200px;
	z-index: 1000;
	padding: 0.25rem 0;
}

.profile-popup-item {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	padding: 0.6rem 1rem;
	color: var(--rz-text-color);
	text-decoration: none;
	font-size: 13px;
	cursor: pointer;
	transition: background 0.15s ease;
}

.profile-popup-item:hover:not(.disabled) {
	background: rgba(128, 128, 128, 0.1);
}

.profile-popup-item.disabled {
	cursor: default;
	font-weight: 600;
	opacity: 0.8;
}

.profile-popup-item .material-icons {
	font-size: 18px;
	color: var(--rz-text-secondary-color);
}

/* ========================================
   Sidebar - position:fixed, siempre visible en desktop
   ======================================== */
.app-sidebar {
	position: fixed;
	left: 0;
	top: 48px;
	bottom: 0;
	width: var(--sidebar-width);
	background: linear-gradient(180deg, #0f3d6e 0%, #1a5fa0 40%, #2881c5 100%);
	z-index: 100;
	overflow-y: auto;
	overflow-x: hidden;
	box-shadow: 3px 0 16px rgba(0, 0, 0, 0.22);
	display: flex;
	flex-direction: column;
}

/* Scrollbar del sidebar */
.app-sidebar::-webkit-scrollbar { width: 4px; }
.app-sidebar::-webkit-scrollbar-track { background: transparent; }
.app-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }

/* Offset del contenido para dar espacio al sidebar fijo */
.content-offset {
	margin-left: var(--sidebar-width);
	padding: 1rem 1.25rem;
}

.sidebar-nav {
	list-style: none;
	margin: 0;
	padding: 0.75rem 0.5rem;
	width: 100%;
	flex: 1;
}

/* Separador de sección */
.sidebar-nav .nav-section {
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, 0.4);
	padding: 1rem 0.75rem 0.35rem;
	user-select: none;
}

.sidebar-nav .nav-item {
	position: relative;
	width: 100%;
	display: block;
	margin-bottom: 2px;
}

.sidebar-nav .nav-link {
	display: flex;
	flex-direction: row;
	align-items: center;
	gap: 0.75rem;
	padding: 0.65rem 0.85rem;
	border-radius: 10px;
	width: 100%;
	box-sizing: border-box;
	color: rgba(255, 255, 255, 0.75);
	text-decoration: none;
	cursor: pointer;
	transition: background 0.18s ease, color 0.18s ease;
	white-space: nowrap;
}

.sidebar-nav .nav-link .rzi,
.sidebar-nav .nav-link .rz-icon {
	font-size: 1.25rem;
	line-height: 1;
	flex-shrink: 0;
	color: rgba(255, 255, 255, 0.8) !important;
	transition: color 0.18s ease;
}

.sidebar-nav .nav-text {
	font-size: 13.5px;
	font-weight: 600;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	color: rgba(255, 255, 255, 0.95);
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.sidebar-nav .nav-link:hover {
	background: rgba(255, 255, 255, 0.12);
	color: #ffffff;
}

.sidebar-nav .nav-link:hover .rz-icon {
	color: #ffffff !important;
}

.sidebar-nav .nav-item.active > .nav-link {
	background: rgba(255, 255, 255, 0.18);
	color: #ffffff;
	font-weight: 600;
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}

.sidebar-nav .nav-item.active > .nav-link::before {
	content: '';
	position: absolute;
	left: 0;
	top: 20%;
	height: 60%;
	width: 3px;
	background: #ffffff;
	border-radius: 0 3px 3px 0;
}

.sidebar-nav .nav-item.active > .nav-link .rz-icon {
	color: #ffffff !important;
}

/* Submenús */
.sidebar-nav .submenu {
	list-style: none;
	margin: 2px 0 0 0;
	padding: 0 0 4px 0;
	max-height: 0;
	overflow: hidden;
	transition: max-height 0.28s ease;
}

.sidebar-nav .has-submenu:hover .submenu,
.sidebar-nav .has-submenu.active .submenu {
	max-height: 400px;
}

.sidebar-nav .submenu li a {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.5rem 0.85rem 0.5rem 2.85rem;
	border-radius: 8px;
	color: rgba(255, 255, 255, 0.95);
	text-decoration: none;
	font-size: 13px;
	font-weight: 600;
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
	transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-nav .submenu li a:hover {
	background: rgba(255, 255, 255, 0.1);
	color: #ffffff;
}

/* Indicador submenú */
.has-submenu > .nav-link::after {
	content: 'expand_more';
	font-family: 'Material Icons';
	font-size: 18px;
	margin-left: auto;
	color: rgba(255, 255, 255, 0.45);
	transition: transform 0.22s ease, color 0.18s ease;
	line-height: 1;
}

.has-submenu:hover > .nav-link::after,
.has-submenu.active > .nav-link::after {
	transform: rotate(180deg);
	color: rgba(255, 255, 255, 0.9);
}

/* Botón hamburguesa - solo mobile */
.mobile-menu-btn {
	display: none;
	background: rgba(255, 255, 255, 0.1);
	border: none;
	border-radius: 8px;
	cursor: pointer;
	color: #ffffff;
	padding: 0.3rem;
	margin-right: 0.5rem;
	align-items: center;
	justify-content: center;
	transition: background 0.15s ease;
}

.mobile-menu-btn:hover {
	background: rgba(255, 255, 255, 0.2);
}

.mobile-menu-btn .material-icons {
	font-size: 1.5rem;
}

/* Overlay mobile */
.sidebar-overlay {
	display: none;
}

/* ========================================
   Radzen Layout
   ======================================== */
.rz-layout {
	background-color: #ffffff !important;
	grid-template-columns: 1fr !important;
}

.rz-header {
	background: linear-gradient(135deg, #1a5fa0 0%, #2881c5 60%, #3d9de0 100%) !important;
	height: 48px !important;
	min-height: 48px !important;
	max-height: 48px !important;
	padding: 0 !important;
	overflow: visible !important;
	z-index: 200 !important;
}

.rz-header .rz-stack {
	height: 48px !important;
}

/* ========================================
   Body
   ======================================== */
.rz-body {
	background-color: #ffffff !important;
	grid-area: unset !important;
	grid-column: 1 !important;
}

.body-content {
	background-color: #ffffff !important;
	min-height: calc(100vh - 48px - 30px);
	padding: 0 !important;
}

/* ========================================
   Footer
   ======================================== */
.rz-footer {
	padding: 0 !important;
	min-height: auto !important;
	background-color: #ffffff !important;
}

/* ========================================
   Titulos de paginas
   ======================================== */
.body-content h1,
.body-content .rz-text-h4,
.body-content .rz-text-h5 {
	font-size: 1rem !important;
	font-weight: 600 !important;
	letter-spacing: 0.01em;
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ========================================
   Componentes
   ======================================== */

/* Toolbar container */
.toolbar-container {
	background: var(--rz-base-background-color);
	border: 1px solid var(--rz-border-color);
	border-radius: var(--rz-border-radius);
}

/* ========================================
   RadzenCard - Sin padding, sin shadow, sin border
   ======================================== */
.rz-card {
	box-shadow: none !important;
	padding: 0 !important;
	border: none !important;
	border-radius: 0 !important;
	background: transparent !important;
}

/* ========================================
   Dashboard - Graficos y KPI cards
   ======================================== */
.dashboard-chart-card {
	border: 1px solid #c8d8ea;
	border-radius: 8px;
	padding: 1rem;
	background: #ffffff;
}

/* KPI cards del dashboard */
.rz-background-color-info-lighter,
.rz-background-color-primary-lighter,
.rz-background-color-success-lighter,
.rz-background-color-danger-lighter {
	border: 1px solid #c8d8ea !important;
	border-radius: 8px !important;
	padding: 0.75rem !important;
}

/* ========================================
   Filter Tags
   ======================================== */
.filter-tag {
	display: inline-block;
	padding: 0.2rem 0.65rem;
	font-size: 12px;
	font-weight: 500;
	border-radius: 20px;
	cursor: pointer;
	transition: all 0.15s ease;
	color: var(--tag-color);
	background: var(--tag-bg);
	border: 1px solid var(--tag-color);
	user-select: none;
}

.filter-tag:hover {
	opacity: 0.85;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.filter-tag.active {
	background: var(--tag-active-bg);
	color: #ffffff;
	border-color: var(--tag-active-bg);
}

/* ========================================
   RadzenDataGrid - Estilo Moderno Sin Lineas
   ======================================== */

/* Contenedor con borde */
.rz-data-grid {
	border: 1px solid #c8d8ea !important;
	background-color: #ffffff !important;
	border-radius: 8px;
	overflow: hidden;
}

.rz-datatable,
.rz-grid-table {
	background-color: #ffffff !important;
	border-collapse: separate !important;
	border-spacing: 0 !important;
}

/* Header limpio */
.rz-datatable .rz-datatable-thead > tr > th,
.rz-grid-table thead th {
	background: #2881c5 !important;
	color: #ffffff !important;
	font-weight: 600;
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	border: none !important;
	padding: 0.85rem 1rem !important;
}

.rz-datatable .rz-datatable-thead > tr > th .rz-column-title,
.rz-grid-table thead th .rz-column-title {
	color: #ffffff !important;
}

.rz-datatable .rz-datatable-thead > tr > th .rz-sortable-column-icon,
.rz-grid-table thead th .rz-sortable-column-icon {
	display: none !important;
}

/* Filas sin bordes, mas altas */
.rz-datatable .rz-datatable-tbody > tr > td,
.rz-grid-table tbody td {
	padding: 0.85rem 1rem !important;
	min-height: 50px;
	border: none !important;
	border-bottom: 1px solid rgba(0, 0, 0, 0.04) !important;
	background-color: #ffffff !important;
	font-size: 13px;
}

/* Sin alternate row color */
.rz-datatable .rz-datatable-tbody > tr:nth-child(even) > td,
.rz-grid-table tbody tr:nth-child(even) td {
	background-color: #ffffff !important;
}

/* Columnas frozen (sticky): fondo solido para evitar transparencia */
.rz-grid-table tbody td[style*="position: sticky"],
.rz-grid-table tbody td[style*="position:sticky"] {
	background-color: #ffffff !important;
}

.rz-grid-table tbody tr:hover td[style*="position: sticky"],
.rz-grid-table tbody tr:hover td[style*="position:sticky"] {
	background-color: rgb(240, 247, 253) !important;
}

.rz-grid-table thead th[style*="position: sticky"],
.rz-grid-table thead th[style*="position:sticky"] {
	background-color: #f8f9fa !important;
}

/* Hover suave */
.rz-datatable .rz-datatable-tbody > tr:hover > td,
.rz-grid-table tbody tr:hover td {
	background-color: rgba(40, 129, 197, 0.06) !important;
}

/* Eliminar bordes de celdas del header */
.rz-datatable .rz-datatable-thead > tr > th:first-child,
.rz-grid-table thead th:first-child {
	border-radius: 8px 0 0 0;
}

.rz-datatable .rz-datatable-thead > tr > th:last-child,
.rz-grid-table thead th:last-child {
	border-radius: 0 8px 0 0;
}

/* Borde inferior del header */
.rz-datatable .rz-datatable-thead > tr > th,
.rz-grid-table thead th {
	border-bottom: 1px solid #c8d8ea !important;
}

/* Eliminar todas las lineas verticales y bordes internos */
.rz-cell-data,
.rz-datatable .rz-datatable-tbody > tr,
.rz-grid-table tbody tr,
.rz-datatable .rz-datatable-thead > tr,
.rz-grid-table thead tr {
	border: none !important;
}

/* Paginador limpio */
.rz-data-grid .rz-paginator-bottom {
	border-top: none !important;
	background: #ffffff !important;
	padding: 0.5rem 0 !important;
}

/* Filtros sin bordes extra */
.rz-data-grid .rz-grid-filter {
	border: none !important;
}

/* ========================================
   Controles elegantes - Bordes redondeados globales
   ======================================== */

/* Botones */
.rz-button {
	border-radius: 8px !important;
	font-weight: 500 !important;
	letter-spacing: 0.02em;
	transition: box-shadow 0.15s ease, transform 0.1s ease !important;
}

.rz-button:not(:disabled):hover {
	box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15) !important;
	transform: translateY(-1px);
}

.rz-button:not(:disabled):active {
	transform: translateY(0);
}

/* Inputs standalone (fuera de FormField) */
.rz-textbox:not(.rz-form-field *),
.rz-input:not(.rz-form-field *),
input.rz-inputtext:not(.rz-form-field *),
textarea.rz-inputtextarea:not(.rz-form-field *) {
	border-radius: 8px !important;
	border: 1px solid #cddaea !important;
	transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
}

.rz-textbox:focus,
.rz-input:focus,
input.rz-inputtext:focus,
textarea.rz-inputtextarea:focus {
	box-shadow: 0 0 0 3px rgba(40, 129, 197, 0.12) !important;
	outline: none !important;
}

/* RadzenFormField outlined - el borde es un fieldset */
.rz-form-field fieldset,
.rz-form-field-outlined fieldset {
	border-radius: 8px !important;
	border: 1px solid #cddaea !important;
	transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
}

.rz-form-field:focus-within fieldset,
.rz-form-field-outlined:focus-within fieldset {
	border-color: #2881c5 !important;
	box-shadow: 0 0 0 3px rgba(40, 129, 197, 0.12) !important;
}

/* Inputs dentro de FormField: sin borde propio */
.rz-form-field .rz-textbox,
.rz-form-field .rz-input,
.rz-form-field input.rz-inputtext,
.rz-form-field textarea.rz-inputtextarea,
.rz-form-field .rz-dropdown,
.rz-form-field .rz-password {
	border: none !important;
	box-shadow: none !important;
	background: transparent !important;
}

/* Dropdowns standalone */
.rz-dropdown:not(.rz-form-field *),
.rz-autocomplete:not(.rz-form-field *) {
	border-radius: 8px !important;
	border: 1px solid #cddaea !important;
}

/* Panel flotante del dropdown */
.rz-dropdown-panel,
.rz-select-panel,
.rz-autocomplete-panel {
	border-radius: 10px !important;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12) !important;
	border: 1px solid #cddaea !important;
	overflow: hidden;
}

/* Checkboxes y radios */
.rz-checkbox .rz-checkbox-box,
.rz-radiobutton .rz-radiobutton-box {
	border-radius: 5px !important;
	border: 1.5px solid #aac0d8 !important;
	transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
}

.rz-radiobutton .rz-radiobutton-box {
	border-radius: 50% !important;
}

/* Badges */
.rz-badge {
	border-radius: 20px !important;
	font-weight: 600 !important;
	padding: 0.2rem 0.65rem !important;
	font-size: 11px !important;
	letter-spacing: 0.03em;
}

/* Alerts */
.rz-alert {
	border-radius: 10px !important;
	border: none !important;
}

/* Dialog */
.rz-dialog {
	border-radius: 14px !important;
	overflow: hidden !important;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18) !important;
}

.rz-dialog-titlebar {
	border-radius: 14px 14px 0 0 !important;
}

/* Paginador */
.rz-paginator .rz-paginator-page,
.rz-paginator .rz-paginator-first,
.rz-paginator .rz-paginator-last,
.rz-paginator .rz-paginator-prev,
.rz-paginator .rz-paginator-next {
	border-radius: 8px !important;
}

/* Progress bar */
.rz-progressbar {
	border-radius: 20px !important;
}

.rz-progressbar-value {
	border-radius: 20px !important;
}

/* Tabs */
.rz-tabview-nav li .rz-tabview-nav-link {
	border-radius: 8px 8px 0 0 !important;
}

/* ========================================
   Responsive - Mobile
   ======================================== */
@media (max-width: 768px) {
	.mobile-menu-btn {
		display: flex;
	}

	/* En mobile el sidebar se oculta fuera de pantalla */
	.app-sidebar {
		transform: translateX(-100%);
		transition: transform 0.25s ease;
		z-index: 300;
	}

	.app-sidebar.sidebar-mobile-open {
		transform: translateX(0);
	}

	/* Overlay oscuro detrás del sidebar */
	.sidebar-overlay {
		display: block;
		position: fixed;
		inset: 0;
		background: rgba(0, 0, 0, 0.45);
		z-index: 299;
		backdrop-filter: blur(2px);
	}

	/* En mobile el contenido no necesita margen */
	.content-offset {
		margin-left: 0;
	}
}
