/* ========================================
   gobmx-modules.css
   Estilos compartidos para modulos AF y CF
   ======================================== */

/* Paleta de colores oficial gob.mx */
:root {
    --gobmx-guinda-oscuro: #611232;
    --gobmx-guinda: #9d2449;
    --gobmx-dorado: #a57f2c;
    --gobmx-dorado-claro: #BC955C;
    --gobmx-beige: #DDC9A3;
    --gobmx-gris: #98989A;
    --gobmx-verde-oscuro: #13322B;
    --gobmx-verde: #235B4E;
    --gobmx-texto: #545454;
    --gobmx-blanco: #FFFFFF;
    --gobmx-fondo: #f8f9fa;
}

/* ========================================
   HERO SECTION
   ======================================== */
.hero-section {
    background: linear-gradient(135deg, var(--gobmx-guinda-oscuro) 0%, var(--gobmx-guinda) 100%);
    color: var(--gobmx-blanco);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 8px 24px rgba(97, 18, 50, 0.25);
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
}

.hero-section::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -5%;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 50%;
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.hero-title i {
    font-size: 1.5rem;
    opacity: 0.9;
}

.hero-subtitle {
    font-size: 1rem;
    opacity: 0.85;
    margin-top: 0.5rem;
    margin-bottom: 0;
}

/* ========================================
   KPI CARDS
   ======================================== */
.kpi-section {
    margin-bottom: 1.5rem;
}

.kpi-card {
    background: var(--gobmx-blanco);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border-left: 4px solid var(--gobmx-gris);
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.kpi-card.kpi-primary { border-left-color: var(--gobmx-guinda); }
.kpi-card.kpi-success { border-left-color: var(--gobmx-verde); }
.kpi-card.kpi-warning { border-left-color: var(--gobmx-dorado); }
.kpi-card.kpi-danger  { border-left-color: #dc3545; }
.kpi-card.kpi-info    { border-left-color: var(--gobmx-guinda-oscuro); }

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

.kpi-card.kpi-primary .kpi-icon { background: rgba(157, 36, 73, 0.1); color: var(--gobmx-guinda); }
.kpi-card.kpi-success .kpi-icon { background: rgba(35, 91, 78, 0.1); color: var(--gobmx-verde); }
.kpi-card.kpi-warning .kpi-icon { background: rgba(165, 127, 44, 0.1); color: var(--gobmx-dorado); }
.kpi-card.kpi-danger  .kpi-icon { background: rgba(220, 53, 69, 0.1); color: #dc3545; }
.kpi-card.kpi-info    .kpi-icon { background: rgba(97, 18, 50, 0.1); color: var(--gobmx-guinda-oscuro); }

.kpi-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gobmx-gris);
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.kpi-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gobmx-texto);
    line-height: 1.2;
}

