/* ========================================
   TEMA SERVIR MATERIAL DESIGN - ULTRA COMPACTO
   Sistema de Gestion de Recursos Humanos
   Color Principal: Verde SERVIR #198754
   ======================================== */

:root {
    /* Colores SERVIR - Paleta Principal */
    --servir-primary: #198754;
    --servir-primary-dark: #146c43;
    --servir-primary-light: #25a866;
    --servir-primary-50: rgba(25, 135, 84, 0.1);
    --servir-primary-100: rgba(25, 135, 84, 0.2);

    /* Colores Secundarios */
    --servir-secondary: #0d6efd;
    --servir-accent: #20c997;
    --servir-info: #0dcaf0;
    --servir-warning: #ffc107;
    --servir-danger: #dc3545;
    --servir-success: #198754;

    /* Grises Material */
    --gray-50: #fafafa;
    --gray-100: #f5f5f5;
    --gray-200: #eeeeee;
    --gray-300: #e0e0e0;
    --gray-400: #bdbdbd;
    --gray-500: #9e9e9e;
    --gray-600: #757575;
    --gray-700: #616161;
    --gray-800: #424242;
    --gray-900: #212121;

    /* Sombras Material - Sutiles */
    --shadow-1: 0 1px 2px rgba(0,0,0,0.1);
    --shadow-2: 0 2px 4px rgba(0,0,0,0.12);
    --shadow-3: 0 4px 8px rgba(0,0,0,0.15);

    /* Transiciones */
    --transition-fast: 0.1s ease;
    --transition-normal: 0.2s ease;

    /* Border Radius - Minimos */
    --radius-sm: 3px;
    --radius-md: 4px;
    --radius-lg: 6px;
    --radius-full: 9999px;
}

/* ========================================
   TIPOGRAFIA - COMPACTA
   ======================================== */

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 13px;
    line-height: 1.4;
}

/* ========================================
   CARDS MATERIAL - COMPACTO
   ======================================== */

.card-material {
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-1);
    border: none;
    overflow: hidden;
}

.card-material:hover {
    box-shadow: var(--shadow-2);
}

.card-material .card-header {
    background: linear-gradient(135deg, var(--servir-primary) 0%, var(--servir-primary-dark) 100%);
    color: white;
    border: none;
    padding: 8px 12px;
    font-weight: 500;
    font-size: 0.85rem;
}

.card-material .card-header h5,
.card-material .card-header h6 {
    margin: 0;
    font-weight: 500;
    font-size: 0.85rem;
}

.card-material .card-body {
    padding: 10px 12px;
}

/* ========================================
   HEADER DE PAGINA - ULTRA COMPACTO
   ======================================== */

