/*
 * TicasModularERP – Design System
 * Visual-only overrides and reusable utilities for consistent UI across all modules.
 * Layered on top of SB Admin 2 / Bootstrap 4.
 */

/* =====================================================
   1. TYPOGRAPHY – uniform across the whole app
   ===================================================== */
body,
.card,
.modal-content,
.dropdown-menu {
    font-family: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 0.875rem;
    color: #5a5c69;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-weight: 700;
    color: #858796;
}

/* Page section titles */
.tds-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* =====================================================
   1.5. TYPOGRAPHY - Enhancements for better readability and flow
   ===================================================== */
.tds-body-text {
    line-height: 1.6;
    font-weight: 400;
}

.tds-heading-1, .tds-h1 {
    font-size: 2.5rem;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.tds-heading-2, .tds-h2 {
    font-size: 2rem;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.tds-heading-3, .tds-h3 {
    font-size: 1.5rem;
    line-height: 1.4;
    letter-spacing: -0.01em;
}

.tds-lead-text {
    font-size: 1.25rem;
    font-weight: 400;
    line-height: 1.6;
}

/* =====================================================
   2. COLORS – design-system palette tokens
   ===================================================== */
:root {
    --tds-primary:   #4e73df;
    --tds-success:   #1cc88a;
    --tds-info:      #36b9cc;
    --tds-warning:   #f6c23e;
    --tds-danger:    #e74a3b;
    --tds-gray-100:  #f8f9fc;
    --tds-gray-300:  #dddfeb;
    --tds-gray-500:  #b7b9cc;
    --tds-gray-600:  #858796;
    --tds-gray-800:  #5a5c69;
    --tds-gray-900:  #3a3b45;
    --tds-white:     #ffffff;
    --tds-shadow:    0 0.15rem 1.75rem 0 rgba(58,59,69,.15);
    --tds-border-radius: 0.35rem;
}

/* =====================================================
   2.5. THEME PALETTES - Modern enhancements based on color theory
   ===================================================== */
:root {
    /* Modern Theme Colors */
    --theme-modern-primary: #4361ee;
    --theme-modern-secondary: #3a0ca3;
    --theme-modern-accent: #4cc9f0;
    --theme-modern-success: #4ade80;
    --theme-modern-warning: #facc15;
    --theme-modern-danger: #f87171;
    --theme-modern-bg: #ffffff;
    --theme-modern-text: #333333;
    
    /* Minimalist Theme Colors */
    --theme-minimal-primary: #000000;
    --theme-minimal-secondary: #666666;
    --theme-minimal-accent: #f5f5f5;
    --theme-minimal-success: #007a3d;
    --theme-minimal-warning: #ff9500;
    --theme-minimal-danger: #e11d48; 
    --theme-minimal-bg: #ffffff;
    --theme-minimal-text: #222222;
    
    /* Classic Theme Colors */
    --theme-classic-primary: #2c3e50;
    --theme-classic-secondary: #3498db;
    --theme-classic-accent: #27ae60;
    --theme-classic-success: #16a085;
    --theme-classic-warning: #f39c12;
    --theme-classic-danger: #e74c3c;
    --theme-classic-bg: #ffffff;
    --theme-classic-text: #333333;
}

/* =====================================================
   3. KPI CARDS  (matches reference screenshot 1)
   ===================================================== */

/* Wrapper grid: equal-height cards per row */
.tds-kpi-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.tds-kpi-col {
    flex: 1 1 220px;
    min-width: 0;
}

/* The card itself */
.tds-kpi-card {
    background: var(--tds-white);
    border-radius: var(--tds-border-radius);
    box-shadow: var(--tds-shadow);
    border-left: 4px solid var(--tds-primary);
    padding: 1.1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 90px;
    transition: box-shadow .15s ease-in-out;
}

.tds-kpi-card:hover {
    box-shadow: 0 0.3rem 2rem 0 rgba(58,59,69,.22);
}

/* Color variants – border-left */
.tds-kpi-card.tds-kpi-primary   { border-left-color: var(--tds-primary);  }
.tds-kpi-card.tds-kpi-success   { border-left-color: var(--tds-success);  }
.tds-kpi-card.tds-kpi-info      { border-left-color: var(--tds-info);     }
.tds-kpi-card.tds-kpi-warning   { border-left-color: var(--tds-warning);  }
.tds-kpi-card.tds-kpi-danger    { border-left-color: var(--tds-danger);   }
.tds-kpi-card.tds-kpi-secondary { border-left-color: var(--tds-gray-500); }

/* Text inside card */
.tds-kpi-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.3rem;
}

.tds-kpi-card.tds-kpi-primary   .tds-kpi-label { color: var(--tds-primary);  }
.tds-kpi-card.tds-kpi-success   .tds-kpi-label { color: var(--tds-success);  }
.tds-kpi-card.tds-kpi-info      .tds-kpi-label { color: var(--tds-info);     }
.tds-kpi-card.tds-kpi-warning   .tds-kpi-label { color: var(--tds-warning);  }
.tds-kpi-card.tds-kpi-danger    .tds-kpi-label { color: var(--tds-danger);   }
.tds-kpi-card.tds-kpi-secondary .tds-kpi-label { color: var(--tds-gray-600); }

.tds-kpi-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--tds-gray-800);
    line-height: 1.1;
}