.kpi-card.kpi-primary .kpi-value { color: var(--gobmx-guinda); }
.kpi-card.kpi-success .kpi-value { color: var(--gobmx-verde); }
.kpi-card.kpi-warning .kpi-value { color: var(--gobmx-dorado); }
.kpi-card.kpi-danger  .kpi-value { color: #dc3545; }
.kpi-card.kpi-info    .kpi-value { color: var(--gobmx-guinda-oscuro); }

/* ========================================
   BUSQUEDA Y FILTROS
   ======================================== */
.search-filter-section {
    background: var(--gobmx-blanco);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.sf-header {
    background: var(--gobmx-verde-oscuro);
    color: var(--gobmx-blanco);
    padding: 0.85rem 1.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sf-body { padding: 1.25rem 1.5rem; }
.sf-search-row { margin-bottom: 1rem; }

.sf-search-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sf-search-prefix {
    color: var(--gobmx-guinda);
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.sf-search-input {
    flex: 1;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 0.6rem 1rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gobmx-texto);
    outline: none;
    transition: all 0.3s ease;
}

.sf-search-input:focus {
    border-color: var(--gobmx-guinda);
    box-shadow: 0 0 0 3px rgba(157, 36, 73, 0.12);
}

.sf-search-input::placeholder {
    color: var(--gobmx-gris);
    font-weight: 400;
}

.sf-btn-search {
    background: var(--gobmx-guinda);
    border: none;
    color: var(--gobmx-blanco);
    border-radius: 8px;
    padding: 0.6rem 1.25rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.sf-btn-search:hover { background: var(--gobmx-guinda-oscuro); }

.sf-btn-clear {
    background: var(--gobmx-fondo);
    border: none;
    color: var(--gobmx-gris);
    border-radius: 8px;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.sf-btn-clear:hover {
    color: var(--gobmx-guinda);
    background: rgba(157, 36, 73, 0.08);
}

/* Tag resultado */
.search-result-tag {
    display: none;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.65rem;
    background: rgba(157, 36, 73, 0.06);
    border: 1px solid rgba(157, 36, 73, 0.12);
    border-radius: 6px;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    color: var(--gobmx-guinda-oscuro);
    animation: slideIn 0.25s ease;
}

.search-result-tag.active { display: inline-flex; }
.search-result-tag i { color: var(--gobmx-guinda); }
.search-result-tag strong { color: var(--gobmx-guinda); }

.search-result-tag .tag-close {
    margin-left: 0.5rem;
    background: none;
    border: none;
    color: var(--gobmx-gris);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.search-result-tag .tag-close:hover { color: var(--gobmx-guinda); }

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Separador */
.sf-divider {
    height: 1px;
    background: rgba(0, 0, 0, 0.08);
    margin: 0.25rem 0 1rem;
}

/* Filtros */
.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.85rem;
}

.filter-item { display: flex; flex-direction: column; }

.filter-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gobmx-gris);
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.filter-item .form-select {
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.filter-item .form-select:focus {
    border-color: var(--gobmx-guinda);
    box-shadow: 0 0 0 3px rgba(157, 36, 73, 0.12);
}

.filter-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

/* ========================================
   BOTONES
   ======================================== */
.btn-action {
    border-radius: 8px;
    padding: 0.5rem 1.25rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
}

.btn-primary-custom {
    background: var(--gobmx-guinda);
    border: none;
    color: var(--gobmx-blanco);
}

.btn-primary-custom:hover {
    background: var(--gobmx-guinda-oscuro);
    color: var(--gobmx-blanco);
}

.btn-secondary-custom {
    background: var(--gobmx-blanco);
    border: 1px solid #e0e0e0;
    color: var(--gobmx-texto);
}

.btn-secondary-custom:hover {
    background: var(--gobmx-fondo);
    border-color: var(--gobmx-gris);
}

/* ========================================
   TABLA
   ======================================== */
.table-section {
    background: var(--gobmx-blanco);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.table-header {
    background: linear-gradient(135deg, var(--gobmx-guinda-oscuro) 0%, var(--gobmx-guinda) 100%);
    color: var(--gobmx-blanco);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.table-title {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.table-body { padding: 1rem; }

.table-gobmx { width: 100% !important; }
.table-gobmx thead { background: var(--gobmx-fondo); }

.table-gobmx thead th {
    border: none;
    padding: 1rem 0.75rem;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gobmx-guinda-oscuro);
    border-bottom: 2px solid var(--gobmx-beige);
}

.table-gobmx tbody td {
    vertical-align: middle;
    padding: 0.875rem 0.75rem;
    font-size: 0.9rem;
    color: var(--gobmx-texto);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.table-gobmx tbody tr { transition: background 0.2s ease; }
.table-gobmx tbody tr:hover { background-color: rgba(157, 36, 73, 0.04); }
.table-gobmx tbody tr:last-child td { border-bottom: none; }

/* ID Column */
.proyecto-id {
    background: rgba(157, 36, 73, 0.08);
    color: var(--gobmx-guinda-oscuro);
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.85rem;
    display: inline-block;
}

/* Monto */
.monto-value {
    font-weight: 700;
    color: var(--gobmx-verde-oscuro);
}

/* Action Button */
.btn-ver-detalle {
    background: var(--gobmx-verde-oscuro);
    border: none;
    color: var(--gobmx-blanco);
    border-radius: 8px;
    padding: 0.4rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.btn-ver-detalle:hover {
    background: #0d221d;
    color: var(--gobmx-blanco);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(19, 50, 43, 0.3);
}

/* ========================================
   DATATABLES CUSTOMIZATION
   ======================================== */
.dataTables_wrapper .dataTables_length select {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 0.4rem 2rem 0.4rem 0.75rem;
    font-size: 0.9rem;
}

.dataTables_wrapper .dataTables_length select:focus {
    border-color: var(--gobmx-guinda);
    box-shadow: 0 0 0 3px rgba(157, 36, 73, 0.15);
    outline: none;
}

.dataTables_wrapper .dataTables_filter { display: none; }

.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: 8px;
    margin: 0 3px;
    padding: 0.5rem 0.85rem;
    font-size: 0.85rem;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: var(--gobmx-guinda) !important;
    border-color: var(--gobmx-guinda) !important;
    color: var(--gobmx-blanco) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--gobmx-fondo) !important;
    border-color: var(--gobmx-beige) !important;
    color: var(--gobmx-texto) !important;
}

.dataTables_wrapper .dataTables_info {
    color: var(--gobmx-gris);
    font-size: 0.85rem;
    padding-top: 1rem;
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
    margin-bottom: 1rem;
}

.dataTables_wrapper .dataTables_length label {
    color: var(--gobmx-texto);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ========================================
   LOADING
   ======================================== */
.loading-spinner {
    color: var(--gobmx-guinda);
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 991px) {
    .hero-section { padding: 1.5rem; }
    .hero-title { font-size: 1.4rem; }
    .kpi-value { font-size: 1.5rem; }
    .filter-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 767px) {
    .hero-section {
        border-radius: 12px;
        padding: 1.25rem;
    }

    .hero-title { font-size: 1.2rem; }

    .sf-search-group { flex-wrap: wrap; }
    .sf-search-input { flex: 1 1 100%; margin-bottom: 0.5rem; }
    .sf-btn-search { flex: 1; }

    .kpi-card { padding: 1rem; }
    .kpi-value { font-size: 1.35rem; }
    .kpi-icon { width: 40px; height: 40px; font-size: 1rem; }

    .filter-grid { grid-template-columns: 1fr; }
    .filter-actions { flex-direction: column; }
    .filter-actions .btn-action { width: 100%; justify-content: center; }

    .table-header {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
}
