/* ============================================
   COLORES CORPORATIVOS
   Verde:    #3AAA35
   Amarillo: #F0BD1A
   Naranja:  #E77C24
   Celeste:  #0F70B7
   Gris:     #E6E6E6
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: #f0f4f8;
    padding: 2rem 1.5rem;
    color: #1a2c3e;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* ---- HEADER ---- */
.header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.header-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 0.75rem;
}

.header-logo {
    width: 90px;
    height: 90px;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(15, 112, 183, 0.2));
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.header-logo:hover {
    transform: scale(1.05);
}

.header-text {
    text-align: left;
}

.header h1 {
    font-size: 2.2rem;
    background: linear-gradient(135deg, #0F70B7, #3AAA35);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    letter-spacing: -0.5px;
    margin: 0;
}

.header p {
    color: #0F70B7;
    font-weight: 500;
    margin-top: 0.4rem;
    border-bottom: 2px solid #E6E6E6;
    display: inline-block;
    padding-bottom: 0.3rem;
}

@media (max-width: 600px) {
    .header-brand {
        flex-direction: column;
        gap: 0.75rem;
    }
    .header-text {
        text-align: center;
    }
    .header-logo {
        width: 70px;
        height: 70px;
    }
    .header h1 {
        font-size: 1.6rem;
    }
}

/* ---- BARRA DE BÚSQUEDA ---- */
.search-section {
    margin-bottom: 1.5rem;
}

/* Barra principal */
.search-main {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: white;
    border-radius: 16px;
    padding: 0.6rem 0.6rem 0.6rem 0;
    box-shadow: 0 4px 20px rgba(15, 112, 183, 0.1);
    border: 1.5px solid #E6E6E6;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.search-main:focus-within {
    border-color: #0F70B7;
    box-shadow: 0 4px 20px rgba(15, 112, 183, 0.18);
}

.search-input-wrap {
    display: flex;
    align-items: center;
    flex: 1;
    gap: 0.5rem;
    padding: 0 0.75rem;
}
.search-icon {
    font-size: 1.1rem;
    opacity: 0.5;
    flex-shrink: 0;
}
.search-input-wrap input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1rem;
    font-weight: 500;
    color: #1a2c3e;
    background: transparent;
    padding: 0.55rem 0;
    min-width: 0;
}
.search-input-wrap input::placeholder {
    color: #aab4be;
    font-weight: 400;
}
.search-clear-x {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: #E6E6E6;
    color: #666;
    font-size: 0.7rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s;
}
.search-clear-x:hover { background: #E77C24; color: white; }

.search-btn {
    padding: 0.65rem 1.5rem;
    background: linear-gradient(135deg, #0F70B7, #3AAA35);
    border: none;
    border-radius: 10px;
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}
.search-btn:hover { opacity: 0.9; transform: translateY(-1px); }

.filter-toggle-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.65rem 1rem;
    background: #f4f8fc;
    border: 1.5px solid #E6E6E6;
    border-radius: 10px;
    color: #1a2c3e;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
    position: relative;
}
.filter-toggle-btn:hover, .filter-toggle-btn.active {
    background: #0F70B7;
    border-color: #0F70B7;
    color: white;
}
.filter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: #E77C24;
    color: white;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 700;
}

/* ---- FILTER BAR ---- */
.filter-bar {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 0.75rem;
}

.filter-group {
    position: relative;
    flex-shrink: 0;
}

.filter-group-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 0.9rem;
    background: white;
    border: 1.5px solid #E6E6E6;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: #1a2c3e;
    transition: all 0.2s;
    white-space: nowrap;
    user-select: none;
    min-width: 160px;
}
.filter-group-header:hover {
    border-color: #0F70B7;
    background: #f0f7ff;
    color: #0F70B7;
}
.filter-group.open .filter-group-header {
    border-color: #0F70B7;
    background: #0F70B7;
    color: white;
    border-radius: 10px 10px 0 0;
    border-bottom-color: transparent;
}
.filter-group-icon { font-size: 1rem; }
.filter-group-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}
.filter-group-arrow {
    font-size: 0.7rem;
    opacity: 0.6;
    transition: transform 0.2s;
}
.filter-group.open .filter-group-arrow { transform: rotate(180deg); }

.filter-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 260px;
    background: white;
    border: 1.5px solid #0F70B7;
    border-top: none;
    border-radius: 0 10px 10px 10px;
    box-shadow: 0 8px 24px rgba(15,112,183,0.15);
    z-index: 100;
    overflow: hidden;
}
.filter-dropdown.open { display: block; }

