:root{
    --color-primario: #6c1f3b;
    --color-primario-oscuro: #4a1528;
    --color-primario-claro: #8f2e52;
    --color-gris-icono-1: #b8b8b8;
    --color-gris-icono-2: #6e6e6e;
}

body{
    background-color: #f4f2f3;
    font-family: 'Segoe UI', Roboto, Arial, sans-serif;
    color: #2c2c2c;
}

/* ===================== Botones y elementos primarios ===================== */
.btn-primary, .bg-primario{
    background-color: var(--color-primario) !important;
    border-color: var(--color-primario) !important;
}
.btn-primary:hover, .btn-primary:focus{
    background-color: var(--color-primario-oscuro) !important;
    border-color: var(--color-primario-oscuro) !important;
}
.btn-outline-primary{
    color: var(--color-primario) !important;
    border-color: var(--color-primario) !important;
}
.btn-outline-primary:hover{
    background-color: var(--color-primario) !important;
    color:#fff !important;
}
.text-primario{ color: var(--color-primario) !important; }
a{ color: var(--color-primario); }
a:hover{ color: var(--color-primario-oscuro); }

.form-check-input:checked{
    background-color: var(--color-primario);
    border-color: var(--color-primario);
}
.nav-pills .nav-link.active, .page-link.active, .page-item.active .page-link{
    background-color: var(--color-primario) !important;
    border-color: var(--color-primario) !important;
}
.form-control:focus, .form-select:focus{
    border-color: var(--color-primario-claro);
    box-shadow: 0 0 0 0.2rem rgba(108,31,59,.20);
}

