/* ============================================================
   KOMUNAH — Hoja de estilos personalizada
   Sistema de Tickets · RRHH · Estructura
   ------------------------------------------------------------
   Esta archivo centraliza TODO el CSS personalizado del proyecto
   para que las vistas Blade queden limpias y sin <style> inline.
   ============================================================ */

/* ------------------------------------------------------------
   1. Base / Layout
   ------------------------------------------------------------ */
body {
    background-color: #f5f8fa !important;
}

/* El aside-primary usa el color corporativo oscuro */
.aside-primary {
    background-color: #000C16 !important;
}

/* --- Ancho del menú principal (primary) y secundario (secondary) --- */
/* Menú principal ligeramente más ancho (100 → 110px) */
@media (min-width: 992px) {
    .aside .aside-primary {
        width: 110px;
    }
    /* El menú secundario compensa quitando ese ancho extra (325 → 315px) */
    .aside .aside-secondary .aside-workspace {
        width: 315px;
    }
    .aside-secondary-enabled .aside {
        width: 425px;
    }
    /* Cuando se minimiza/colapsa el menú secundario */
    body[data-kt-aside-minimize="on"] .aside,
    [data-kt-aside-minimize="on"] .aside {
        width: 110px !important;
        transition: width 0.3s ease;
    }
    body[data-kt-aside-minimize="on"] .wrapper,
    [data-kt-aside-minimize="on"] .wrapper {
        padding-left: 110px !important;
        transition: padding-left 0.3s ease;
    }
}

/* Iconos del aside-primary en blanco semi-transparente */
.aside-primary .svg-icon svg [fill]:not(.permanent):not(g) {
    fill: rgba(255, 255, 255, 0.5) !important;
}

/* Icono activo / hover en aside-primary */
.aside-primary .btn-custom:hover .svg-icon svg [fill]:not(.permanent):not(g),
.aside-primary .btn-custom.active .svg-icon svg [fill]:not(.permanent):not(g) {
    fill: #ffffff !important;
}

/* --- Iconos del menú principal (Phosphor Thin) --- */
/* Phosphor Thin ya es visualmente fino; ajustamos tamaño y opacidad */
.aside-primary .nav-link [class*="ph-thin-"] {
    font-size: 1.75rem !important;
    color: rgba(255, 255, 255, 0.55);
    transition: color 0.2s ease, transform 0.2s ease;
}

/* Icono activo / hover: color blanco completo y ligera reducción de escala */
.aside-primary .nav-link.active [class*="ph-thin-"],
.aside-primary .nav-link:hover [class*="ph-thin-"] {
    color: #ffffff;
    transform: scale(0.95);
}

/* Botón activo en aside-primary: iluminado con ámbar corporativo #E5A653 */
.aside-primary .aside-nav .nav-item .nav-link.btn.btn-custom.active,
.aside-primary .aside-nav .nav-item .nav-link.active {
    background-color: rgba(229, 166, 83, 0.18) !important;
    border-radius: 12px;
}

/* Icono del módulo activo en ámbar brillante */
.aside-primary .btn-custom.active [class*="ph-thin-"],
.aside-primary .nav-link.active [class*="ph-thin-"] {
    color: #E5A653 !important;
}

/* --- Buscador del Header --- */
.header form input[name="q"] {
    transition: all 0.25s ease-in-out;
}

.header form input[name="q"]:focus {
    background-color: #ffffff !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06) !important;
    outline: none;
}

/* ------------------------------------------------------------
   2. Tarjetas y secciones
   ------------------------------------------------------------ */
.card {
    border: 0;
    border-radius: 0.75rem;
    box-shadow: 0 0 20px 0 rgba(76, 87, 125, 0.02);
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: 0 0 30px 0 rgba(76, 87, 125, 0.06);
}

.card-header {
    border-bottom: 1px solid #eff2f5;
}

/* ------------------------------------------------------------
   3. Tablas
   ------------------------------------------------------------ */
.table > :not(caption) > * > * {
    padding: 0.85rem 0.75rem;
}

.table thead th {
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    color: #a1a5b7;
}

.table tbody tr {
    transition: background-color 0.15s ease;
}

.table tbody tr:hover {
    background-color: #f9fafb;
}

/* ------------------------------------------------------------
   4. Badges y estados
   ------------------------------------------------------------ */
