/* --- 1. CONFIGURACIÓN DE NÚCLEO (Reset & Vars) --- */
:root {
    --primary-ych: #4c5f6e;
    --primary-light: rgba(76, 95, 110, 0.1);
    --primary-soft: rgba(76, 95, 110, 0.05);
    --text-muted: #6c757d;
    --border-color: #dee2e6;
    --success-ych: #27ae60;
    --danger-ych: #e74c3c;
}

/* Limpieza de Autocompletado de Chrome */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 30px white inset !important;
    box-shadow: 0 0 0 30px white inset !important;
    -webkit-text-fill-color: var(--primary-ych) !important;
}

/* --- 2. TIPOGRAFÍA Y TÍTULOS --- */
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
    color: var(--primary-ych) !important;
    font-weight: 700;
    letter-spacing: -0.5px;
}

/* Forzar mayúscula visual en inputs de texto */
input.form-control::first-letter, 
textarea.form-control::first-letter {
    text-transform: uppercase !important;
}

/* --- 3. COMPONENTES: BOTONES (Consolidados) --- */
.btn-ych {
    background-color: transparent !important;
    color: var(--primary-ych) !important;
    border: 1.5px solid rgba(76, 95, 110, 0.3) !important;
    border-radius: 8px;
    padding: 8px 18px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.75rem;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

.btn-ych:hover {
    background-color: var(--primary-ych) !important;
    color: white !important;
    border-color: var(--primary-ych) !important;
    transform: translateY(-3px); 
    box-shadow: 0 6px 15px rgba(76, 95, 110, 0.25);
}

/* Botón Circular con Giro */
.btn-circle {
    width: 38px;
    height: 38px;
    border-radius: 50% !important;
    border: none !important;
    background-color: transparent !important;
    color: var(--primary-ych) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55) !important;
}

.btn-circle:hover {
    background-color: var(--primary-ych) !important;
    color: white !important;
    transform: rotate(180deg);
}

/* Asegurar que el icono herede el color del botón */
.btn-ych i, .btn-circle i {
    color: inherit !important;
    transition: color 0.3s ease;
}

/* --- 4. FORMULARIOS ESTILO YCH --- */
.input-group-ych {
    display: flex;
    background-color: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    transition: all 0.3s ease;
    overflow: hidden;
}

.input-group-ych:focus-within {
    border-color: var(--primary-ych);
    background-color: white;
    box-shadow: 0 0 0 3px rgba(76, 95, 110, 0.1);
}

.form-control-ych {
    border: none !important;
    background: transparent !important;
    padding: 10px;
    color: var(--primary-ych);
    font-size: 0.9rem;
}

/* Select Estilizado */
.form-select-ych {
    display: block;
    width: 100%;
    padding: 0.6rem 2.25rem 0.6rem 1rem;
    font-size: 0.9rem;
    color: #495057;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%234c5f6e' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    appearance: none;
    transition: all 0.2s ease-in-out;
}

.form-select-ych:focus {
    border-color: var(--primary-ych);
    box-shadow: 0 0 0 0.25rem rgba(76, 95, 110, 0.15);
    outline: 0;
}

/* --- 5. COMPONENTES DE INTERFAZ (Pestañas, Badges, Labels) --- */
.nav-tabs-ych {
    border-bottom: 2px solid var(--border-color);
    display: flex;
    gap: 20px;
}

.nav-tabs-ych .nav-link {
    border: none !important;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.8rem;
    padding: 10px 5px;
    text-transform: uppercase;
    position: relative;
}

.nav-tabs-ych .nav-link.active {
    color: var(--primary-ych) !important;
}

.nav-tabs-ych .nav-link.active::after {
    content: "";
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--primary-ych);
    border-radius: 10px;
}

.tiny-label, .table thead th {
    font-size: 0.68rem !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--primary-ych) !important;
}

.badge-ych {
    padding: 0.5em 1em;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}


/* Iconos de éxito (Autorizado) */
.icon-sri-success {
    color: var(--success-ych) !important;
}

/* Iconos de error (Rechazado) */
.icon-sri-error {
    color: var(--danger-ych) !important;
}

