:root {
    --primary-blue: #1e3a8a;    /* Azul profundo institucional */
    --primary-light: #1d4ed8;   /* Azul vibrante para estados activos */
    --accent-orange: #f97316;   /* Naranja corporativo elegante */
    --accent-hover: #ea580c;    /* Variación interactiva para botones */
    --bg-light-gray: #f8fafc;   /* Fondo general limpio y descansado */
    --surface-white: #ffffff;
    --text-main: #0f172a;       /* Slate 900 para máxima legibilidad */
    --text-muted: #64748b;      /* Gris neutral para textos secundarios */
    --border-subtle: #e2e8f0;   /* Bordes delgados y modernos */
    --radius-lg: 12px;
    --radius-md: 8px;
    --radius-sm: 6px;
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg-light-gray);
    color: var(--text-main);
    min-height: 100vh;
    font-size: 14px; /* <-- NUEVO: Reduce el tamaño global de la fuente para mejor vista de datos */
}

/* --- DISEÑO DE CONTENEDOR (GRID SPA) --- */
.dashboard-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* MENÚ LATERAL (SIDEBAR) */
.sidebar {
    width: 260px;
    background-color: var(--primary-blue);
    color: white;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: margin-left 0.3s ease-in-out; /* <-- NUEVO: Animación suave del menú */
}

/* NUEVA CLASE: Oculta el menú desplazándolo fuera de la pantalla */
.sidebar.collapsed {
    margin-left: -260px;
}

.sidebar-brand {
    height: 70px;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    font-size: 1.3rem;
    font-weight: 700;
    background-color: rgba(0, 0, 0, 0.15);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-brand i {
    margin-right: 10px;
    color: #93c5fd;
}

.sidebar-brand span {
    color: var(--accent-orange);
}

.sidebar-menu {
    list-style: none;
    padding: 1rem 0;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    color: #cbd5e1;
    text-decoration: none;
    padding: 0.85rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.sidebar-menu li a i {
    width: 20px;
    font-size: 1.1rem;
    text-align: center;
}

.sidebar-menu li a:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: white;
}

.sidebar-menu li a.active {
    background-color: var(--primary-light);
    color: white;
    border-left: 4px solid var(--accent-orange);
}

/* SECCIÓN PRINCIPAL DERECHA */
.main-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    transition: width 0.3s ease-in-out; /* <-- NUEVO: Acompaña la animación del menú */
}

/* NUEVAS CLASES: Diseño del botón hamburguesa */
.menu-toggle-btn {
    background: transparent;
    border: none;
    color: var(--primary-blue);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px 10px 5px 0;
    margin-right: 15px;
    transition: color 0.2s;
}

.menu-toggle-btn:hover {
    color: var(--accent-orange);
}

.navbar-title {
    display: flex;
    align-items: center;
}

/* BARRA SUPERIOR (NAVBAR) */
.navbar {
    height: 70px;
    background-color: var(--surface-white);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
}

