.bz-directory {
  color: #29425d;
  font-family: "Nunito Sans", "Segoe UI", sans-serif;
  font-size: 1.05rem;
  margin: 0 0 32px;
}

.bz-directory *, .bz-directory *::before, .bz-directory *::after { box-sizing: border-box; }

.bz-directory__title {
  color: #203a56;
  font-size: clamp(2rem, 4vw, 2.5rem);
  font-weight: 400;
  letter-spacing: -0.035em;
  line-height: 1.1;
  margin: 0 0 10px;
}

.bz-directory__description {
  color: #5f7488;
  font-size: 1.12rem;
  line-height: 1.65;
  margin: 0 0 24px;
  max-width: 780px;
}

.bz-directory__toolbar, .bz-directory__pagination {
  align-items: center;
  background: #ffffff;
  border: 1px solid #d9e4eb;
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(41, 66, 93, 0.06);
  display: flex;
  gap: 14px;
  padding: 18px;
}

.bz-directory__toolbar { justify-content: space-between; margin-bottom: 24px; }
.bz-directory__search { flex: 1 1 300px; position: relative; }
.bz-directory__search-icon { color: #7b92a7; font-size: 1.7rem; left: 16px; line-height: 1; position: absolute; top: 50%; transform: translateY(-52%); }

.bz-directory input, .bz-directory select { 
  border: 1px solid #c7d7e2; 
  border-radius: 10px; 
  color: #324b63; 
  font: inherit; 
  font-size: 1.2rem; 
  min-height: 56px; 
  outline: none; 
}
.bz-directory input { padding: 0 16px 0 48px; width: 100%; }
.bz-directory input::placeholder { color: #8298ab; opacity: 1; }
.bz-directory input:focus, .bz-directory select:focus { border-color: #54a8c8; box-shadow: 0 0 0 3px rgba(84, 168, 200, 0.16); }

.bz-directory__filters { align-items: center; display: flex; flex-wrap: wrap; gap: 12px; }
.bz-directory select { background: #fff; cursor: pointer; padding: 0 18px; font-weight: 700; }
.bz-directory__counter { background: #e4f3f8; border-radius: 999px; color: #287b9b; font-size: 1.15rem; font-weight: 800; padding: 12px 22px; white-space: nowrap; min-height: 56px; display: inline-flex; align-items: center; }

/* Cuadrícula y Tarjetas */
.bz-directory__grid { display: grid; gap: 18px; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 24px; }
.bz-card { background: #fff; border: 1px solid #dce7ed; border-radius: 14px; box-shadow: 0 4px 14px rgba(41, 66, 93, 0.07); overflow: hidden; transition: box-shadow .2s ease, transform .2s ease; }
.bz-card:hover { box-shadow: 0 12px 24px rgba(41, 104, 139, .17); transform: translateY(-4px); }

.bz-card__header { align-items: center; background: linear-gradient(135deg, #294574 0%, #317fa6 100%); border-bottom: 3px solid #86c99a; display: flex; flex-direction: column; min-height: 140px; padding: 16px 14px 14px; text-align: center; }
.bz-card__municipality { color: #b7e6bf; font-size: 0.85rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.bz-card__label { color: #fff; font-size: 1.15rem; font-weight: 800; letter-spacing: .05em; margin: 4px 0 10px; text-transform: uppercase; }
.bz-card__number { align-items: baseline; background: #fff; border: 2px solid #86c99a; border-radius: 10px; color: #243d58; display: inline-flex; font-size: 2.2rem; font-weight: 800; gap: 6px; line-height: 1; padding: 6px 16px; }
.bz-card__number small { color: #559c6d; font-size: 1rem; font-weight: 700; }

.bz-card__body { display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.bz-card__meta { align-items: center; color: #526d83; display: flex; font-size: 1rem; justify-content: space-between; font-weight: 600; gap: 10px; }

.bz-card__view-btn {
    background-color: #fee2e2;
    color: #991b1b;
    border: none;
    padding: 10px 20px;
    font-size: 1.05rem;
    font-weight: 800;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.bz-card__view-btn:hover { background-color: #fecaca; }

.bz-card__download { background: linear-gradient(135deg, #44a7ca, #2e84ab); border-radius: 8px; box-shadow: 0 3px 8px rgba(46, 132, 171, .22); color: #fff !important; font-size: 1.05rem; font-weight: 800; padding: 12px; text-align: center; text-decoration: none !important; }
.bz-card__download:hover { background: linear-gradient(135deg, #75bd88, #579e6e); }

.bz-directory__pagination { flex-wrap: wrap; justify-content: center; }
.bz-page-button { background: #fff; border: 1px solid #c9d9e3; border-radius: 8px; color: #29425d; cursor: pointer; font: inherit; font-size: 1.1rem; font-weight: 700; min-height: 48px; padding: 0 18px; }
.bz-page-button.is-active { background: #318cab; border-color: #318cab; color: #fff; }
.bz-page-button:disabled { cursor: not-allowed; opacity: .45; }

.bz-directory__status { color: #526d83; font-size: 1.05rem; font-weight: 600; margin: 14px 0 0; text-align: center; }
.bz-directory__loading, .bz-directory__empty { background: #f7fafb; border: 1px dashed #cddce5; border-radius: 12px; color: #5f7488; font-size: 1.15rem; grid-column: 1 / -1; margin: 0; padding: 48px 20px; text-align: center; }

/* MODAL DE PREVISUALIZACIÓN PDF */
.bz-modal {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh; z-index: 99999;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0.3s ease;
}
.bz-modal.is-active { opacity: 1; visibility: visible; }
.bz-modal__backdrop { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.7); }
.bz-modal__dialog { position: relative; width: 90%; max-width: 1000px; height: 85vh; background: #1e293b; border-radius: 12px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3); z-index: 2; }
.bz-modal__header { background: #0f172a; color: #fff; padding: 14px 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #334155; }
.bz-modal__title-wrap { display: flex; align-items: center; gap: 12px; }
.bz-modal__title { font-size: 1.1rem; font-weight: 700; margin: 0; color: #f8fafc; }
.bz-modal__subtitle { font-size: 0.85rem; color: #94a3b8; }
.bz-modal__actions { display: flex; align-items: center; gap: 15px; }
.bz-modal__btn-download { background: #2563eb; color: #fff !important; padding: 6px 14px; border-radius: 6px; font-size: 0.9rem; text-decoration: none !important; font-weight: 600; transition: background 0.2s; }
.bz-modal__btn-download:hover { background: #1d4ed8; }
.bz-modal__close { background: none; border: none; color: #94a3b8; font-size: 28px; cursor: pointer; line-height: 1; }
.bz-modal__close:hover { color: #fff; }
.bz-modal__body { flex: 1; background: #334155; }
.bz-modal__body iframe { width: 100%; height: 100%; border: none; }

/* ================================================= */
/* OPTIMIZACIÓN RESPONSIVA MÓVIL Y TABLET (HASTA 800px) */
/* ================================================= */
@media (max-width: 800px) { 
    .bz-directory__grid { 
        grid-template-columns: 1fr; 
        gap: 12px;
        margin-bottom: 16px;
    } 

    .bz-directory {
        margin: 0 0 12px;
    }

    .bz-directory__title {
        font-size: 1.5rem;
        margin-bottom: 4px;
    }

    .bz-directory__description {
        font-size: 0.9rem;
        line-height: 1.35;
        margin-bottom: 8px;
        max-width: 100%;
    }

    /* Forzar barra contenedora responsiva */
    .bz-directory__toolbar {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        width: 100% !important;
        max-width: 100% !important;
        gap: 8px !important;
        padding: 10px !important;
        height: auto !important;
        min-height: 0 !important;
        margin-bottom: 10px !important;
        border-radius: 10px;
        box-sizing: border-box !important;
    }

    /* Forzar que el buscador tome el 100% real sin desbordarse */
    .bz-directory__search {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        flex: none !important;
        margin: 0 !important;
    }

    .bz-directory input {
        width: 100% !important;
        max-width: 100% !important;
        min-height: 42px !important;
        font-size: 0.9rem !important;
        padding: 0 10px 0 36px !important;
        box-sizing: border-box !important;
    }

    .bz-directory__search-icon {
        left: 10px;
        font-size: 1.2rem;
    }

    /* Filtros inferiores en línea */
    .bz-directory__filters {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        width: 100% !important;
        max-width: 100% !important;
        gap: 8px !important;
        margin: 0 !important;
    }

    .bz-directory select,
    .bz-directory__counter {
        min-height: 38px !important;
        font-size: 0.9rem !important;
        flex: 1 !important;
        width: 50% !important;
        box-sizing: border-box !important;
    }

    .bz-directory select {
        padding: 0 8px !important;
    }

    .bz-directory__counter {
        justify-content: center;
        padding: 4px 8px !important;
        white-space: nowrap;
    }

    .bz-page-button { 
        padding: 0 10px; 
        min-height: 36px;
        font-size: 0.95rem;
    }
}