.page-header-material {
    background: linear-gradient(135deg, var(--servir-primary) 0%, var(--servir-primary-light) 100%);
    border-radius: var(--radius-md);
    padding: 8px 16px;
    margin-bottom: 8px;
    color: white;
    box-shadow: var(--shadow-1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.page-header-material .page-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
}

.page-header-material .page-subtitle {
    font-size: 0.7rem;
    opacity: 0.85;
    margin: 0;
}

.page-header-material .header-actions {
    display: flex;
    gap: 6px;
}

/* ========================================
   BOTONES - COMPACTOS
   ======================================== */

.btn-material {
    border-radius: var(--radius-sm);
    padding: 4px 12px;
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: none;
    transition: var(--transition-fast);
    border: none;
    box-shadow: var(--shadow-1);
}

.btn-material:hover {
    box-shadow: var(--shadow-2);
}

.btn-material-sm {
    padding: 2px 8px;
    font-size: 0.7rem;
}

.btn-servir-primary {
    background: linear-gradient(135deg, var(--servir-primary) 0%, var(--servir-primary-dark) 100%);
    color: white;
}

.btn-servir-primary:hover {
    background: linear-gradient(135deg, var(--servir-primary-light) 0%, var(--servir-primary) 100%);
    color: white;
}

.btn-servir-outline {
    background: white;
    border: 1px solid var(--servir-primary);
    color: var(--servir-primary);
    box-shadow: none;
}

.btn-servir-outline:hover {
    background: var(--servir-primary-50);
    color: var(--servir-primary-dark);
}

.btn-servir-secondary {
    background: var(--gray-600);
    color: white;
}

.btn-servir-accent {
    background: var(--servir-accent);
    color: white;
}

/* ========================================
   ESTADISTICAS KPI - ULTRA COMPACTO
   ======================================== */

.stats-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.stat-card {
    background: white;
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    box-shadow: var(--shadow-1);
    border-left: 3px solid var(--servir-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 120px;
    flex: 1;
}

.stat-card:hover {
    box-shadow: var(--shadow-2);
}

.stat-card.primary { border-left-color: var(--servir-primary); }
.stat-card.info { border-left-color: var(--servir-info); }
.stat-card.warning { border-left-color: var(--servir-warning); }
.stat-card.success { border-left-color: var(--servir-success); }
.stat-card.danger { border-left-color: var(--servir-danger); }
.stat-card.dark { border-left-color: var(--gray-800); }

.stat-card .stat-icon {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.stat-card.primary .stat-icon { background: var(--servir-primary-50); color: var(--servir-primary); }
.stat-card.info .stat-icon { background: rgba(13, 202, 240, 0.1); color: var(--servir-info); }
.stat-card.warning .stat-icon { background: rgba(255, 193, 7, 0.1); color: #997404; }
.stat-card.success .stat-icon { background: rgba(25, 135, 84, 0.1); color: var(--servir-success); }
.stat-card.danger .stat-icon { background: rgba(220, 53, 69, 0.1); color: var(--servir-danger); }
.stat-card.dark .stat-icon { background: rgba(33, 37, 41, 0.1); color: var(--gray-800); }

.stat-card .stat-content {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.stat-card .stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-900);
}

.stat-card .stat-label {
    font-size: 0.65rem;
    color: var(--gray-600);
    font-weight: 500;
    text-transform: uppercase;
}

/* ========================================
   TABLAS - ULTRA COMPACTAS
   ======================================== */

.table-material {
    background: white;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-1);
    overflow: hidden;
}

.table-material table {
    margin-bottom: 0;
    font-size: 0.75rem;
}

.table-material thead {
    background: linear-gradient(135deg, var(--servir-primary) 0%, var(--servir-primary-dark) 100%);
}

.table-material thead th {
    color: white;
    font-weight: 500;
    padding: 6px 8px;
    border: none;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.table-material tbody tr {
    transition: var(--transition-fast);
    border-bottom: 1px solid var(--gray-200);
}

.table-material tbody tr:last-child {
    border-bottom: none;
}

.table-material tbody tr:hover {
    background: var(--servir-primary-50);
}

.table-material tbody td {
    padding: 4px 8px;
    vertical-align: middle;
    color: var(--gray-800);
}

/* Acciones en tabla */
.table-material .btn-table-action {
    padding: 2px 6px;
    font-size: 0.7rem;
    margin: 0 1px;
}

/* ========================================
   FORMULARIOS - ULTRA COMPACTOS
   ======================================== */

.form-material .form-control {
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    font-size: 0.75rem;
    transition: var(--transition-fast);
    background: var(--gray-50);
    height: auto;
}

.form-material .form-control:focus {
    border-color: var(--servir-primary);
    background: white;
    box-shadow: 0 0 0 2px var(--servir-primary-50);
    outline: none;
}

.form-material .form-control:hover:not(:focus) {
    border-color: var(--gray-400);
    background: white;
}

.form-material .form-label {
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 2px;
    font-size: 0.7rem;
}

.form-material .form-select {
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    font-size: 0.75rem;
    transition: var(--transition-fast);
    background-color: var(--gray-50);
    height: auto;
}

.form-material .form-select:focus {
    border-color: var(--servir-primary);
    background-color: white;
    box-shadow: 0 0 0 2px var(--servir-primary-50);
    outline: none;
}

/* Inputs inline compactos */
.form-inline-compact {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.form-inline-compact .form-group {
    margin-bottom: 0;
}

.form-inline-compact label {
    font-size: 0.7rem;
    margin-right: 4px;
    white-space: nowrap;
}

/* ========================================
   BADGES - COMPACTOS
   ======================================== */

.badge-material {
    padding: 2px 6px;
    border-radius: var(--radius-full);
    font-weight: 500;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-servir-primary {
    background: var(--servir-primary);
    color: white;
}

.badge-servir-info {
    background: var(--servir-info);
    color: var(--gray-900);
}

.badge-servir-warning {
    background: var(--servir-warning);
    color: var(--gray-900);
}

.badge-servir-success {
    background: var(--servir-success);
    color: white;
}

.badge-servir-danger {
    background: var(--servir-danger);
    color: white;
}

.badge-servir-secondary {
    background: var(--gray-500);
    color: white;
}

.badge-servir-dark {
    background: var(--gray-800);
    color: white;
}

/* ========================================
   BREADCRUMB - COMPACTO
   ======================================== */

.breadcrumb-material {
    background: transparent;
    padding: 0;
    margin-bottom: 8px;
    font-size: 0.7rem;
}

.breadcrumb-material .breadcrumb-item a {
    color: var(--servir-primary);
    text-decoration: none;
}

.breadcrumb-material .breadcrumb-item a:hover {
    text-decoration: underline;
}

.breadcrumb-material .breadcrumb-item.active {
    color: var(--gray-600);
}

.breadcrumb-material .breadcrumb-item + .breadcrumb-item::before {
    content: '>';
    color: var(--gray-400);
}

/* ========================================
   FILTROS - ULTRA COMPACTO
   ======================================== */

.filters-card {
    background: white;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-1);
    padding: 6px 10px;
    margin-bottom: 8px;
    border-left: 3px solid var(--servir-primary);
}

.filters-card .filter-title {
    font-weight: 600;
    font-size: 0.7rem;
    color: var(--gray-700);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.filters-card .filter-title i {
    color: var(--servir-primary);
    font-size: 0.75rem;
}

.filters-card .row {
    margin-left: -4px;
    margin-right: -4px;
}

.filters-card .row > [class*="col-"] {
    padding-left: 4px;
    padding-right: 4px;
}

/* ========================================
   ALERTAS - COMPACTAS
   ======================================== */

.alert-material {
    border-radius: var(--radius-sm);
    border: none;
    padding: 8px 12px;
    box-shadow: var(--shadow-1);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    margin-bottom: 8px;
}

.alert-material.alert-success {
    background: rgba(25, 135, 84, 0.1);
    border-left: 3px solid var(--servir-success);
    color: var(--servir-primary-dark);
}

.alert-material.alert-danger {
    background: rgba(220, 53, 69, 0.1);
    border-left: 3px solid var(--servir-danger);
    color: #842029;
}

.alert-material.alert-warning {
    background: rgba(255, 193, 7, 0.1);
    border-left: 3px solid var(--servir-warning);
    color: #664d03;
}

.alert-material.alert-info {
    background: rgba(13, 202, 240, 0.1);
    border-left: 3px solid var(--servir-info);
    color: #055160;
}

/* ========================================
   LISTA DE ACCIONES - COMPACTA
   ======================================== */

.action-list {
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-1);
    overflow: hidden;
}

.action-list .action-header {
    background: linear-gradient(135deg, var(--servir-primary) 0%, var(--servir-primary-dark) 100%);
    color: white;
    padding: 8px 12px;
    font-weight: 500;
    font-size: 0.8rem;
}

.action-list .action-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border: none;
    background: white;
    width: 100%;
    text-align: left;
    transition: var(--transition-fast);
    cursor: pointer;
    border-bottom: 1px solid var(--gray-200);
    font-size: 0.75rem;
}

.action-list .action-item:last-child {
    border-bottom: none;
}

.action-list .action-item:hover {
    background: var(--servir-primary-50);
}

.action-list .action-item.active {
    background: var(--servir-primary);
    color: white;
}

.action-list .action-item .action-badge {
    background: var(--gray-200);
    color: var(--gray-700);
    padding: 2px 6px;
    border-radius: var(--radius-full);
    font-size: 0.65rem;
    font-weight: 600;
}

.action-list .action-item.active .action-badge {
    background: rgba(255,255,255,0.2);
    color: white;
}

/* ========================================
   PANEL ACCIONES MASIVAS - COMPACTO
   ======================================== */

.actions-panel {
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-1);
    overflow: hidden;
    margin-top: 8px;
}

.actions-panel .panel-header {
    background: var(--gray-100);
    padding: 8px 12px;
    font-weight: 600;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-200);
    font-size: 0.75rem;
}

.actions-panel .panel-body {
    padding: 8px 12px;
}

.actions-panel .action-btn {
    width: 100%;
    margin-bottom: 6px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.actions-panel .action-btn:last-child {
    margin-bottom: 0;
}

/* ========================================
   LOADER - COMPACTO
   ======================================== */

.loader-material {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 15px;
}

.loader-material .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--servir-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loader-material .loader-text {
    margin-top: 10px;
    color: var(--gray-600);
    font-size: 0.75rem;
}

/* ========================================
   EMPTY STATE - COMPACTO
   ======================================== */

.empty-state {
    text-align: center;
    padding: 30px 15px;
    color: var(--gray-500);
}

.empty-state .empty-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
    opacity: 0.5;
}

.empty-state .empty-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 4px;
}