/* Animación de entrada suave */
.animation-fade-in {
    animation: fadeInSlide 0.6s ease-out;
}

@keyframes fadeInSlide {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Personalización de SweetAlert2 para look Windows 11 */
.swal2-popup.swal2-toast {
    border-radius: 12px !important;
    box-shadow: 0 8px 30px rgba(0,0,0,0.1) !important;
    padding: 1rem !important;
    border: 1px solid rgba(76, 95, 110, 0.1) !important;
}

.swal2-timer-progress-bar {
    background: var(--primary-ych) !important;
}

/* Transición global para que todo se sienta suave */
a, button, i, .nav-link {
    transition: all 0.2s ease-in-out !important;
}

/* Efecto de enfoque profesional para inputs */
.form-control:focus {
    border-color: var(--primary-ych);
    box-shadow: 0 0 0 0.25rem var(--primary-light);
}

/* --- ESTILOS DE NAVEGACIÓN Y LOADER --- */
#loader-ych {
    display:none; position: fixed; top: 0; left: 0; 
    width: 100%; height: 100%; background: rgba(255,255,255,0.8); 
    z-index: 10000; justify-content: center; align-items: center;
}

.ui-autocomplete {
    z-index: 9999 !important;
    border: none !important;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1) !important;
    border-radius: 8px !important;
    padding: 5px !important;
}

.footer-ych-branding {
    position: fixed; bottom: 12px; right: 20px;
    display: flex; align-items: center; z-index: 1000;
    pointer-events: none; opacity: 0.5;
}

/* Ajuste para el logo y navbar */
.navbar-brand img {
    filter: drop-shadow(0 3px 5px rgba(0,0,0,0.1));
    transition: transform 0.3s ease;
}

.navbar-brand:hover img {
    transform: scale(1.05);
}

/* Margen para que el Toast no tape la Navbar */
.swal2-container.swal2-top-end {
    top: 60px !important; /* Ajusta según la altura de tu Navbar */
    right: 15px !important;
}