.filter-search-wrap {
    padding: 0.6rem;
    border-bottom: 1px solid #E6E6E6;
    background: #f8fafc;
}
.filter-search-wrap input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1.5px solid #E6E6E6;
    border-radius: 8px;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.filter-search-wrap input:focus { border-color: #0F70B7; }

.filter-options {
    max-height: 220px;
    overflow-y: auto;
    padding: 0.3rem 0;
    scrollbar-width: thin;
    scrollbar-color: #E6E6E6 transparent;
}
.filter-options::-webkit-scrollbar { width: 4px; }
.filter-options::-webkit-scrollbar-thumb { background: #E6E6E6; border-radius: 4px; }

.filter-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.9rem;
    font-size: 0.85rem;
    color: #1a2c3e;
    cursor: pointer;
    transition: background 0.15s;
}
.filter-option:hover { background: #f0f7ff; color: #0F70B7; }
.filter-option.selected { background: rgba(15,112,183,0.06); color: #0F70B7; font-weight: 600; }
.filter-option-check {
    color: #0F70B7;
    font-size: 0.75rem;
    opacity: 0;
    flex-shrink: 0;
    width: 14px;
}
.filter-option.selected .filter-option-check { opacity: 1; }
.filter-option-empty {
    padding: 1rem;
    text-align: center;
    color: #aab4be;
    font-size: 0.82rem;
    font-style: italic;
}

.filter-clear-all {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.55rem 0.9rem;
    background: rgba(231,124,36,0.08);
    border: 1.5px solid rgba(231,124,36,0.3);
    border-radius: 10px;
    color: #E77C24;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.filter-clear-all:hover { background: #E77C24; color: white; border-color: #E77C24; }

/* Chips de filtros activos */
.active-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    min-height: 0;
}
.chips-label {
    font-size: 0.78rem;
    color: #999;
    font-weight: 600;
}
.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(15, 112, 183, 0.08);
    border: 1px solid rgba(15, 112, 183, 0.2);
    color: #0F70B7;
    padding: 0.25rem 0.6rem 0.25rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}
.chip-remove {
    background: none;
    border: none;
    color: #0F70B7;
    cursor: pointer;
    font-size: 0.7rem;
    padding: 0;
    line-height: 1;
    opacity: 0.6;
    transition: opacity 0.2s;
}
.chip-remove:hover { opacity: 1; }

/* Stats bar */
.stats-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0.75rem 0 1.25rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.stats-count {
    font-size: 0.9rem;
    color: #0F70B7;
    font-weight: 700;
}
.search-hint {
    font-size: 0.82rem;
    color: #aab4be;
}

/* Highlight de búsqueda */
mark {
    background: rgba(240, 189, 26, 0.35);
    color: inherit;
    border-radius: 2px;
    padding: 0 1px;
}

/* Estado de carga */
.loading-state {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 3rem;
    color: #0F70B7;
    font-weight: 500;
}
.loading-spinner-pub {
    width: 24px;
    height: 24px;
    border: 3px solid #E6E6E6;
    border-top-color: #0F70B7;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* No results mejorado */
.no-results {
    text-align: center;
    padding: 4rem 2rem;
    background: white;
    border-radius: 20px;
    grid-column: 1 / -1;
    border: 1px solid #E6E6E6;
}
.no-results-icon { font-size: 3rem; margin-bottom: 0.75rem; opacity: 0.5; }
.no-results-title { font-size: 1.1rem; font-weight: 700; color: #1a2c3e; margin-bottom: 0.4rem; }
.no-results-sub { font-size: 0.9rem; color: #aab4be; }

/* Nota en tarjeta */
.card-note {
    font-size: 0.72rem;
    margin-top: 8px;
    color: #E77C24;
    font-style: italic;
}

/* Responsive buscador */
@media (max-width: 650px) {
    .search-main { flex-wrap: wrap; padding: 0.5rem; gap: 0.5rem; }
    .search-input-wrap { order: 1; width: 100%; padding: 0 0.5rem; }
    .search-btn { order: 2; flex: 1; }
    .filter-bar { gap: 0.4rem; }
    .filter-group-header { min-width: 0; }
    .filter-group-label { max-width: 100px; }
    .filter-dropdown { min-width: 220px; }
}

/* ---- GRID DE TARJETAS ---- */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.card {
    background: white;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 6px 14px rgba(15, 112, 183, 0.07);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid #E6E6E6;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 26px rgba(15, 112, 183, 0.13);
}

.card-header {
    background: #f4f8fc;
    padding: 1rem 1.2rem;
    border-left: 6px solid #0F70B7;
}

.department {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    color: #0F70B7;
}

.subunit {
    font-size: 0.85rem;
    font-weight: 600;
    color: #3AAA35;
    margin-top: 0.3rem;
}

.role {
    font-weight: 800;
    font-size: 1.1rem;
    margin: 0.2rem 0 0;
    color: #E77C24;
}

.name {
    font-weight: 600;
    color: #1a2c3e;
    margin-top: 4px;
    font-size: 0.95rem;
}

.card-body {
    padding: 1rem 1.2rem 1.2rem;
}

.contact-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 0.8rem;
    flex-wrap: wrap;
    background: #f4f8fc;
    padding: 0.5rem 0.7rem;
    border-radius: 18px;
}

.phone-icon {
    font-size: 1.2rem;
}

.phone-number {
    font-weight: 700;
    font-family: monospace;
    font-size: 1rem;
    letter-spacing: 0.3px;
    color: #0F70B7;
    word-break: break-all;
}

.anexo {
    background: #E6E6E6;
    border-radius: 30px;
    padding: 0.2rem 0.7rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #1a2c3e;
}

.badge-location {
    font-size: 0.7rem;
    background: #E6E6E6;
    display: inline-block;
    padding: 0.2rem 0.7rem;
    border-radius: 20px;
    margin-top: 0.5rem;
    color: #1a2c3e;
}

hr {
    margin: 0.7rem 0;
    border-color: #E6E6E6;
}

.no-results {
    text-align: center;
    padding: 3rem;
    background: white;
    border-radius: 2rem;
    grid-column: 1 / -1;
    color: #0F70B7;
}

/* ---- FOOTER CORPORATIVO ---- */
.site-footer {
    margin-top: 4rem;
    background: linear-gradient(160deg, #0F70B7 0%, #0a5a94 40%, #1a2c3e 100%);
    color: white;
    border-radius: 24px 24px 0 0;
    overflow: hidden;
    position: relative;
}

/* Línea de acento superior multicolor */
.site-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #F0BD1A 0%, #E77C24 25%, #3AAA35 50%, #0F70B7 75%, #F0BD1A 100%);
}

.footer-inner {
    display: grid;
    grid-template-columns: 1.6fr 1fr 1fr;
    gap: 2.5rem;
    padding: 3rem 3rem 2.5rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* ---- COLUMNA BRAND ---- */
.footer-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.2rem;
}

.footer-logo {
    width: 60px;
    height: 60px;
    object-fit: contain;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.3));
    flex-shrink: 0;
}

.footer-brand-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: white;
    line-height: 1.2;
}

.footer-brand-sub {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.6);
    margin-top: 0.2rem;
}