.empty-state .empty-text {
    font-size: 0.8rem;
    color: var(--gray-500);
}

/* ========================================
   TABS - COMPACTOS
   ======================================== */

.nav-tabs-material {
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 10px;
}

.nav-tabs-material .nav-link {
    border: none;
    border-bottom: 2px solid transparent;
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--gray-600);
    margin-bottom: -2px;
    transition: var(--transition-fast);
}

.nav-tabs-material .nav-link:hover {
    color: var(--servir-primary);
    border-bottom-color: var(--servir-primary-50);
}

.nav-tabs-material .nav-link.active {
    color: var(--servir-primary);
    border-bottom-color: var(--servir-primary);
    background: transparent;
}

/* ========================================
   MODALES - COMPACTOS
   ======================================== */

.modal-material .modal-header {
    background: linear-gradient(135deg, var(--servir-primary) 0%, var(--servir-primary-dark) 100%);
    color: white;
    padding: 10px 15px;
    border: none;
}

.modal-material .modal-title {
    font-size: 0.9rem;
    font-weight: 500;
}

.modal-material .modal-body {
    padding: 12px 15px;
}

.modal-material .modal-footer {
    padding: 8px 15px;
    border-top: 1px solid var(--gray-200);
}

.modal-material .btn-close {
    filter: invert(1);
}