.navbar-title h1 {
    font-size: 1.35rem;
    color: var(--primary-blue);
    font-weight: 700;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-profile .avatar {
    background: #f1f5f9;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    border: 1px solid var(--border-subtle);
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.logout-btn {
    color: var(--text-muted);
    font-size: 1.1rem;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: background 0.2s, color 0.2s;
    text-decoration: none;
}

.logout-btn:hover {
    background-color: #fee2e2;
    color: #ef4444;
}

/* CUERPO DEL CONTENIDO */
.content-body {
    padding: 1rem;
    flex-grow: 1;
}

/* --- COMPONENTES REUTILIZABLES (CARDS) --- */
.card {
    background: var(--surface-white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-subtle);
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1rem;
    color: var(--primary-blue);
    margin-bottom: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* --- FILTROS Y FORMULARIOS --- */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    align-items: flex-end;
}

.filter-group {
    flex: 1;
    min-width: 180px;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.filter-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.form-control {
    width: 100%;
    padding: 0.6rem 0.85rem;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-md);
    outline: none;
    background-color: #fff;
    color: var(--text-main);
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.form-control:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.15);
}

/* --- BOTONES --- */
.btn-action {
    background-color: var(--accent-orange);
    color: white;
    border: none;
    padding: 0.45rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn-action:hover {
    background-color: var(--accent-hover);
}

.btn-excel {
    background-color: #10b981;
    color: white;
    border: none;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background-color 0.2s;
    height: 38px;
}

.btn-excel:hover {
    background-color: #059669;
}

/* --- TABLAS --- */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.modern-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.modern-table th {
    background-color: #f8fafc;
    color: var(--text-muted);
    padding: 0.5rem 0.5rem; /* Reducido a la mitad */
    font-weight: 600;
    font-size: 0.75rem; /* Equivalente a ~11px */
    text-transform: uppercase;
    border-bottom: 2px solid var(--border-subtle);
    white-space: nowrap; /* Obliga a que títulos como "FECHA RECIBO" se queden en una sola línea */
}

.modern-table td {
    padding: 0.4rem 0.5rem; /* Reducido significativamente (antes 1rem) */
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.8rem; /* Equivalente a ~12px */
    color: #334155;
    vertical-align: middle;
}

/* 3. Compactar los inputs de filtro que están dentro de los encabezados (<th>) */
.modern-table th input.form-control,
.modern-table th select.form-control {
    padding: 0.25rem 0.4rem;
    font-size: 0.75rem;
    height: 28px; /* Altura fija reducida */
}

/* 4. Ajustar botones y etiquetas (badges) dentro de la tabla */
.modern-table td .btn-action {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    white-space: nowrap;
}

.modern-table td .badge {
    padding: 0.2rem 0.5rem;
    font-size: 0.7rem;
    white-space: nowrap;
}


.modern-table tr:hover td {
    background-color: #f8fafc;
}

/* 5. Corrección para la columna de ACCIONES (eliminar el espacio sobrante) */
/* 5. Corrección para la columna de ACCIONES (Prioridad Máxima) */
.modern-table th:last-child,
.modern-table td:last-child {
    width: 1% !important;
    white-space: nowrap !important;
    text-align: center !important;
}

/* Opcional: Si los botones están dentro de un div, esto asegura que se centren y no se separen */
.modern-table td:last-child div {
    display: flex;
    justify-content: center;
    gap: 6px;
}


/* --- BADGES (ETIQUETAS DE ESTADO) --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.6rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background-color: #dcfce7; color: #15803d; }
.badge-info { background-color: #e0f2fe; color: #0369a1; }
.badge-warning { background-color: #fef9c3; color: #a16207; }
.badge-danger { background-color: #fee2e2; color: #b91c1c; }

/* --- RESPONSIVIDAD BÁSICA --- */
@media (max-width: 768px) {
    .dashboard-wrapper { flex-direction: column; }
    .sidebar { width: 100%; height: auto; }
    .navbar { padding: 1rem; flex-direction: column; gap: 10px; height: auto; }
    .filter-bar { flex-direction: column; align-items: stretch; }
    .btn-excel { justify-content: center; }
}

/* Botón Cancelar específico para Reservaciones */
.btn-danger-action {
    background-color: #ef4444; /* Rojo moderno */
}

.btn-danger-action:hover {
    background-color: #dc2626; /* Rojo más oscuro al pasar el cursor */
}

/* Badge específico para el estado Rechazado */
.badge-dark {
    background-color: #e2e8f0; 
    color: #475569;
    border: 1px solid #cbd5e1;
}
/* Botón Desactivar (Gris Oscuro/Neutral) */
.btn-secondary-action {
    background-color: #475569;
}
.btn-secondary-action:hover {
    background-color: #334155;
}

/* Botón Activar (Azul Suave/Vibrante) */
.btn-activate-action {
    background-color: #3b82f6;
}
.btn-activate-action:hover {
    background-color: #2563eb;
}

/* Badge específico para Clasificación o Tipo de Documento */
.badge-type {
    background-color: #f1f5f9;
    color: #1e3a8a;
    border: 1px solid #e2e8f0;
}

/* Badge para estado Inactivo */
.badge-neutral {
    background-color: #f1f5f9;
    color: #94a3b8;
    border: 1px solid #cbd5e1;
}

/* --- ESTILOS ESPECÍFICOS PARA LA PÁGINA DE LOGIN --- */

/* Fondo degradado suave utilizando los tonos grises de la paleta */
.login-body {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

/* Contenedor principal centrado */
.login-container {
    width: 100%;
    max-width: 420px;
    perspective: 1000px;
}

/* Tarjeta de login blanca con bordes redondeados y sombra sutil profesional */
.login-card {
    background: var(--surface-white);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem;
    box-shadow: 0 10px 25px -5px rgb(0 0 0 / 0.05), 0 8px 10px -6px rgb(0 0 0 / 0.05);
    border: 1px solid var(--border-subtle);
}

/* Encabezado del login: Logo azul e Identidad de marca */
.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    width: 60px;
    height: 60px;
    background-color: #eff6ff;
    color: var(--primary-light);
    font-size: 1.8rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    border: 1px solid #dbeafe;
}

.login-header h2 {
    font-size: 1.75rem;
    color: var(--primary-blue);
    font-weight: 700;
    letter-spacing: -0.025em;
}

.login-header h2 span {
    color: var(--accent-orange);
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

/* Formulario e Inputs dentro del Login */
.login-form .form-group {
    margin-bottom: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.login-form .form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 6px;
}

.login-form .form-group label i {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Ajustes adicionales para recordar sesión y enlaces alternos */
.login-helpers {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    cursor: pointer;
}

.forgot-password {
    color: var(--primary-light);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.forgot-password:hover {
    color: var(--primary-blue);
    text-decoration: underline;
}

/* Botón de login con los colores corporativos de acento (Naranja) */
.btn-login {
    width: 100%;
    background-color: var(--accent-orange);
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 6px -1px rgba(249, 115, 22, 0.2);
    transition: background-color 0.2s, transform 0.1s, box-shadow 0.2s;
}

.btn-login:hover {
    background-color: var(--accent-hover);
    box-shadow: 0 4px 12px -1px rgba(234, 88, 12, 0.3);
}

.btn-login:active {
    transform: scale(0.98);
}

/* Pie de página pequeño de la tarjeta */
.login-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-subtle);
}

.login-footer p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ==========================================================================
   ESTILOS EXCLUSIVOS PARA EL SELECTOR DE CONDOMINIOS
   ========================================================================== */

.selector-body {
    background-color: var(--bg-light-gray);
    min-height: 100vh;
}

.selector-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.selector-navbar {
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.selector-content {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 2.5rem 1.5rem;
}

.selector-header {
    margin-bottom: 2rem;
}

.selector-header h1 {
    font-size: 1.8rem;
    color: var(--primary-blue);
    font-weight: 700;
    margin-bottom: 0.4rem;
}

.selector-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Buscador */
.selector-search-card {
    padding: 1rem 1.5rem;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
    font-size: 1rem;
}

.search-box .form-control {
    padding-left: 2.5rem;
    height: 42px;
}

/* Grid de Condominios */
.condo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

/* Tarjeta de Condominio Individual */
.condo-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    height: 100%;
}

.condo-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px -5px rgba(0,0,0,0.08);
}

.condo-badge {
    position: absolute;
    top: 0;
    right: 0;
    background-color: #e0f2fe;
    color: var(--primary-light);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.4rem 0.8rem;
    border-bottom-left-radius: var(--radius-md);
    text-transform: uppercase;
}

.condo-card-header h3 {
    font-size: 1.2rem;
    color: var(--primary-blue);
    margin-bottom: 0.4rem;
    padding-right: 80px; /* Evita colisión con el badge */
}

.condo-card-header p {
    color: var(--text-muted);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Bloque de estadísticas internas */
.condo-stats {
    display: flex;
    background-color: #f8fafc;
    border-radius: var(--radius-md);
    padding: 1rem;
    margin: 1.5rem 0;
    border: 1px solid var(--border-subtle);
}

.stat-item {
    flex: 1;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stat-item:not(:last-child) {
    border-right: 1px solid var(--border-subtle);
}

.stat-number {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
}

.stat-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
}

/* Botón adaptado al ancho de la tarjeta */
.btn-condo {
    width: 100%;
    margin-top: 0;
    padding: 0.7rem 1rem;
    font-size: 0.9rem;
    text-decoration: none;
}

/* Asegurar que la cabecera tenga flexbox alineado arriba */
.card-header-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.card-header-title {
    flex: 1;
    min-width: 0;
}

/* Normalizar altura de títulos (máximo 2 líneas, altura constante) */
.project-title-text {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.3;
    min-height: 2.6em; /* Reserva espacio para 2 líneas siempre */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Normalizar altura de dirección */
.card-location {
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 4px;
    min-height: 2.4em; /* Reserva espacio para 2 líneas de dirección */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Línea propia para los badges de jerarquía */
.hierarchy-badge-container {
    margin-top: 6px;
    display: flex;
    gap: 6px;
    align-items: center;
    min-height: 22px; /* Mantiene la alineación vertical aunque la tarjeta no tenga badge */
}

/* Estilo mejorado para las insignias */
.hierarchy-badge-container span {
    font-size: 0.7rem !important;
    padding: 2px 8px !important;
    border-radius: 6px !important;
}

.dropdown-item-custom {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: #1f2937;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.dropdown-item-custom:hover {
    background-color: #f3f4f6;
    color: #1d4ed8;
}

/* Estilo corregido para forzar el tamaño en el navbar */
/* Estilo para el logo del proyecto en la navbar */
.proyecto-logo-badge {
    height: 40px !important;
    max-height: 40px !important;
    width: 60px !important;
    max-width: 60px !important;
    object-fit: cover !important;
    border-radius: 8px !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08) !important;
    background-color: #ffffff !important;
    padding: 2px !important;
    vertical-align: middle !important;
}