/* ====================================================
   NUEVO DEPARTAMENTO - CSS COMPACTO
   (Reducida separación entre header y contenido)
   ==================================================== */

/* --- Variables/Base --- */
.newdep-container {
    background-color: #ffffff;
    min-height: calc(100vh - 80px); /* Ajusta según altura de tu header */
    position: relative;
    z-index: 100;
    margin: 0;
    padding: 0;
}

.newdep-layout {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    padding: 0;
}

/* CONTENEDOR PRINCIPAL - SIN PADDING SUPERIOR */
.newdep-max-w {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0.5rem 1rem 1.5rem 1rem; /* TOP: 0.5rem (reducido), BOTTOM: 1.5rem */
    position: relative;
    z-index: 1;
}

/* --- Selectores de Modo (Tabs) --- */
.newdep-mode-selector {
    border-radius: 0.5rem;
    overflow: hidden;
    margin-bottom: 1rem; /* REDUCIDO de 2rem a 1rem */
    background-color: #ffffff;
    position: relative;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(134, 21, 66, 0.1);
}

.newdep-flex {
    display: flex;
}

.newdep-flex-1 {
    flex: 1 1 0%;
}

.newdep-mode-tab {
    padding: 0.75rem 1.25rem; /* REDUCIDO de 1rem 1.5rem */
    font-size: 0.9375rem;
    font-weight: 600;
    color: #4b5563;
    background-color: #f3f4f6;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    font-family: 'Poppins', sans-serif;
    position: relative;
}

.newdep-mode-tab:hover {
    background-color: #e5e7eb;
}

/* TONOS ROJOS MUNICIPIO ESPECÍFICOS */
.newdep-mode-tab.newdep-active {
    background: linear-gradient(135deg, #861542 0%, #a51e5c 100%);
    color: #ffffff;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(134, 21, 66, 0.3);
}

/* --- Formulario y Contenedores --- */
.newdep-form-card {
    background-color: #ffffff;
    border-radius: 0.75rem;
    padding: 1.5rem; /* REDUCIDO de 2rem */
    box-shadow: 0 8px 16px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 2;
    margin-top: 0; /* SIN margen superior */
}

.newdep-hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.newdep-hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 20px -5px rgba(0, 0, 0, 0.1), 0 6px 8px -6px rgba(0, 0, 0, 0.1);
}

.newdep-form-title {
    font-size: 1.375rem; /* Ligeramente reducido */
    font-weight: 600;
    color: #6a0f37;
    margin-bottom: 1rem; /* REDUCIDO de 1.5rem */
    padding-bottom: 0.5rem; /* REDUCIDO de 0.75rem */
    border-bottom: 1px solid #e5e7eb;
    font-family: 'Poppins', sans-serif;
}

.newdep-space-y-6 > * + * {
    margin-top: 1rem; /* REDUCIDO de 1.5rem */
}

.newdep-form-group {
    position: relative;
    margin-bottom: 1rem; /* REDUCIDO de 1.5rem */
    z-index: 3;
}

.newdep-form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.375rem; /* REDUCIDO de 0.5rem */
    font-family: 'Poppins', sans-serif;
}

.newdep-form-input {
    width: 100%;
    padding: 0.625rem 0.875rem; /* REDUCIDO de 0.75rem 1rem */
    font-size: 0.9375rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: 'Poppins', sans-serif;
    background-color: #ffffff;
    position: relative;
    z-index: 1;
}

/* Placeholder más claro */
.newdep-form-input::placeholder {
    color: #9ca3af;
    opacity: 0.8;
    font-family: 'Poppins', sans-serif;
    font-weight: 400;
}

.newdep-form-input:focus {
    border-color: #861542;
    box-shadow: 0 0 0 3px rgba(134, 21, 66, 0.2), inset 0 1px 2px rgba(0, 0, 0, 0.05);
    outline: none;
}

.newdep-form-input:focus::placeholder {
    color: #9ca3af;
    opacity: 0.6;
}

/* ESTILOS PARA INPUT CON ÉXITO */
.newdep-success-input {
    border-color: #10b981 !important;
    background-color: #f0fdf4 !important;
}

.newdep-success-input:focus {
    border-color: #10b981 !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2) !important;
}