/* ========================================
   PAGINACION - COMPACTA
   ======================================== */

.pagination-material {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 0.7rem;
}

.pagination-material .page-info {
    color: var(--gray-600);
}

.pagination-material .page-link {
    padding: 3px 8px;
    font-size: 0.7rem;
    border-radius: var(--radius-sm);
    margin: 0 2px;
}

.pagination-material .page-item.active .page-link {
    background: var(--servir-primary);
    border-color: var(--servir-primary);
}

/* ========================================
   TOOLTIPS
   ======================================== */

.tooltip-material {
    font-size: 0.7rem;
    padding: 4px 8px;
}

/* ========================================
   CHECKBOX/RADIO - COMPACTOS
   ======================================== */

.form-check-material {
    padding-left: 1.5rem;
    margin-bottom: 4px;
}

.form-check-material .form-check-input {
    width: 14px;
    height: 14px;
    margin-top: 2px;
}

.form-check-material .form-check-label {
    font-size: 0.75rem;
}

/* ========================================
   SCROLLBAR PERSONALIZADO
   ======================================== */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}

/* ========================================
   UTILIDADES
   ======================================== */

.text-servir { color: var(--servir-primary) !important; }
.bg-servir { background-color: var(--servir-primary) !important; }
.border-servir { border-color: var(--servir-primary) !important; }

.gap-1 { gap: 4px !important; }
.gap-2 { gap: 6px !important; }
.gap-3 { gap: 8px !important; }

.mb-compact { margin-bottom: 6px !important; }
.mt-compact { margin-top: 6px !important; }
.p-compact { padding: 6px !important; }

.text-xs { font-size: 0.65rem !important; }
.text-sm { font-size: 0.75rem !important; }

/* ========================================
   ANIMACIONES - MINIMAS
   ======================================== */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.animate-fade-in {
    animation: fadeIn 0.2s ease forwards;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .page-header-material {
        padding: 6px 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .page-header-material .page-title {
        font-size: 0.85rem;
    }

    .stats-container {
        gap: 4px;
    }

    .stat-card {
        padding: 4px 8px;
        min-width: 100px;
    }

    .stat-card .stat-value {
        font-size: 0.95rem;
    }

    .filters-card {
        padding: 6px 8px;
    }

    .table-material thead th,
    .table-material tbody td {
        padding: 3px 6px;
        font-size: 0.65rem;
    }
}

@media (max-width: 576px) {
    .stats-container {
        flex-direction: column;
    }

    .stat-card {
        width: 100%;
    }
}
