@font-face {
    font-family: 'Patria';
    font-style: normal;
    font-weight: 400;
    src: url("https://framework-gb.cdn.gob.mx/applications/cms/fonts/Patria_Regular.otf") format("opentype");
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Noto Sans", "Helvetica", "Arial", sans-serif;
    background-color: #f5f5f5;
    color: #404041;
}

/* Header y Navegación */
.top-bar {
    background: linear-gradient(135deg, #611232, #8B2B4F);
    color: white;
    padding: 5px 20px;
    font-size: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
}

.top-bar .condusef-text {
    font-weight: bold;
    font-size: 16px;
}

.nav-bar {
    background: linear-gradient(135deg, #a57f2c, #B8860B);
    padding: 12px 0;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.nav-item {
    color: white;
    text-decoration: none;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* Banner */
.banner {
    background: url('../imagenes/banner reca-recas.jpg') center/cover no-repeat;
    padding: 80px 20px;
    border-bottom: 6px solid;
    border-image: linear-gradient(to right, #228B22 0%, #228B22 30%, #FFB347 50%, #f68427 70%, #f68427 100%) 1;
    min-height: 310px;
    position: relative;
}

.buttons-container {
    position: absolute;
    top: 50%;
    left: 50.8%;
    transform: translateY(-50%);
    display: flex;
    gap: 53px;
}

.circular-button {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.1, 0, 0.2, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    background: transparent;
    color: white;
    position: relative;
}

/* Contenido */
.content-section {
    background: white;
    padding: 10px 20px;
    max-width: 1400px;
    margin: 0 auto;
    margin-bottom: 80px;
}

.page-header {
    text-align: center;
    margin-bottom: 1px;
}

.page-title {
    font-family: "Patria", serif;
    font-size: 2.6rem;
    margin-bottom: 5px;
}

.title-orange { color: #f68427; }
.title-dark { color: #333; }
.title-green { color: #00A859; }

.page-subtitle {
    color: #666;
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.circles-decoration {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
}

.circle {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.circle.orange { background-color: #f68427; }

/* Sistema de Pestañas */
.search-tabs-container {
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #e0e0e0;
    overflow: hidden;
    margin-bottom: 30px;
}

.search-tabs {
    display: flex;
    background: #e9ecef;
    border-bottom: 2px solid #dee2e6;
}

.tab-button {
    flex: 1;
    padding: 15px 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 20px;
    font-weight: 600;
    color: #666;
    transition: all 0.3s ease;
    position: relative;
}

.tab-button:hover {
    background: rgba(0, 168, 89, 0.05);
    color: #00A859;
}

.tab-button.active {
    background: white;
    color: #00A859;
    border-bottom: 3px solid #00A859;
}

.tab-button.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: #00A859;
}

.tab-content {
    display: none;
    padding: 30px;
    background: white;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Búsqueda Simple */
.simple-search-container {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.search-input, .contrato-input {
    flex: 1;
    min-width: 300px;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 15px;
    transition: border-color 0.3s ease;
}

.search-input:focus, .contrato-input:focus {
    outline: none;
    border-color: #00A859;
    box-shadow: 0 0 0 3px rgba(0, 168, 89, 0.1);
}

.search-btn {
    background: #00A859;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
    transition: all 0.3s ease;
}

.search-btn:hover { 
    background: #008a4a;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 168, 89, 0.3);
}

.search-btn:active {
    transform: translateY(0);
}

/* Búsqueda Avanzada */
.advanced-search-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 5px;
    font-size: 15px;
}

.form-group .search-input,
.form-group select {
    padding: 10px 12px;
    border: 2px solid #e9ecef;
    border-radius: 5px;
    min-height: 42px;
    font-size: 15px;
    transition: all 0.3s ease;
}

.form-group .search-input:focus,
.form-group select:focus {
    outline: none;
    border-color: #00A859;
    box-shadow: 0 0 0 3px rgba(0, 168, 89, 0.1);
}

.form-group .search-input:disabled,
.form-group select:disabled {
    background-color: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
    border-color: #dee2e6;
}

.sector-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-top: 15px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.advanced-search-buttons {
    display: flex;
    gap: 5px;
    justify-content: center;
    margin-top: 50px;
    padding-top: 10px;
    border-top: 2px solid #e9ecef;
}

.search-btn.primary, .search-btn.secondary {
    padding: 12px 20px;
    border-radius: 5px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    border: none;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 140px;
    justify-content: center;
    transition: all 0.3s ease;
}

.search-btn.primary {
    background: linear-gradient(135deg, #00A859 0%, #008a4a 100%);
    color: white;
    box-shadow: 0 4px 10px rgba(0, 168, 89, 0.3);
}

.search-btn.primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 168, 89, 0.4);
}

.search-btn.primary:disabled {
    background: #a8d5ba;
    cursor: not-allowed;
    opacity: 0.7;
    box-shadow: none;
}

.search-btn.secondary {
    background: white;
    color: #00A859;
    border: 2px solid #00A859;
}

.search-btn.secondary:hover {
    background: #00A859;
    color: white;
    transform: translateY(-2px);
}

/* Resultados */
.results-section { margin-top: 30px; }

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 15px;
}

.results-count {
    font-size: 1.1rem;
    color: #333;
    font-weight: bold;
}

.results-count .count-number { color: #f68427; }

.items-per-page {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Grid */
.data-grid {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border: 1px solid #e0e0e0;
}

.grid-table {
    width: 100%;
    border-collapse: collapse;
}

.grid-header {
    background: #f8f9fa;
    border-bottom: 2px solid #e0e0e0;
}

.grid-header th {
    padding: 15px 10px;
    text-align: left;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    border-right: 1px solid #e0e0e0;
}

.grid-row {
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
}

.grid-row:hover { background-color: #f8f9fa; }
.grid-row:nth-child(even) { background-color: #fdfdfd; }

.grid-cell {
    padding: 12px 10px;
    border-right: 1px solid #f0f0f0;
}

/* Badges y Enlaces */
.sector-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: bold;
    text-transform: uppercase;
}

.sector-reca {
    background-color: #e3f2fd;
    color: #1565c0;
    border: 1px solid #90caf9;
}

.sector-recas {
    background-color: #e8f5e8;
    color: #2e7d32;
    border: 1px solid #81c784;
}

.contract-link {
    color: #2287ba;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
}

.contract-link:hover {
    color: #008a4a;
    background-color: rgba(0, 168, 89, 0.1);
}

/* Estados */
.empty-state, .loading {
    text-align: center;
    padding: 20px 20px;
    color: #666;
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 15px;
    color: #ddd;
}

.loading .spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #00A859;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

/* Imágenes Flotantes */
.img-tips, .img-flotante, .img-flotante2, .img-flotante3, .img-flotante4 {
    height: auto;
    cursor: pointer;
    transition: transform 0.3s ease;
    border-radius: 10px;
    position: fixed;
    left: 3px;
    width: 100px;
}

.img-tips { bottom: 340px; }
.img-flotante { bottom: 275px; }
.img-flotante2 { bottom: 195px; }
.img-flotante3 { bottom: 115px; }
.img-flotante4 { bottom: 35px; }

.img-flotante[src*="1i.png"],
.img-flotante2[src*="2i.png"],
.img-flotante3[src*="3i.png"],
.img-flotante4[src*="4i.png"] {
    width: 250px;
}

.img-flotante:hover, .img-flotante2:hover, .img-flotante3:hover, .img-flotante4:hover {
    transform: scale(1.05);
}

/* Paginación */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 30px;
    padding: 20px;
    flex-wrap: wrap;
}

.pagination-btn {
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: white;
    color: #333;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pagination-btn:hover {
    background: #f0f0f0;
    border-color: #00A859;
}

.pagination-btn.active {
    background: #00A859;
    color: white;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Aviso */
.aviso {
    background-color: #fff4e0;
    border-left: 6px solid #e67e22;
    padding: 15px 20px;
    font-size: 15px;
    line-height: 1.5;
    max-width: 700px;
    margin: 20px auto;
    border-radius: 4px;
}

.aviso strong {
    display: block;
    text-align: center;
    color: #e74c3c;
    margin-bottom: 8px;
}

/* Chat Widget */
.chat-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
}

.chat-bubble {
    background: linear-gradient(135deg, #611232, #8B2B4F);
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(97, 18, 50, 0.4);
    transition: all 0.3s ease;
    animation: pulse-condusef 3s infinite;
    border: 3px solid #a57f2c;
}

.chat-bubble::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: #32CD32;
    border-radius: 50%;
    top: 5px;
    right: 5px;
    border: 2px solid white;
}

/* Select2 */
.select2-container {
    width: 100% !important;
    font-size: 15px;
}

.select2-container--default .select2-selection--single {
    height: 42px;
    border: 2px solid #e9ecef;
    border-radius: 5px;
    padding: 8px 12px;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 24px;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 40px;
}

/* Animaciones */
@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse-condusef {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 8px 25px rgba(97, 18, 50, 0.4);
    }
    50% { 
        transform: scale(1.05);
        box-shadow: 0 12px 35px rgba(97, 18, 50, 0.6);
    }
}

/* =================================================================
   MEDIA QUERY CRÍTICA - MÁXIMA ESPECIFICIDAD
   ================================================================= */
@media screen and (max-width: 1400px) {
    
    /* Header ultra compacto */
    html body .top-bar,
    body .top-bar {
        padding: 1px 6px !important;
        font-size: 10px !important;
        gap: 6px !important;
        min-height: 18px !important;
    }
    
    html body .top-bar .condusef-text,
    body .top-bar .condusef-text {
        font-size: 11px !important;
    }
    
    html body .nav-bar,
    body .nav-bar {
        padding: 3px 0 !important;
        min-height: 20px !important;
    }
    
    html body .nav-item,
    body .nav-item {
        padding: 2px 5px !important;
        font-size: 9px !important;
    }
    
    /* BANNER - MÁXIMA ESPECIFICIDAD - 150px */
    html body section.banner,
    body section.banner,
    html body .banner,
    body .banner,
    section.banner,
    .banner {
        padding: 20px 10px !important;
        min-height: 150px !important;
        max-height: 150px !important;
        height: 150px !important;
        line-height: normal !important;
        overflow: hidden !important;
        -webkit-box-sizing: border-box !important;
        -moz-box-sizing: border-box !important;
        box-sizing: border-box !important;
        display: flex !important;
        -webkit-flex-direction: column !important;
        flex-direction: column !important;
        -webkit-justify-content: center !important;
        justify-content: center !important;
        -webkit-align-items: center !important;
        align-items: center !important;
    }
    
    html body .banner-content,
    body .banner-content,
    .banner-content {
        height: 100% !important;
        width: 100% !important;
        display: flex !important;
        -webkit-align-items: center !important;
        align-items: center !important;
        -webkit-justify-content: center !important;
        justify-content: center !important;
    }
    
    html body .banner .buttons-container,
    body .banner .buttons-container,
    .banner .buttons-container,
    html body .buttons-container,
    body .buttons-container,
    .buttons-container {
        gap: 18px !important;
        position: absolute !important;
        top: 50% !important;
        left: 51% !important;
        -webkit-transform: translate(-50%, -50%) !important;
        -moz-transform: translate(-50%, -50%) !important;
        -ms-transform: translate(-50%, -50%) !important;
        transform: translate(-50%, -50%) !important;
    }
    
    html body .banner .circular-button,
    body .banner .circular-button,
    .banner .circular-button,
    html body .circular-button,
    body .circular-button,
    .circular-button {
        width: 105px !important;
        height: 105px !important;
        min-width: 105px !important;
        min-height: 105px !important;
        max-width: 105px !important;
        max-height: 105px !important;
        -webkit-box-sizing: border-box !important;
        -moz-box-sizing: border-box !important;
        box-sizing: border-box !important;
        flex-shrink: 0 !important;
        -webkit-flex-shrink: 0 !important;
    }
    
    /* Content con espacio para tips */
    html body .content-section,
    body .content-section {
        padding: 5px 10px 5px 75px !important;
        margin-bottom: 30px !important;
    }
    
    html body .page-title,
    body .page-title {
        font-size: 1.15rem !important;
        line-height: 1.05 !important;
        margin-bottom: 0px !important;
    }
    
    html body .aviso,
    body .aviso {
        padding: 3px 6px !important;
        font-size: 9px !important;
        line-height: 1.15 !important;
        margin: 3px auto !important;
    }
    
    html body .aviso strong,
    body .aviso strong {
        font-size: 9.5px !important;
        margin-bottom: 1px !important;
    }
    
    /* Pestañas */
    html body .tab-button,
    body .tab-button {
        padding: 7px 10px !important;
        font-size: 13px !important;
    }
    
    html body .tab-content,
    body .tab-content {
        padding: 12px !important;
    }
    
    html body .tab-content p,
    body .tab-content p {
        font-size: 11px !important;
        margin-bottom: 8px !important;
    }
    
    /* Búsqueda */
    html body .search-input,
    html body .contrato-input,
    body .search-input,
    body .contrato-input {
        padding: 6px 10px !important;
        font-size: 11px !important;
        min-width: 150px !important;
    }
    
    html body .search-btn,
    body .search-btn {
        padding: 6px 12px !important;
        font-size: 11px !important;
    }
    
    html body .advanced-search-grid,
    html body .sector-fields,
    body .advanced-search-grid,
    body .sector-fields {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)) !important;
        gap: 8px !important;
    }
    
    html body .sector-fields,
    body .sector-fields {
        padding: 10px !important;
        margin-top: 8px !important;
    }
    
    html body .form-group label,
    body .form-group label {
        font-size: 10px !important;
        margin-bottom: 2px !important;
    }
    
    html body .form-group .search-input,
    html body .form-group select,
    body .form-group .search-input,
    body .form-group select {
        padding: 5px 8px !important;
        min-height: 28px !important;
        font-size: 10px !important;
    }
    
    /* Botones */
    html body .advanced-search-buttons,
    body .advanced-search-buttons {
        margin-top: 12px !important;
        padding-top: 6px !important;
    }
    
    html body .search-btn.primary,
    html body .search-btn.secondary,
    body .search-btn.primary,
    body .search-btn.secondary {
        padding: 6px 10px !important;
        font-size: 10px !important;
        min-width: 85px !important;
    }
    
    /* Resultados */
    html body .results-count,
    body .results-count {
        font-size: 0.8rem !important;
    }
    
    html body .grid-header th,
    body .grid-header th {
        padding: 6px 4px !important;
        font-size: 10px !important;
    }
    
    html body .grid-cell,
    body .grid-cell {
        padding: 5px 4px !important;
        font-size: 10px !important;
    }
    
    html body .sector-badge,
    body .sector-badge {
        font-size: 9px !important;
        padding: 2px 4px !important;
    }
    
    html body .contract-link,
    body .contract-link {
        font-size: 10px !important;
        padding: 2px 4px !important;
    }
    
    /* Paginación */
    html body .pagination,
    body .pagination {
        margin-top: 12px !important;
        padding: 10px !important;
    }
    
    html body .pagination-btn,
    body .pagination-btn {
        padding: 4px 7px !important;
        font-size: 10px !important;
    }
    
    /* Tips - Compactos */
    html body .img-tips,
    html body .img-flotante,
    html body .img-flotante2,
    html body .img-flotante3,
    html body .img-flotante4,
    body .img-tips,
    body .img-flotante,
    body .img-flotante2,
    body .img-flotante3,
    body .img-flotante4 {
        width: 50px !important;
        left: 5px !important;
    }
    
    html body .img-tips,
    body .img-tips { bottom: 250px !important; }
    html body .img-flotante,
    body .img-flotante { bottom: 205px !important; }
    html body .img-flotante2,
    body .img-flotante2 { bottom: 150px !important; }
    html body .img-flotante3,
    body .img-flotante3 { bottom: 95px !important; }
    html body .img-flotante4,
    body .img-flotante4 { bottom: 40px !important; }
    
    html body .img-flotante[src*="1i.png"],
    html body .img-flotante2[src*="2i.png"],
    html body .img-flotante3[src*="3i.png"],
    html body .img-flotante4[src*="4i.png"],
    body .img-flotante[src*="1i.png"],
    body .img-flotante2[src*="2i.png"],
    body .img-flotante3[src*="3i.png"],
    body .img-flotante4[src*="4i.png"] {
        width: 160px !important;
    }
    
    /* Chat */
    html body .chat-bubble,
    body .chat-bubble {
        width: 50px !important;
        height: 50px !important;
        font-size: 20px !important;
        bottom: 12px !important;
        right: 12px !important;
    }
    
    html body .chat-bubble::after,
    body .chat-bubble::after {
        width: 11px !important;
        height: 11px !important;
    }
    
    /* Select2 */
    html body .select2-container--default .select2-selection--single,
    body .select2-container--default .select2-selection--single {
        height: 28px !important;
        padding: 4px 8px !important;
        font-size: 10px !important;
    }
    
    html body .select2-container--default .select2-selection--single .select2-selection__rendered,
    body .select2-container--default .select2-selection--single .select2-selection__rendered {
        line-height: 18px !important;
    }
    
    html body .circles-decoration,
    body .circles-decoration {
        margin-bottom: 6px !important;
    }
    
    html body .circle,
    body .circle {
        width: 7px !important;
        height: 7px !important;
    }
}

/* Responsive móvil */
@media (max-width: 768px) {
    .top-bar, .nav-container {
        flex-direction: column;
        gap: 10px;
    }
    
    .banner {
        padding: 60px 15px;
        min-height: 250px;
    }
    
    .buttons-container {
        position: static;
        transform: none;
        flex-direction: column;
        gap: 20px;
    }
    
    .circular-button {
        width: 150px;
        height: 150px;
    }
    
    .page-title { font-size: 1.8rem; }
    .page-subtitle { font-size: 1rem; }
    
    .search-tabs {
        flex-direction: column;
    }
    
    .tab-button {
        border-bottom: 1px solid #dee2e6;
    }
    
    .tab-button.active {
        border-bottom: none;
        border-left: 4px solid #00A859;
    }
    
    .tab-content {
        padding: 20px;
    }
    
    .simple-search-container {
        flex-direction: column;
    }
    
    .search-input {
        min-width: 100%;
    }
    
    .advanced-search-grid,
    .sector-fields {
        grid-template-columns: 1fr;
    }
    
    .advanced-search-buttons {
        flex-direction: column;
    }
    
    .data-grid {
        overflow-x: auto;
    }
    
    .grid-table {
        min-width: 800px;
    }
    
    .img-tips, .img-flotante, .img-flotante2, .img-flotante3, .img-flotante4 {
        display: none;
    }
    
    .chat-bubble {
        width: 60px;
        height: 60px;
        font-size: 24px;
    }
    
    .content-section {
        padding: 10px 20px !important;
    }
}

@media (max-width: 480px) {
    .page-title { font-size: 1.5rem; }
    .tab-content { padding: 15px; }
    .grid-cell { padding: 8px 6px; font-size: 14px; }
    .search-btn.primary, .search-btn.secondary {
        min-width: 100%;
    }
}

#sectorAdvFilter {
    max-width: 500px;
    margin: 0 auto;
}