/* ESTILOS PARA INPUT CON ERROR */
.newdep-error-input {
    border-color: #dc2626 !important;
    background-color: #fef2f2;
}

.newdep-error-input:focus {
    border-color: #b91c1c !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.2) !important;
}

/* ESTILOS PARA MENSAJES DE ERROR */
.newdep-error-message {
    color: #dc2626;
    font-size: 0.8125rem;
    margin-top: 0.375rem;
    padding: 0.375rem 0.625rem;
    background-color: #fef2f2;
    border-radius: 0.375rem;
    animation: newdep-error-fade 0.3s ease-out;
    font-family: 'Poppins', sans-serif;
    position: relative;
    z-index: 1;
}

/* ESTILOS PARA MENSAJES DE ÉXITO */
.newdep-success-message {
    color: #166534;
    font-size: 0.8125rem;
    margin-top: 0.375rem;
    padding: 0.375rem 0.625rem;
    background-color: #f0fdf4;
    border-radius: 0.375rem;
    animation: newdep-error-fade 0.3s ease-out;
    font-family: 'Poppins', sans-serif;
    position: relative;
    z-index: 1;
}

@keyframes newdep-error-fade {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Botones (TONOS ROJOS ESPECÍFICOS) --- */
.newdep-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem; /* REDUCIDO de 0.75rem 1.5rem */
    border-radius: 0.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #ffffff;
    background: linear-gradient(135deg, #861542 0%, #a51e5c 100%);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 3px 8px rgba(134, 21, 66, 0.3);
    position: relative;
    overflow: hidden;
    font-family: 'Poppins', sans-serif;
    z-index: 1;
}

.newdep-btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 5px 12px rgba(134, 21, 66, 0.4);
    background: linear-gradient(135deg, #6a0f37 0%, #8a1a4d 100%);
}

.newdep-btn-primary:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(134, 21, 66, 0.3);
}

.newdep-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: linear-gradient(135deg, #a51e5c 0%, #c1457c 100%);
    transform: none;
    box-shadow: 0 2px 6px rgba(134, 21, 66, 0.2);
}

.newdep-btn-secondary {
    display: inline-flex;
    align-items: center;
    padding: 0.625rem 1.25rem; /* REDUCIDO de 0.75rem 1.5rem */
    border-radius: 0.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #861542;
    background-color: #ffffff;
    border: 2px solid #861542;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    font-family: 'Poppins', sans-serif;
    z-index: 1;
}

.newdep-btn-secondary:hover {
    background-color: #861542;
    color: #ffffff;
    box-shadow: 0 3px 8px rgba(134, 21, 66, 0.2);
}

/* Botón de enlace SIN borde permanente, solo en hover */
.newdep-btn-link {
    display: inline-flex;
    align-items: center;
    padding: 0.625rem 1.25rem; /* REDUCIDO de 0.75rem 1.5rem */
    border-radius: 0.5rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #861542;
    background-color: transparent;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    text-decoration: none;
    font-family: 'Poppins', sans-serif;
    z-index: 1;
}

.newdep-btn-link:hover {
    color: #6a0f37;
    text-decoration: none;
    transform: translateX(2px);
    background-color: #f9fafb;
    border-color: #861542;
}

/* Efecto de brillo para botón primario */
.newdep-btn-primary::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s;
}

.newdep-btn-primary:hover::after {
    left: 100%;
}

/* --- Utilidades --- */
.newdep-flex {
    display: flex;
}

.newdep-justify-between {
    justify-content: space-between;
}

.newdep-justify-end {
    justify-content: flex-end;
}

.newdep-items-center {
    align-items: center;
}

/* CLASES COMPACTADAS */
.newdep-pt-6 {
    padding-top: 0.75rem !important; /* REDUCIDO de 1.5rem */
}

.newdep-border-t {
    border-top-width: 1px;
}

.newdep-border-gray-200 {
    border-color: #e5e7eb;
}

.newdep-text-sm {
    font-size: 0.8125rem;
    font-family: 'Poppins', sans-serif;
}

.newdep-text-gray-500 {
    color: #6b7280;
}

.newdep-mt-2 {
    margin-top: 0.375rem; /* REDUCIDO de 0.5rem */
}

.newdep-mr-2 {
    margin-right: 0.375rem; /* REDUCIDO de 0.5rem */
}

.newdep-w-4 {
    width: 1rem;
}