.badge {
    font-size: 0.7rem;
    letter-spacing: 0.02em;
    padding: 0.4rem 0.65rem;
    border-radius: 0.4rem;
}

/* ------------------------------------------------------------
   5. Formularios
   ------------------------------------------------------------ */
.form-control.form-control-solid,
.form-select.form-select-solid {
    background-color: #f5f8fa;
    border: 1px solid #f5f8fa;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.form-control.form-control-solid:focus,
.form-select.form-select-solid:focus {
    border-color: #009ef7;
    background-color: #fff;
}

.form-control.form-control-solid::placeholder {
    color: #b5b5c3;
    font-weight: 400;
}

/* Labels de formulario consistentes */
.form-label {
    font-weight: 600;
    font-size: 0.875rem;
    color: #181c32;
    margin-bottom: 0.5rem;
}

/* Etiqueta "requerido" */
.required::after {
    content: ' *';
    color: #f1416c;
}

/* ------------------------------------------------------------
   6. Botones
   ------------------------------------------------------------ */
.btn {
    border-radius: 0.475rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    transition: all 0.15s ease;
}

.btn-sm {
    padding: 0.5rem 0.9rem;
}

/* ------------------------------------------------------------
   7. Progress bars
   ------------------------------------------------------------ */
.progress {
    border-radius: 0.5rem;
    background-color: #f5f8fa;
}

.progress-bar {
    border-radius: 0.5rem;
    transition: width 0.4s ease;
}

/* ------------------------------------------------------------
   8. Empty states (estados vacíos)
   ------------------------------------------------------------ */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #a1a5b7;
}

.empty-state i,
.empty-state .svg-icon {
    font-size: 3rem;
    opacity: 0.4;
    margin-bottom: 1rem;
    display: block;
}

.empty-state .empty-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: #7e8299;
    margin-bottom: 0.25rem;
}

.empty-state .empty-hint {
    font-size: 0.85rem;
    font-weight: 500;
}

/* ------------------------------------------------------------
   9. Timeline (bitácora)
   ------------------------------------------------------------ */
.timeline-label .timeline-item {
    position: relative;
}

/* ------------------------------------------------------------
   10. Checklist items
   ------------------------------------------------------------ */
.checklist-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    border-radius: 0.5rem;
    background-color: #f9fafb;
    border: 1px solid #eff2f5;
    margin-bottom: 0.5rem;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.checklist-item:hover {
    background-color: #f5f8fa;
    border-color: #e4e6ef;
}

.checklist-item.is-completed {
    opacity: 0.7;
}

.checklist-item.is-completed .checklist-label {
    text-decoration: line-through;
    color: #a1a5b7;
}

/* ------------------------------------------------------------
   11. Kanban
   ------------------------------------------------------------ */
.kanban-card {
    border: 1px dashed #e4e6ef;
    border-radius: 0.625rem;
    padding: 1rem;
    background-color: #fff;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.kanban-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    border-color: #d6d8e5;
}

/* ------------------------------------------------------------
   12. Avatares / Symbols
   ------------------------------------------------------------ */
.symbol .symbol-label {
    font-weight: 700;
}

/* ------------------------------------------------------------
   13. Modales
   ------------------------------------------------------------ */
.modal-content {
    border: 0;
    border-radius: 0.75rem;
    box-shadow: 0 0 40px 0 rgba(0, 0, 0, 0.12);
}

.modal-header {
    border-bottom: 1px solid #eff2f5;
}

.modal-footer {
    border-top: 1px solid #eff2f5;
}

/* ------------------------------------------------------------
   14. Toast / notificaciones (estilo refinado)
   ------------------------------------------------------------ */
.swal2-toast {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08) !important;
    border-radius: 0.5rem !important;
}

/* ------------------------------------------------------------
   15. Scrollbar personalizado
   ------------------------------------------------------------ */
.hover-scroll-y::-webkit-scrollbar {
    width: 6px;
}

.hover-scroll-y::-webkit-scrollbar-track {
    background: transparent;
}

.hover-scroll-y::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 3px;
}

.hover-scroll-y::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* ------------------------------------------------------------
   16. Separadores con etiqueta
   ------------------------------------------------------------ */
.form-section-title {
    text-transform: uppercase;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #a1a5b7;
    margin-bottom: 0.75rem;
}

/* ------------------------------------------------------------
   17. Filtros de tabla (barra superior)
   ------------------------------------------------------------ */