/* ===================== Login ===================== */
.login-wrapper{
    min-height: 100vh;
    display:flex;
    align-items:center;
    justify-content:center;
    background: linear-gradient(135deg, var(--color-primario) 0%, var(--color-primario-oscuro) 55%, #241019 100%);
}
.login-card{
    background:#fff;
    border-radius: 14px;
    box-shadow: 0 15px 40px rgba(0,0,0,.35);
    overflow:hidden;
    max-width: 900px;
}
.login-brand{
    background: linear-gradient(160deg, var(--color-primario-claro), var(--color-primario-oscuro));
    color:#fff;
    padding: 40px 30px;
}
.login-form{ padding: 40px 35px; }
.login-brand-logo{ max-width: 220px; width: 100%; height: auto; }

/* Botón con efecto de "Iniciando sesión..." */
.btn-login.loading{
    pointer-events: none;
    opacity:.85;
}

/* ===================== Íconos embebidos en inputs (gris degradado) ===================== */
.input-icon-wrap{ position: relative; }
.input-icon-wrap .icon-embed{
    position:absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 15px;
    background: linear-gradient(180deg, var(--color-gris-icono-1), var(--color-gris-icono-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    pointer-events: none;
    z-index: 5;
}
.input-icon-wrap .form-control, .input-icon-wrap .form-select{
    padding-left: 40px;
}
.input-icon-wrap .ts-wrapper .ts-control{
    padding-left: 40px;
}
/* El menú desplegable de TomSelect debe ir SIEMPRE por encima de los modales de Bootstrap */
.ts-dropdown{ z-index: 3000 !important; }

/* ===================== Layout general del panel ===================== */
.app-wrapper{ display:flex; min-height:100vh; }
.sidebar{
    width: 260px;
    min-width: 260px;
    background: linear-gradient(180deg, var(--color-primario-oscuro), var(--color-primario));
    color:#fff;
    display:flex;
    flex-direction:column;
    position: relative;
    transition: width .25s ease, min-width .25s ease, margin-left .25s ease;
}
.sidebar .brand{
    padding: 22px 16px;
    border-bottom: 1px solid rgba(255,255,255,.15);
    text-align:center;
    overflow: hidden;
}
.sidebar .brand .brand-logo{
    max-width: 100%;
    height: auto;
    transition: max-width .25s ease;
}
.sidebar-nav{ flex:1; overflow-y:auto; overflow-x:hidden; padding: 10px 0; }
.sidebar-nav a{
    display:flex;
    align-items:center;
    gap:10px;
    color: rgba(255,255,255,.88);
    padding: 11px 20px;
    text-decoration:none;
    font-size: 14.5px;
    border-left: 3px solid transparent;
    white-space: nowrap;
}
.sidebar-nav a:hover, .sidebar-nav a.active{
    background: rgba(255,255,255,.12);
    border-left-color:#fff;
    color:#fff;
}
.sidebar-nav .titulo-seccion{
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: rgba(255,255,255,.55);
    padding: 14px 20px 6px;
    white-space: nowrap;
    overflow: hidden;
}
.sidebar-footer{
    padding: 12px 16px;
    font-size: 11px;
    text-align:center;
    color: rgba(255,255,255,.65);
    border-top: 1px solid rgba(255,255,255,.15);
    overflow: hidden;
    white-space: nowrap;
}
.sidebar-collapse-toggle{
    position: absolute;
    top: 22px;
    right: -13px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #fff;
    color: var(--color-primario);
    border: 2px solid var(--color-primario);
    align-items: center;
    justify-content: center;
    font-size: 12px;
    box-shadow: 0 2px 6px rgba(0,0,0,.25);
    z-index: 20;
    cursor: pointer;
    transition: transform .25s ease;
}
.sidebar-collapse-toggle:hover{ background: var(--color-primario); color:#fff; }

/* ===== Sidebar contraído (solo íconos) ===== */
.app-wrapper.sidebar-collapsed .sidebar{ width: 74px; min-width: 74px; }
.app-wrapper.sidebar-collapsed .sidebar .brand{ padding: 18px 8px; }
.app-wrapper.sidebar-collapsed .sidebar .brand .brand-logo{ max-width: 40px; }
.app-wrapper.sidebar-collapsed .sidebar .brand-subtitle,
.app-wrapper.sidebar-collapsed .sidebar-nav .nav-label,
.app-wrapper.sidebar-collapsed .sidebar-nav .titulo-seccion,
.app-wrapper.sidebar-collapsed .sidebar-footer .nav-label{
    display: none;
}
.app-wrapper.sidebar-collapsed .sidebar-nav a{
    justify-content: center;
    padding: 13px 0;
}
.app-wrapper.sidebar-collapsed .sidebar-collapse-toggle i{ transform: rotate(180deg); }
.main-content{ flex:1; min-width:0; display:flex; flex-direction:column; }
.topbar{
    background:#fff;
    border-bottom: 1px solid #e6e0e2;
    padding: 10px 20px;
    display:flex;
    align-items:center;
    justify-content:space-between;
}
.content-body{ padding: 22px; flex:1; }

.card-panel{
    background:#fff;
    border-radius: 10px;
    border: 1px solid #ece5e8;
    box-shadow: 0 2px 10px rgba(0,0,0,.04);
}
.card-panel .card-header{
    background: #fff;
    border-bottom: 1px solid #ece5e8;
    font-weight:600;
    color: var(--color-primario);
    padding: .7rem 1.15rem;
}

/* Separación consistente entre íconos y el texto que los acompaña
   (encabezados, botones, títulos, menú lateral). No aplica a botones de
   ícono solo dentro de grupos de acciones en tablas. */
.card-header > i:first-child,
h4 > i:first-child, h5 > i:first-child, h6 > i:first-child,
.sidebar-nav a > i:first-child,
.btn > i:first-child,
.topbar h5 > i:first-child,
.stat-card .small > i:first-child{
    margin-right: 8px;
}
.btn-group .btn > i:first-child,
.btn-group-sm .btn > i:first-child{
    margin-right: 0;
}

.badge-estatus{ font-size: 12px; padding:.45em .7em; }
.badge-pendiente{ background:#f0ad4e; color:#fff; }
.badge-atendido{ background:#2e9e5b; color:#fff; }
.badge-rechazado{ background:#c0392b; color:#fff; }
.badge-reimpresion{ background:#3498db; color:#fff; }

.stat-card{
    border-radius: 10px;
    color:#fff;
    padding: 18px;
    position:relative;
    overflow:hidden;
}
.stat-card i{ font-size: 42px; opacity:.35; position:absolute; right:16px; top:14px; }
.stat-card .valor{ font-size: 30px; font-weight:700; }
.stat-card.c1{ background: linear-gradient(135deg,var(--color-primario),var(--color-primario-oscuro)); }
.stat-card.c2{ background: linear-gradient(135deg,#f0ad4e,#c77f16); }
.stat-card.c3{ background: linear-gradient(135deg,#2e9e5b,#1f6f3f); }
.stat-card.c4{ background: linear-gradient(135deg,#c0392b,#8c281e); }

table.dataTable{ font-size: 13px; }
table.dataTable thead tr:not(.filtros) th{
    background-color: var(--color-primario) !important;
    color: #fff !important;
    font-size: 13px;
    border-color: var(--color-primario-oscuro) !important;
}
table.dataTable thead .sorting:before, table.dataTable thead .sorting:after,
table.dataTable thead .sorting_asc:before, table.dataTable thead .sorting_asc:after,
table.dataTable thead .sorting_desc:before, table.dataTable thead .sorting_desc:after{
    color: rgba(255,255,255,.75) !important;
}
table.dataTable tbody td{ font-size: 13px; }
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_paginate{ font-size: 13px; }
.dataTables_wrapper .dt-buttons .btn{ margin-right:4px; }
tr.filtros th{ background-color: #fff; }
tr.filtros input, tr.filtros select{
    width: 100%;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 8px;
}

/* Resalta en verde los campos que se autocompletaron desde la plantilla de personal */
.campo-autollenado{
    background-color: #eafbf0 !important;
    border-color: #2e9e5b !important;
    transition: background-color .4s ease, border-color .4s ease;
}
.ts-wrapper.campo-autollenado .ts-control{
    background-color: #eafbf0 !important;
    border-color: #2e9e5b !important;
}

/* Lista de sugerencias de autocompletado (Nombre completo -> plantilla) */
.lista-sugerencias-nombre{
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1080;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0,0,0,.15);
    max-height: 220px;
    overflow-y: auto;
    margin-top: 2px;
}
.lista-sugerencias-nombre .sugerencia-item{
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13.5px;
    border-bottom: 1px solid #f2eef0;
}
.lista-sugerencias-nombre .sugerencia-item:last-child{ border-bottom: none; }
.lista-sugerencias-nombre .sugerencia-item:hover,
.lista-sugerencias-nombre .sugerencia-item.activa{
    background: rgba(108,31,59,.08);
}
.lista-sugerencias-nombre .sugerencia-item small{ display:block; color:#888; }

/* Botones de acciones en las tablas: un poco más grandes que btn-sm */
.btn-group-acciones .btn{
    padding: .45rem .7rem;
    font-size: .95rem;
    line-height: 1;
}

/* Botón "Ver / Descargar PDF" con el rojo característico del logo de Adobe PDF */
.btn-pdf-adobe{
    background-color: #EC1C24;
    border-color: #EC1C24;
    color: #fff;
}
.btn-pdf-adobe:hover, .btn-pdf-adobe:focus{
    background-color: #B8151B;
    border-color: #B8151B;
    color: #fff;
}
.btn-outline-pdf-adobe{
    background-color: transparent;
    border-color: #EC1C24;
    color: #EC1C24;
}
.btn-outline-pdf-adobe:hover, .btn-outline-pdf-adobe:focus{
    background-color: #EC1C24;
    border-color: #EC1C24;
    color: #fff;
}

/* Foto de credencial (Editar / Nueva solicitud) */
.foto-credencial-wrap{
    display: inline-block;
    padding: 6px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(108,31,59,.18), rgba(108,31,59,.04));
    border: 1px solid rgba(108,31,59,.22);
    flex-shrink: 0;
}
.foto-credencial{
    width: 110px;
    height: 140px;
    object-fit: cover;
    border-radius: 8px;
    display: block;
    background: #fff;
}

/* Garantiza que el pie del modal (botones) siempre sea visible, incluso
   con formularios largos como el de Aprobar/Editar solicitud. */
.modal-dialog-scrollable .modal-body{
    max-height: 65vh;
    overflow-y: auto;
}

@media (max-width: 991px){
    .sidebar{ position:fixed; left:0; top:0; bottom:0; z-index:1040; margin-left:-260px; }
    .sidebar.show{ margin-left:0; }
    .overlay-sidebar{ display:none; position:fixed; inset:0; background:rgba(0,0,0,.4); z-index:1030; }
    .overlay-sidebar.show{ display:block; }
}
@media (max-width: 767px){
    .modal-dialog-scrollable .modal-body{ max-height: 60vh; }
}
