/* =================================================================
   ARCHIVO: css/style.css
   Estilos estáticos y overrides del sistema
   ================================================================= */

/* --- CLASE GLOBAL PARA ETIQUETAS DE FORMULARIOS --- */
.form-label {
    display: block;
    font-size: 0.75rem; /* text-xs */
    line-height: 1rem;
    color: #8e8e8e; /* text-gray-400 */
    text-transform: uppercase;
    letter-spacing: 0.025em; /* tracking-wide */
    margin-bottom: 0.25rem; /* mb-1 */
    font-weight: 400; /* Peso medio para compensar el color claro */
}

body { 
    font-family: var(--theme-font-family); 
    background-color: var(--theme-color-background); 
    -webkit-font-smoothing: antialiased; 
    -moz-osx-font-smoothing: grayscale; 
}

.btn-primary {
    background-color: var(--theme-color-primary);
    color: var(--theme-color-primary-text);
    transition: background-color 0.2s ease-in-out;
}
.btn-primary:hover { filter: brightness(110%); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.bg-primary { background-color: var(--theme-color-primary); }
.text-primary { color: var(--theme-color-primary); }
.text-primary-text { color: var(--theme-color-primary-text); }
.border-primary { border-color: var(--theme-color-primary); }

input:focus,
select:focus,
textarea:focus {
    outline: none !important;
    border-color: var(--theme-color-primary) !important;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1) !important;
}

.editable-table-container input:focus,
.editable-table-container select:focus {
    box-shadow: none !important;
    border: 1px solid;
    padding: 3px;
}

#sidebar { background-color: var(--theme-color-sidebar-bg); }
.sidebar-link { color: var(--theme-color-sidebar-text); }
.sidebar-link:hover {
    background-color: var(--theme-color-sidebar-hover-bg);
    color: var(--theme-color-sidebar-hover-text) !important;
}
.sidebar-link-active {
    background-color: var(--theme-color-primary) !important;
    color: var(--theme-color-primary-text) !important;
}

.modal-overlay { transition: opacity 0.3s ease; }
.modal-container { transition: transform 0.3s ease, opacity 0.3s ease; }
.modal-hidden { display: none; }
#app-modal.modal-open .modal-overlay { opacity: 1; }
#app-modal.modal-open .modal-container { opacity: 1; transform: scale(1); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
#main-nav::-webkit-scrollbar-track { background: var(--theme-color-sidebar-bg); }
::-webkit-scrollbar-thumb { background: #888; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #555; }
#app-dashboard.sidebar-collapsed .sidebar-link span { display: none; }
#app-dashboard.sidebar-collapsed .sidebar-link { justify-content: center; }
#app-dashboard.sidebar-collapsed .sidebar-header span { display: none; }
#app-dashboard.sidebar-collapsed #sidebar-collapse-btn svg { transform: rotate(180deg); }
#app-dashboard.sidebar-collapsed .sidebar-link { padding-left: 0.5rem; padding-right: 0.5rem; }
#app-dashboard.sidebar-collapsed .sidebar-link > i { width: 1.75rem; height: 1.75rem; }
@media (min-width: 768px) { #app-dashboard.sidebar-collapsed #sidebar { width: 5rem; } }
.logo-expanded { display: block; }
.logo-collapsed { display: none; }
#app-dashboard.sidebar-collapsed .logo-expanded { display: none; }
#app-dashboard.sidebar-collapsed .logo-collapsed { display: block; }

#app-dashboard:not(.sidebar-collapsed) .logo-container {
    padding: 5px 20px;
    border-radius: 40px;
    border: 1px solid #a19c9c;
}

#app-dashboard.sidebar-collapsed .logo-container { width: 48px; height: 48px; padding: 4px; }
#main-nav { overflow-y: auto; }

#app-dashboard.sidebar-collapsed .sidebar-category-title {
    display: none;
}

#category-nav-header {
    display: flex;
    align-items: flex-end; 
    flex-wrap: wrap; 
    margin-left: 1rem;
    height: 100%; 
    padding-top: 10px;
    border-bottom: 1px solid #e5e7eb; 
}