.tds-kpi-icon {
    font-size: 2rem;
    color: var(--tds-gray-300;
    flex-shrink: 0;
    margin-left: 1rem;
}

/* =====================================================
   3.5. ENHANCED KPI CARDS WITH THEMES
   ===================================================== */

.tds-kpi-card-theme-modern {
    border-left: 4px solid var(--theme-modern-primary);
    background: linear-gradient(145deg, #ffffff, #f8f9fc);
}

.tds-kpi-card-theme-minimal {
    border-left: 4px solid var(--theme-minimal-primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    background: var(--theme-minimal-bg);
}

.tds-kpi-card-theme-classic {
    border-left: 4px solid var(--theme-classic-primary);
    background: var(--theme-classic-bg);
}

/* =====================================================
   4. SECTION CARDS  (matches reference screenshot 2)
   ===================================================== */

.tds-card {
    background: var(--tds-white);
    border-radius: var(--tds-border-radius);
    box-shadow: var(--tds-shadow);
    border: none;
    margin-bottom: 1.5rem;
}

.tds-card-header {
    background: var(--tds-gray-100);
    border-bottom: 1px solid var(--tds-gray-300);
    border-radius: var(--tds-border-radius) var(--tds-border-radius) 0 0;
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 3rem;
}

.tds-card-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--tds-primary);
    margin: 0;
}

.tds-card-body {
    padding: 1.25rem;
}

/* =====================================================
   4.5. ENHANCED SECTION CARDS WITH THEMES
   ===================================================== */

.tds-card-theme-modern {
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.1);
    border-radius: 12px;
}

.tds-card-theme-minimal {
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid #e6e6e6;
    border-radius: 0;
}

.tds-card-theme-classic {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid #eee;
    border-radius: 8px;
}

/* =====================================================
   4. SECTION CARDS  (matches reference screenshot 2)
   ===================================================== */

.tds-card {
    background: var(--tds-white);
    border-radius: var(--tds-border-radius);
    box-shadow: var(--tds-shadow);
    border: none;
    margin-bottom: 1.5rem;
}

.tds-card-header {
    background: var(--tds-gray-100);
    border-bottom: 1px solid var(--tds-gray-300);
    border-radius: var(--tds-border-radius) var(--tds-border-radius) 0 0;
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 3rem;
}

.tds-card-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--tds-primary);
    margin: 0;
}

.tds-card-body {
    padding: 1.25rem;
}

/* =====================================================
   5. STANDARDIZED TABLES
   ===================================================== */

.tds-table-wrapper {
    overflow-x: auto;
    width: 100%;
}

.tds-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.855rem;
}

.tds-table thead th {
    background: var(--tds-gray-100);
    color: var(--tds-gray-800);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 2px solid var(--tds-gray-300);
    padding: 0.65rem 0.9rem;
    white-space: nowrap;
}

.tds-table tbody tr {
    border-bottom: 1px solid var(--tds-gray-300);
    transition: background-color .1s;
}

.tds-table tbody tr:hover {
    background-color: rgba(78, 115, 223, 0.04);
}

.tds-table tbody td {
    padding: 0.6rem 0.9rem;
    vertical-align: middle;
    color: var(--tds-gray-800);
}

/* =====================================================
   5.5. ENHANCED TABLES WITH THEMES
   ===================================================== */

.tds-table-theme-modern {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.1);
}

.tds-table-theme-minimal {
    border: 1px solid #e6e6e6;
    border-radius: 0;
}

.tds-table-theme-classic {
    border: 1px solid #eee;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* =====================================================
   6. ACTION BUTTONS  (matches reference screenshot 2)
   ===================================================== */

.tds-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 0.3rem;
    cursor: pointer;
    font-size: 0.85rem;
    transition: opacity .15s, transform .1s;
    margin-right: 3px;
}

.tds-action-btn:hover {
    opacity: 0.85;
    transform: translateY(-1px);
}

.tds-action-btn:active {
    transform: translateY(0);
}

.tds-btn-view   { background: #36b9cc; color: #fff; }
.tds-btn-edit   { background: #f6c23e; color: #fff; }
.tds-btn-delete { background: #e74a3b; color: #fff; }
.tds-btn-add    { background: #4e73df; color: #fff; }

/* =====================================================
   6.5. ENHANCED ACTION BUTTONS WITH THEMES
   ===================================================== */

.tds-action-btn-theme-modern {
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(67, 97, 238, 0.2);
    transition: all 0.2s ease-in-out;
}

.tds-action-btn-theme-modern:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.3);
}

.tds-action-btn-theme-minimal {
    border-radius: 0;
    box-shadow: none;
    background: #f5f5f5 !important;
    color: #333 !important;
    font-weight: normal;
}

.tds-action-btn-theme-classic {
    border-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    transition: all 0.2s ease-in-out;
}

/* =====================================================
   7. PAGE / MODULE HEADER
   ===================================================== */

.tds-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.tds-page-header-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--tds-gray-800);
    margin: 0;
}