.table-filters-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* ------------------------------------------------------------
   18. Animaciones sutiles
   ------------------------------------------------------------ */
.fade-in {
    animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ------------------------------------------------------------
   19. Impresión del Expediente Físico
   ------------------------------------------------------------ */
@media print {
    /* Ocultar navegación, header y elementos de interacción */
    .header,
    .aside,
    .footer,
    .toolbar,
    .btn,
    .modal,
    .navbar,
    .sidebar,
    .d-print-none,
    .card-toolbar,
    form,
    .nav-tabs {
        display: none !important;
    }

    /* Ajustar layout para impresión */
    body,
    .app-wrapper,
    .app-main,
    .app-content,
    .content,
    .container-fluid {
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        background: #fff !important;
    }

    .row {
        display: block !important;
    }

    .col-xl-4,
    .col-xl-8 {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Mostrar todas las pestañas en impresión */
    .tab-pane {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
    }

    /* Tarjetas sin sombra ni bordes decorativos */
    .card {
        border: 1px solid #ccc !important;
        box-shadow: none !important;
        margin-bottom: 15px !important;
        break-inside: avoid;
    }

    /* Encabezado del expediente */
    .expediente-header {
        display: block !important;
    }

    /* Asegurar colores de fondo legibles */
    .bg-light,
    .badge {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* ------------------------------------------------------------
   20. Calendario de Reservas
   ------------------------------------------------------------ */
.calendario-semanal {
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.calendario-semanal th,
.calendario-semanal td {
    border: 1px solid #ebedf2;
    text-align: center;
    vertical-align: middle;
    padding: 0.25rem 0.35rem;
}
.cal-col-hora {
    width: 70px;
    background-color: #f8f9fa;
}
.cal-col-dia {
    min-width: 130px;
}
.cal-dia-hoy {
    background-color: #e8f4ff !important;
    border: 2px solid #009efb !important;
}
.cal-cell {
    height: 32px;
    cursor: default;
    transition: background-color 0.15s;
}
.cal-cell-libre {
    background-color: #f3f6f9;
}
.cal-cell-libre:hover {
    background-color: #e8f5e9;
}
.cal-cell-ocupada {
    background-color: #fff4eb;
}
.cal-reserva {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    padding: 2px 6px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.cal-reserva-nombre {
    font-weight: 700;
    font-size: 0.75rem;
    line-height: 1.1;
}
.cal-reserva-hora {
    color: #7e8299;
    font-weight: 600;
}
.cal-reserva-continua {
    width: 100%;
    height: 100%;
    background-color: #fde4c9;
    border-left: 3px solid #ffa800;
}
.cal-leyenda-box {
    display: inline-block;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 1px solid #ebedf2;
}

/* ------------------------------------------------------------
   21. Pantalla de Login
   ------------------------------------------------------------ */
body.login-bg {
    background-color: #000C16 !important;
}

/* ------------------------------------------------------------
   21. Calendario RRHH
   ------------------------------------------------------------ */
.calendario-table {
    table-layout: fixed;
    width: 100%;
}

.calendario-table th,
.calendario-table td {
    width: calc(100% / 7);
    vertical-align: top;
}

.calendario-cell {
    height: 100px;
    min-height: 100px;
    padding: .5rem;
    overflow: hidden;
}

.calendario-cell-body {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    overflow: hidden;
}

.calendario-event {
    display: flex;
    align-items: center;
    gap: .25rem;
    width: 100%;
    padding: .2rem .4rem;
    border: none;
    border-radius: .375rem;
    font-size: .7rem;
    font-weight: 700;
    line-height: 1.2;
    text-align: left;
    overflow: hidden;
    cursor: pointer;
    transition: filter .15s ease, transform .15s ease;
}

.calendario-event:hover {
    filter: brightness(.92);
    transform: translateY(-1px);
}

.calendario-event:focus-visible {
    outline: 2px solid #7239EA;
    outline-offset: 1px;
}

.calendario-event-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ------------------------------------------------------------
   8. SweetAlert2 Custom Styling
   ------------------------------------------------------------ */
.swal2-actions .btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-weight: 600 !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.swal2-actions .btn-secondary,
.swal2-actions .btn-light {
    background-color: #7e8299 !important;
    border-color: #7e8299 !important;
    color: #ffffff !important;
}