.category-link {
    display: flex; 
    align-items: center; 
    padding: 0.5rem 1rem;
    margin-right: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    border: 1px solid transparent;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease-in-out;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
}
.category-link:hover {
    color: #111827;
    background-color: #f3f4f6;
}
.category-link.active {
    color: var(--theme-color-primary);
    font-weight: 600;
    background-color: var(--theme-color-background);
    border-color: #e5e7eb;
    border-bottom-color: var(--theme-color-background);
    margin-bottom: -1px; 
}
.category-link.active i {
    color: var(--theme-color-primary);
}

@media (max-width: 767px) {
    #category-nav-header {
        display: none;
    }
    .sidebar-category-title {
        display: block !important;
    }
}

.tabs-nav {
    display: flex;
    border-bottom: 1px solid #e5e7eb;
}
.tab-link {
    padding: 0.5rem 1rem;
    margin-bottom: -1px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    display: flex;
    align-items: center;
    border: 1px solid #cccbcb;
    border-radius: 10px 10px 0 0;
    margin-right: 5px;
    margin-top:10px;
}
.tab-link:hover {
    color: #374151;
}
.tab-link.active {
    color: var(--theme-color-primary);
    border-color: var(--theme-color-primary);
}

.tab-link > svg {
    margin-right: 0.4rem;
    width: 0.875rem;
    height: 0.875rem;
}

.tabs-content > .tab-pane {
    display: none;
}
.tabs-content > .tab-pane.active {
    display: grid;
}

.tabs-content {
    padding-top: 1.5rem;
}

.toast {
    transition: transform 0.3s ease, opacity 0.3s ease;
}
.toast-enter {
    opacity: 0;
    transform: translateX(100%);
}
.toast-leave-to {
    opacity: 0;
    transform: scale(0.9);
}

#alert-modal {
    transition: opacity 0.3s ease-in-out;
}
.alert-modal-container {
    transition: all 0.3s ease-in-out;
}
#alert-modal.modal-enter {
    opacity: 0;
}
#alert-modal.modal-enter .alert-modal-container {
    transform: scale(0.95);
    opacity: 0;
}
#alert-modal.modal-leave {
    opacity: 0;
}
#alert-modal.modal-leave .alert-modal-container {
    transform: scale(0.95);
    opacity: 0;
}

.leaflet-container {
    z-index: 10;
}

#notification-bell {
    position: relative;
    cursor: pointer;
}
#notification-badge {
    position: absolute;
    top: -5px;
    right: -8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: #ef4444; /* red-500 */
    color: white;
    font-size: 12px;
    font-weight: 600;
    border: 2px solid white;
    transform: scale(0);
    transition: transform 0.2s ease-out;
}
#notification-badge.active {
    transform: scale(1);
}
#notification-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 320px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 70;
    transform-origin: top right;
}

:root {
    --fc-border-color: #e5e7eb;
    --fc-today-bg-color: rgba(var(--theme-color-primary-rgb), 0.05);
}
.fc {
    font-size: 0.875rem;
}

/* === INICIO DE MODIFICACIÓN: Estilos de Eventos FullCalendar (Icono Corregido) === */

.fc-event-custom {
    display: flex !important;
    align-items: center !important;
    padding: 2px 5px !important;
    border-radius: 4px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: all 0.2s ease;
    overflow: hidden;
    border: 1px solid transparent !important;
}