/* =====================================================
   6. ACTION BUTTONS  (matches reference screenshot 2)
   ===================================================== */

.tds-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 0.3rem;
    cursor: pointer;
    font-size: 0.85rem;
    transition: opacity .15s, transform .1s;
    margin-right: 3px;
}

.tds-action-btn:hover {
    opacity: 0.85;
    transform: translateY(-1px);
}

.tds-action-btn:active {
    transform: translateY(0);
}

.tds-btn-view   { background: #36b9cc; color: #fff; }
.tds-btn-edit   { background: #f6c23e; color: #fff; }
.tds-btn-delete { background: #e74a3b; color: #fff; }
.tds-btn-add    { background: #4e73df; color: #fff; }

/* =====================================================
   7. PAGE / MODULE HEADER
   ===================================================== */

.tds-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.tds-page-header-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--tds-gray-800);
    margin: 0;
}

/* =====================================================
   8. ICON SIZING UTILITIES  (uniform fa-* usage)
   ===================================================== */

.tds-icon-sm  { font-size: 1rem;  }
.tds-icon-md  { font-size: 1.5rem; }
.tds-icon-lg  { font-size: 2rem;  }
.tds-icon-xl  { font-size: 3rem;  }

.tds-icon-muted   { color: var(--tds-gray-300); }
.tds-icon-primary { color: var(--tds-primary);  }
.tds-icon-success { color: var(--tds-success);  }
.tds-icon-warning { color: var(--tds-warning);  }
.tds-icon-danger  { color: var(--tds-danger);   }

/* =====================================================
   9. MISCELLANEOUS UTILITIES
   ===================================================== */

/* Subtle badge variant */
.tds-badge {
    display: inline-block;
    padding: 0.25em 0.55em;
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.tds-badge-success   { background: rgba(28,200,138,.15); color: #1cc88a; }
.tds-badge-danger    { background: rgba(231,74,59,.12);  color: #e74a3b; }
.tds-badge-warning   { background: rgba(246,194,62,.15); color: #c49a0e; }
.tds-badge-info      { background: rgba(54,185,204,.15); color: #36b9cc; }
.tds-badge-secondary { background: rgba(133,135,150,.12);color: #858796; }

/* Empty state block */
.tds-empty-state {
    text-align: center;
    padding: 3rem 1rem;
}

.tds-empty-state i {
    font-size: 3.5rem;
    color: var(--tds-gray-300);
    margin-bottom: 1rem;
    display: block;
}

.tds-empty-state p {
    color: var(--tds-gray-600);
    margin-bottom: 1rem;
}

/* Loading row inside cards */
.tds-loading-row {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--tds-gray-600);
}

/* Ensure DataTables header matches tds-table header when used together */
.dataTables_wrapper .tds-table thead th,
table.dataTable thead th {
    background: var(--tds-gray-100);
    color: var(--tds-gray-800);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 2px solid var(--tds-gray-300);
}

/* Responsive helpers */
@media (max-width: 576px) {
    .tds-kpi-row {
        gap: 0.75rem;
    }
    .tds-kpi-col {
        flex: 1 1 100%;
    }
    .tds-kpi-value {
        font-size: 1.3rem;
    }
}

/* =====================================================
   10. LEGACY CARD NORMALIZATION
   Alinea cards Bootstrap estándar al sistema TDS sin
   tocar el markup de cada página.
   ===================================================== */

/* Normalizar card estándar con sombra */
.card.shadow,
.card.shadow-sm {
    border: 1px solid var(--tds-gray-200) !important;
    box-shadow: 0 0.125rem 0.375rem rgba(0,0,0,0.07) !important;
    border-radius: 0.5rem !important;
}

/* Normalizar card-header genérico */
.card-header {
    background: var(--tds-gray-100) !important;
    border-bottom: 1px solid var(--tds-gray-200) !important;
    padding: 0.75rem 1.25rem !important;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--tds-gray-700);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Override de colores hardcoded en card-header */
.card-header.bg-primary,
.card-header.bg-success,
.card-header.bg-danger,
.card-header.bg-warning,
.card-header.bg-info,
.card-header.bg-secondary {
    background: var(--tds-gray-100) !important;
    color: var(--tds-gray-700) !important;
}

/* Normalizar card-body padding */
.card > .card-body {
    padding: 1.25rem !important;
}

/* h6 text-primary dentro de card-header heredado */
.card-header h6.text-primary,
.card-header .font-weight-bold.text-primary {
    color: var(--tds-gray-700) !important;
    font-size: 0.8rem;
    font-weight: 700;
    margin: 0;
}

/* Icono dropdown en card-header legacy */
.card-header .dropdown-toggle {
    color: var(--tds-gray-400);
}

/* DataTables inside legacy cards inherit TDS look */
.card .dataTables_wrapper .dataTables_filter input,
.card .dataTables_wrapper .dataTables_length select {
    font-size: 0.8rem;
}

.separador-v {
    display: block;
    height: 32px; /* Cambia este número para modificar el tamaño del espacio */
    width: 100%; /* Ocupa todo el ancho disponible */
}