.footer-desc {
    font-size: 0.82rem;
    color: rgba(255,255,255,0.65);
    line-height: 1.7;
    margin: 0;
}

/* ---- COLUMNAS ---- */
.footer-heading {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #F0BD1A;
    margin: 0 0 1rem 0;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.footer-links li a,
.footer-links li span {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.72);
    text-decoration: none;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-links li a:hover {
    color: white;
}

.footer-update {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.2rem;
    font-size: 0.78rem;
    color: rgba(255,255,255,0.5);
    background: rgba(255,255,255,0.06);
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.1);
}

.footer-update-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #3AAA35;
    box-shadow: 0 0 6px #3AAA35;
    animation: pulse-dot 2s infinite;
    flex-shrink: 0;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

/* ---- BARRA INFERIOR ---- */
.footer-bottom {
    background: rgba(0,0,0,0.25);
    border-top: 1px solid rgba(255,255,255,0.08);
}

.footer-bottom-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 3rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.78rem;
    color: rgba(255,255,255,0.45);
}

.footer-bottom-links {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.footer-bottom-links a {
    color: rgba(255,255,255,0.55);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-bottom-links a:hover { color: white; }

.footer-sep { opacity: 0.3; }

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
    .footer-inner {
        grid-template-columns: 1fr 1fr;
        padding: 2rem;
        gap: 2rem;
    }
    .footer-brand-col { grid-column: 1 / -1; }
}

@media (max-width: 600px) {
    .footer-inner {
        grid-template-columns: 1fr;
        padding: 1.5rem;
    }
    .footer-bottom-inner {
        padding: 1rem 1.5rem;
        flex-direction: column;
        text-align: center;
    }
}

/* ---- PAGINACIÓN ---- */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.pagination-info {
    font-size: 0.9rem;
    color: #0F70B7;
}

.pagination-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.pagination-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #E6E6E6;
    border-radius: 8px;
    background: white;
    color: #1a2c3e;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.pagination-btn:hover {
    background: #E6E6E6;
    border-color: #0F70B7;
    color: #0F70B7;
}

.pagination-current {
    padding: 0.5rem 1rem;
    background: #0F70B7;
    color: white;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
}

.pagination-ellipsis {
    padding: 0 0.5rem;
    color: #E77C24;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 650px) {
    body {
        padding: 1rem;
    }
    .grid {
        grid-template-columns: 1fr;
    }
}