.newdep-h-4 {
    height: 1rem;
}

.newdep-font-bold {
    font-weight: 700;
    font-family: 'Poppins', sans-serif;
}

/* ELIMINA O REDUCE ESTAS CLASES QUE AGREGAN MUCHO ESPACIO */
.newdep-py-12 {
    padding-top: 0.5rem !important; /* REDUCIDO DRÁSTICAMENTE de 3rem */
    padding-bottom: 0.5rem !important;
}

.newdep-mt-10 {
    margin-top: 0.75rem !important; /* REDUCIDO de 2.5rem */
}

.newdep-ml-auto {
    margin-left: auto;
}

.newdep-w-full {
    width: 100%;
}

/* --- Spinner para botones --- */
.newdep-spinner {
    display: inline-block;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 2px solid white;
    width: 1rem;
    height: 1rem;
    animation: newdep-spin 1s linear infinite;
}

@keyframes newdep-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- DROPDOWN ESTILOS --- */
.newdep-dropdown-container { 
    position: relative; 
    width: 100%; 
    cursor: pointer; 
    z-index: 10;
}

.newdep-dropdown-selected { 
    border: 1px solid #d1d5db; 
    border-radius: 0.5rem; 
    padding: 0.625rem 0.875rem; /* REDUCIDO de 0.75rem 1rem */
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    background-color: white;
    transition: border-color 0.2s;
    color: #374151;
    font-family: 'Poppins', sans-serif;
    font-size: 0.9375rem;
    position: relative;
    z-index: 11;
}

/* Estilo para cuando el dropdown no tiene selección (placeholder) - texto gris claro */
.newdep-dropdown-selected:not(.newdep-has-selection) {
    color: #9ca3af !important;
    font-weight: 400;
}

/* DROPDOWN CON ERROR - se pone ROJO */
.newdep-dropdown-selected.newdep-error-input {
    border-color: #dc2626 !important;
    background-color: #fef2f2 !important;
    color: #374151 !important;
}

/* DROPDOWN CON ÉXITO - se pone VERDE */
.newdep-dropdown-selected.newdep-success-input {
    border-color: #10b981 !important;
    background-color: #f0fdf4 !important;
    color: #374151 !important;
}

/* Placeholder cuando hay error (debe permanecer gris) */
.newdep-dropdown-selected.newdep-error-input:not(.newdep-has-selection) {
    color: #9ca3af !important;
    font-weight: 400;
}

/* Placeholder cuando hay éxito (debe permanecer gris) */
.newdep-dropdown-selected.newdep-success-input:not(.newdep-has-selection) {
    color: #9ca3af !important;
    font-weight: 400;
}

.newdep-dropdown-selected:hover {
    border-color: #861542;
}

.newdep-dropdown-arrow { 
    margin-left: 0.5rem; 
    color: #861542;
    transition: transform 0.2s;
    font-size: 0.875rem;
}

.newdep-dropdown-selected:hover .newdep-dropdown-arrow {
    color: #6a0f37;
}

/* Flecha roja cuando hay error */
.newdep-dropdown-selected.newdep-error-input .newdep-dropdown-arrow {
    color: #dc2626 !important;
}

/* Flecha verde cuando hay éxito */
.newdep-dropdown-selected.newdep-success-input .newdep-dropdown-arrow {
    color: #10b981 !important;
}

.newdep-dropdown-options { 
    position: absolute; 
    width: 100%; 
    max-height: 200px; 
    overflow-y: auto; 
    border: 1px solid #d1d5db; 
    border-radius: 0.5rem; 
    margin-top: 0.375rem; /* REDUCIDO de 0.5rem */
    background-color: #fff; 
    z-index: 1000;
    box-shadow: 0 8px 12px -3px rgba(0, 0, 0, 0.1);
    animation: newdep-fadeIn 0.2s ease-out;
}

.newdep-dropdown-option { 
    padding: 0.625rem 0.875rem; /* REDUCIDO de 0.75rem 1rem */
    cursor: pointer; 
    transition: background-color 0.2s;
    border-bottom: 1px solid #f3f4f6;
    color: #374151;
    font-family: 'Poppins', sans-serif;
    font-size: 0.9375rem;
    background-color: #ffffff;
    position: relative;
}

.newdep-dropdown-option:last-child {
    border-bottom: none;
}