.fc-event-custom:hover {
    filter: brightness(110%);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.fc-event-custom .fc-event-icon {
    width: 14px;
    height: 14px;
    margin-right: 5px;
    flex-shrink: 0;
}

.fc-event-custom .fc-event-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Corrección de color de texto E ICONO --- */
.fc-event-evento .fc-event-title, .fc-event-evento .fc-event-icon { color: var(--theme-color-primary-dark, #1e40af) !important; }
.fc-event-feriado .fc-event-title, .fc-event-feriado .fc-event-icon { color: #b91c1c !important; }
.fc-event-vacaciones .fc-event-title, .fc-event-vacaciones .fc-event-icon { color: #1d4ed8 !important; }
.fc-event-cumpleaños .fc-event-title, .fc-event-cumpleaños .fc-event-icon { color: #b45309 !important; }
.fc-event-alerta .fc-event-title, .fc-event-alerta .fc-event-icon { color: #c2410c !important; }

/* --- Fondos --- */
.fc-event-evento { background-color: var(--theme-color-primary-light, #ebf4ff) !important; border-color: var(--theme-color-primary, #60a5fa) !important; }
.fc-event-feriado { background-color: #fef2f2 !important; border-color: #fca5a5 !important; }
.fc-event-vacaciones { background-color: #eff6ff !important; border-color: #93c5fd !important; }
.fc-event-cumpleaños { background-color: #fffbeb !important; border-color: #fcd34d !important; }
.fc-event-alerta { background-color: #fff7ed !important; border-color: #fdba74 !important; }
/* === FIN DE MODIFICACIÓN (Icono Corregido) === */


/* === INICIO DE MODIFICACIÓN: Propuesta A Refinada (Estilo CRM) === */

/* 1. Contenedor Izquierdo (Título + Icono) */
.fc .fc-toolbar-chunk:first-child {
    display: flex;
    align-items: center;
}
.fc .fc-toolbar-title {
    font-size: 1.25rem !important;
    font-weight: 600 !important;
    color: #1f2937; /* gray-800 */
}
/* Inyectar el icono de calendario */
.fc .fc-toolbar-title::before {
    content: '';
    width: 24px;
    height: 24px;
    display: inline-block;
    vertical-align: -4px;
    margin-right: 0.65rem; /* 10px */
    background-color: var(--theme-color-primary); /* gray-600 */
    /* Icono: calendar-days */
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 2v4'/%3E%3Cpath d='M16 2v4'/%3E%3Crect width='18' height='18' x='3' y='4' rx='2'/%3E%3Cpath d='M3 10h18'/%3E%3Cpath d='M8 14h.01'/%3E%3Cpath d='M12 14h.01'/%3E%3Cpath d='M16 14h.01'/%3E%3Cpath d='M8 18h.01'/%3E%3Cpath d='M12 18h.01'/%3E%3Cpath d='M16 18h.01'/%3E%3C/svg%3E");
    mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
}

/* 2. Contenedor Derecho (Acciones) */
.fc .fc-toolbar-chunk:last-child {
    display: flex;
    align-items: center;
    gap: 0.75rem; /* 12px de espacio entre grupos */
}

/* Reset general de botones */
.fc .fc-button {
    background: none !important;
    border: none !important;
    padding: 0 !important;
    text-transform: capitalize !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}
.fc .fc-button:focus { box-shadow: none !important; }
.fc .fc-button .fc-icon { font-size: 1.25em; }

/* Grupo 1A: Navegación (< >) */
.fc .fc-toolbar-chunk:last-child .fc-button-group:first-child .fc-button {
    padding: 0.5rem !important; /* 8px */
    background-color: transparent !important;
    color: #6b7280 !important; /* gray-500 */
    transition: all 0.2s ease;
    border: 1px solid #d1d5db !important; /* gray-300 */
}
.fc .fc-toolbar-chunk:last-child .fc-button-group:first-child .fc-button:first-child {
    border-top-left-radius: 9999px !important;
    border-bottom-left-radius: 9999px !important;
}
.fc .fc-toolbar-chunk:last-child .fc-button-group:first-child .fc-button:last-child {
    border-top-right-radius: 9999px !important;
    border-bottom-right-radius: 9999px !important;
    border-left-width: 0 !important;
}
.fc .fc-toolbar-chunk:last-child .fc-button-group:first-child .fc-button:hover {
    background-color: #f3f4f6 !important; /* gray-100 */
    color: #111827 !important; /* gray-900 */
}

/* Grupo 1B: "Hoy" (con icono) */
.fc .fc-today-button {
    padding: 0.45rem 0.75rem !important; /* Ajuste fino de padding */
    font-size: 0.875rem !important; /* 14px */
    font-weight: 500 !important;
    color: #4b5563 !important; /* gray-600 */
    border: 1px solid #d1d5db !important; /* gray-300 */
    background-color: #ffffff !important;
    border-radius: 0.375rem !important; /* 6px */
    transition: all 0.2s ease;
}
.fc .fc-today-button:hover {
    background-color: #f3f4f6 !important; /* gray-100 */
    color: #111827 !important; /* gray-900 */
}
.fc .fc-today-button:disabled {
    opacity: 0.5 !important;
    color: #9ca3af !important;
}
.fc .fc-today-button::before {
    content: ''; width: 16px; height: 16px; margin-right: 6px; display: inline-block; background-color: currentColor;
    /* Icono: calendar-check */
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 2v4'/%3E%3Cpath d='M16 2v4'/%3E%3Crect width='18' height='18' x='3' y='4' rx='2'/%3E%3Cpath d='M3 10h18'/%3E%3Cpath d='m9 16 2 2 4-4'/%3E%3C/svg%3E");
    mask-size: contain; mask-repeat: no-repeat; mask-position: center;
}

/* Grupo 2: "Pastilla" de Vistas (Mes/Semana/Día) */
.fc-toolbar-chunk:last-child .fc-button-group:last-child {
    display: inline-flex;
    background-color: #f3f4f6; /* gray-100 */
    border-radius: 0.375rem; /* 6px */
    padding: 0.25rem; /* 4px */
}

.fc-toolbar-chunk:last-child .fc-button-group:last-child .fc-button {
    font-size: 0.875rem !important; /* 14px */
    font-weight: 500 !important;
    padding: 0.375rem 0.5rem !important; /* 6px 8px */
    min-width: 90px !important; /* Ancho mínimo uniforme */
    text-align: center !important;
    justify-content: center !important;
    border-radius: 0.25rem !important;
    color: #4b5563 !important;
    transition: all 0.2s ease;
    border: none !important; /* Sin bordes dentro de la pastilla */
}

.fc-toolbar-chunk:last-child .fc-button-group:last-child .fc-button:not(.fc-button-active):hover {
        color: #111827 !important;
}

.fc .fc-button.fc-button-active {
    background-color: #ffffff !important;
    color: var(--theme-color-primary) !important;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1) !important;
}

/* Iconos para Vistas */
.fc .fc-dayGridMonth-button::before {
    content: ''; display: inline-block; width: 16px; height: 16px; margin-right: 6px; background-color: currentColor;
    /* Icono: calendar-days */
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='18' height='18' x='3' y='4' rx='2'/%3E%3Cpath d='M16 2v4'/%3E%3Cpath d='M8 2v4'/%3E%3Cpath d='M3 10h18'/%3E%3Cpath d='M8 14h.01'/%3E%3Cpath d='M12 14h.01'/%3E%3Cpath d='M16 14h.01'/%3E%3Cpath d='M8 18h.01'/%3E%3Cpath d='M12 18h.01'/%3E%3Cpath d='M16 18h.01'/%3E%3C/svg%3E");
    mask-size: contain; mask-repeat: no-repeat; mask-position: center;
}
.fc .fc-timeGridWeek-button::before {
    content: ''; display: inline-block; width: 16px; height: 16px; margin-right: 6px; background-color: currentColor;
    /* Icono: view-week (custom) */
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='18' height='18' x='3' y='4' rx='2'/%3E%3Cpath d='M3 10h18'/%3E%3Cpath d='M8 14h.01'/%3E%3Cpath d='M12 14h.01'/%3E%3Cpath d='M16 14h.01'/%3E%3Cpath d='M8 18h.01'/%3E%3Cpath d='M12 18h.01'/%3E%3Cpath d='M16 18h.01'/%3E%3C/svg%3E");
    mask-size: contain; mask-repeat: no-repeat; mask-position: center;
}
.fc .fc-timeGridDay-button::before {
    content: ''; display: inline-block; width: 16px; height: 16px; margin-right: 6px; background-color: currentColor;
    /* Icono: view-day (custom) */
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='18' height='18' x='3' y='4' rx='2'/%3E%3Cpath d='M3 10h18'/%3E%3Cpath d='M12 14v4'/%3E%3C/svg%3E");
    mask-size: contain; mask-repeat: no-repeat; mask-position: center;
}