/* Limpieza definitiva de bordes en inputs grupales */
.input-group-ych {
    border: 1.5px solid rgba(76, 95, 110, 0.2) !important;
    background-color: #fcfcfc !important;
    display: flex;
    align-items: center;
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.input-group-text-ych {
    padding-left: 15px !important;  /* Empuja el icono hacia la derecha */
    padding-right: 10px !important; /* Espacio entre el icono y el texto */
    color: var(--primary-ych);
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.input-group-ych:focus-within {
    border-color: var(--primary-ych) !important;
    background-color: #fff !important;
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* El input interno NO debe tener borde ni sombra propia */
.form-control-ych {
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    background: transparent !important;
    padding: 10px 12px !important;
    width: 100%;
}

/* Asegurar que el padding sea cómodo */
.form-control-ych {
    height: 45px;
    background: transparent !important;
}

/* --- MODO APLICACIÓN DE ESCRITORIO --- */
body {
    background-color: #f4f7f6;
    overflow-x: hidden; /* Evita scroll horizontal molesto */
}

main.container {
    /* Fijamos un ancho mínimo para que no se "compriman" los elementos */
    min-width: 1024px; 
    max-width: 1400px; /* Limite para que en 1080p no se estire demasiado */
    margin: 0 auto;
    padding: 20px;
}

/* Evitar que las columnas de Bootstrap se apilen una debajo de otra */
.row {
    --bs-gutter-x: 1.5rem;
    display: flex;
    flex-wrap: nowrap !important; /* CRÍTICO: Evita que los inputs se bajen al achicar */
}

/* Si tienes formularios donde sí quieres que bajen, usa esta excepción */
.row.allow-wrap {
    flex-wrap: wrap !important;
}

/* --- COMPONENTES DE NAVEGACIÓN (TABS) --- */
.nav-tabs {
    border-bottom: 2px solid rgba(76, 95, 110, 0.1);
}

.nav-tabs .nav-link { 
    border: none; 
    color: #6c757d; 
    font-weight: 700; 
    padding: 1rem 1.5rem; 
    text-transform: uppercase;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.nav-tabs .nav-link:hover {
    color: var(--primary-ych);
    border-bottom: 3px solid rgba(76, 95, 110, 0.3);
}

.nav-tabs .nav-link.active { 
    color: var(--primary-ych) !important; 
    border-bottom: 3px solid var(--primary-ych) !important; 
    background: transparent !important; 
}

/* --- BOTONES Y UTILIDADES --- */
.btn-ych { 
    background: var(--primary-ych); 
    color: white; 
    border: none;
    transition: background 0.3s ease;
}

.btn-ych:hover { 
    background: #3a4a56; /* Un tono más oscuro para el hover */
    color: white; 
}

.extra-small { 
    font-size: 0.7rem; 
    text-transform: uppercase; 
    font-weight: bold; 
    letter-spacing: 0.5px;
}

/* --- ESTILOS DE FORMULARIO --- */
.form-control:focus { 
    border-color: var(--primary-ych); 
    box-shadow: 0 0 0 0.25rem rgba(76, 95, 110, 0.15); /* Resplandor sutil */
}

/* Contenedor del buscador */
.custom-search-group {
    border: 1px solid #dee2e6; /* Color de borde suave por defecto */
    border-radius: 10px;
    transition: all 0.3s ease;
    overflow: hidden;
}

/* Cuando el usuario hace clic para escribir */

/* Asegurar que los elementos internos no tengan bordes propios que choquen */
.custom-search-group .input-group-text,
.custom-search-group .form-control {
    border: none !important; 
    box-shadow: none !important;
}

/* Estilo para el icono cuando está activo */
.custom-search-group:focus-within .input-group-text {
    color: var(--primary-ych) !important;
}

/* --- ESTILOS DE CABECERA DE SECCIÓN --- */
.ych-section-header {
    border-radius: 12px !important;
    overflow: hidden;
}

.ych-title {
    color: var(--primary-ych) !important;
    letter-spacing: -0.5px;
    line-height: 1.1;
    display: flex;
    align-items: center;
}

/* --- CONTROL TOTAL DE ICONOS --- */
/* Esta regla permite que el color y tamaño del icono 
   se defina por clase o por style sin interferencias */
.ych-icon-custom {
    line-height: 1 !important;
    vertical-align: middle !important;
}


/* --- ESTILO MAESTRO DE BORDES YCH --- */

/* Clase para cualquier contenedor, card o div que deba ser redondeado */
.ych-rounded, .ych-card, .ych-section-header {
    border: 1px solid #dee2e6 !important; /* El color de borde estándar de Bootstrap */
    border-radius: 12px !important;       /* Los 12px que tienes en la tabla */
    overflow: hidden !important;          /* CRÍTICO: Recorta el contenido interno para que no tape la curva */
    background-color: #ffffff;
}

/* Para las cabeceras blancas que enviaste antes */
.ych-section-header .card-body {
    border: none !important; /* Quitamos el borde interno para que mande el del contenedor */
}

/* --- REGLA DE LIBERACIÓN DE ICONOS --- */
/* Esto permite que el color !important que pongas en el HTML funcione siempre */
.ych-icon-custom, i[class*="bi-"] {
    vertical-align: middle !important;
}

/* Si un icono tiene clase de color de Bootstrap, liberamos el color global */
i[class*="text-"] {
    color: unset !important;
}

/* Adaptación para pantallas pequeñas (Smartphones / Tablets) */
@media (max-width: 768px) {
    .ych-form-container {
        padding: 10px !important;
        gap: 10px !important;
    }
    .ych-section-card {
        flex: 1 1 100% !important; /* Fuerza apilamiento vertical */
        padding: 12px !important;
    }
    .ych-money-bar {
        grid-template-columns: repeat(2, 1fr) !important; /* En móviles muestra 2 columnas de dinero */
        gap: 10px !important;
        padding: 10px !important;
    }
    .ych-money-bar > div {
        margin-bottom: 5px;
    }
    /* Tablas con desplazamiento horizontal suave en móviles */
    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }
}