.newdep-dropdown-option:hover { 
    background-color: #fce7f3; 
    color: #861542;
}

.newdep-dropdown-option.newdep-selected {
    background-color: #fce7f3;
    color: #861542;
    font-weight: 600;
}

/* Animaciones */
@keyframes newdep-fadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Clase para animación de shake en errores */
@keyframes newdep-shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.newdep-shake {
    animation: newdep-shake 0.6s ease-in-out;
}

/* Asegurar que los mensajes de error sean visibles */
.newdep-font-medium {
    font-weight: 500;
    font-family: 'Poppins', sans-serif;
}

/* Clase para indicar que el dropdown tiene una selección */
.newdep-has-selection {
    color: #374151;
    font-weight: 400;
}

/* Texto pequeño informativo */
.newdep-text-sm.newdep-text-gray-500.newdep-mt-2 {
    font-family: 'Poppins', sans-serif;
    font-weight: 400;
    position: relative;
    z-index: 1;
}

/* Estilos para el texto del placeholder del dropdown - igual que el input */
.newdep-dropdown-selected:not(.newdep-has-selection) {
    font-weight: 400 !important;
}

/* Fondo general para evitar transparencias */
.newdep-container::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #f7f7f7;
    z-index: -1;
}

/* ====================================================
   CLASES NUEVAS PARA COMPACTAR MÁS
   ==================================================== */
.newdep-tight {
    margin: 0 !important;
    padding: 0 !important;
}

.newdep-compact-mode {
    margin-bottom: 0.75rem !important;
}

.newdep-no-top-space {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

.newdep-form-compact {
    padding: 1rem !important;
}

.newdep-form-title-compact {
    margin-bottom: 0.75rem !important;
    padding-bottom: 0.375rem !important;
    font-size: 1.25rem !important;
}

/* ====================================================
   RESPONSIVE - MÁS COMPACTO
   ==================================================== */
@media (max-width: 768px) {
    .newdep-max-w {
        padding: 0.25rem 0.5rem 1rem 0.5rem; /* Muy compacto en móvil */
    }
    
    .newdep-form-card {
        padding: 1rem !important; /* Muy compacto */
        border-radius: 0.5rem;
    }
    
    .newdep-mode-selector {
        margin-bottom: 0.75rem;
    }
    
    .newdep-mode-tab {
        padding: 0.5rem 0.75rem;
        font-size: 0.8125rem;
    }
    
    .newdep-btn-primary,
    .newdep-btn-secondary,
    .newdep-btn-link {
        padding: 0.5rem 1rem;
        font-size: 0.8125rem;
    }
    
    .newdep-form-title {
        font-size: 1.125rem;
        margin-bottom: 0.75rem;
    }
    
    .newdep-form-input,
    .newdep-dropdown-selected,
    .newdep-dropdown-option {
        font-size: 0.8125rem;
        padding: 0.5rem 0.75rem;
    }
    
    .newdep-space-y-6 > * + * {
        margin-top: 0.75rem;
    }
}

/* ====================================================
   CLASES DE UTILIDAD PARA COMPACTAR
   ==================================================== */
.newdep-font-normal {
    font-weight: 400;
    font-family: 'Poppins', sans-serif;
}

.newdep-font-semibold {
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
}

/* ====================================================
   FIX PARA HEADER ESPECÍFICO
   ==================================================== */
/* Si tu Layout tiene padding/margin, sobreescríbelo */
.newdep-container .layout-content {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

/* ====================================================
   DEBUG (descomenta si necesitas ver los espacios)
   ==================================================== */
/*
.newdep-debug * {
    outline: 1px solid rgba(255, 0, 0, 0.3) !important;
    background-color: rgba(0, 255, 0, 0.1) !important;
}
*/

/* ====================================================
   VERSIÓN EXTRA COMPACTA (si aún hay mucho espacio)
   ==================================================== */
.newdep-ultra-compact .newdep-max-w {
    padding: 0.25rem 0.75rem 1rem 0.75rem;
}

.newdep-ultra-compact .newdep-form-card {
    padding: 1rem;
}

.newdep-ultra-compact .newdep-mode-selector {
    margin-bottom: 0.5rem;
}

.newdep-ultra-compact .newdep-form-title {
    font-size: 1.125rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.375rem;
}