/* ============================================================
   PROGRAMAS SOCIALES – Estilos específicos
   /programas/programas.css
   ============================================================ */

/* --- Contenedor principal de fichas --- */
.program-cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 30px;
}

/* --- Ficha individual de programa --- */
.program-card {
    width: 100%;
    min-height: 290px;
    background: #fff;
    border: 1px solid var(--border-color, #ccc);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
    cursor: pointer;
    position: relative;
}

.program-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    border-color: var(--accent, #0284c7);
}

/* Etiqueta de tipo de objetivo en esquina */
.card-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 20px;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}
/* ── Paleta de badges por categoría de Objetivo ─────────────────────
   Para añadir una nueva categoría:
   1. Agrega la entrada en BADGE_MAP en programas.js
   2. Añade la clase .badge-[clave] aquí con fondo (bg) y texto (color)
   ────────────────────────────────────────────────────────────────── */

.badge-persona {
    background: #2563eb;    /* azul vibrante */
    color: #ffffff;
}
.badge-moral {
    background: #ea580c;    /* naranja fuerte */
    color: #ffffff;
}
.badge-emprendedor {
    background: #16a34a;    /* verde intenso */
    color: #ffffff;
}
.badge-empresa {
    background: #9333ea;    /* morado vibrante */
    color: #ffffff;
}
.badge-publico {
    background: #0d9488;    /* verde azulado (teal) */
    color: #ffffff;
}
.badge-joven {
    background: #db2777;    /* rosa fuerte */
    color: #ffffff;
}
.badge-mujer {
    background: #c026d3;    /* fiusha / magenta */
    color: #ffffff;
}
.badge-adulto {
    background: #d97706;    /* ámbar oscuro */
    color: #ffffff;
}
.badge-discapacidad {
    background: #0891b2;    /* cian fuerte */
    color: #ffffff;
}
.badge-estudiante {
    background: #4f46e5;    /* índigo vibrante */
    color: #ffffff;
}
.badge-agricultor {
    background: #ca8a04;    /* amarillo ocre */
    color: #ffffff;
}
.badge-otro {
    background: #4b5563;    /* gris oscuro – catch-all */
    color: #ffffff;
}

.program-card h3 {
    margin: 0 0 10px 0;
    font-size: 15px;
    font-weight: 700;
    color: #222;
    border-bottom: 2px solid var(--accent, #0284c7);
    padding-bottom: 6px;
    line-height: 1.3;
}

.program-card p {
    margin: 3px 0;
    font-size: 12.5px;
    color: #555;
    line-height: 1.45;
}

.program-card p b {
    color: #333;
}

/* Beneficio destacado al fondo de la ficha */
.card-beneficio {
    margin-top: auto;
    padding-top: 10px;
    font-weight: 700;
    font-size: 17px;
    color: var(--accent, #0284c7);
    text-align: right;
    border-top: 1px solid #eee;
}

.card-beneficio small {
    display: block;
    font-size: 11px;
    font-weight: 400;
    color: #888;
    margin-top: 2px;
}

/* Indicador de vigencia */
.card-vigencia {
    font-size: 11px;
    color: #777;
    margin-top: 4px;
    text-align: right;
}
.vigente { color: #16a34a; font-weight: 600; }
.por-vencer { color: #d97706; font-weight: 600; }
.vencido { color: #dc2626; font-weight: 600; }

/* --- Filtros y Búsqueda --- */
.filters-section {
    background: #fdfdfd;
    border: 1px solid #eaeaea;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.search-main {
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-main input {
    flex: 1;
    padding: 12px;
    font-size: 15px;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s;
}
.search-main input:focus {
    border-color: var(--accent, #0284c7);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.1);
}

.btn-clear-filters {
    padding: 10px 16px;
    background: #e53935;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    font-weight: bold;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.2s;
}
.btn-clear-filters:hover { background: #c62828; }

/* Fila filtro de edad */
.age-search-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.age-label {
    font-size: 13.5px;
    font-weight: 700;
    color: #555;
    white-space: nowrap;
}
.age-input {
    width: 160px;
    padding: 9px 12px;
    font-size: 15px;
    border: 1px solid #ccc;
    border-radius: 6px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    -moz-appearance: textfield;
    appearance: textfield;
}
.age-input::-webkit-outer-spin-button,
.age-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.age-input:focus {
    border-color: var(--accent, #0284c7);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12);
}
.age-hint {
    font-size: 12px;
    color: #999;
    font-style: italic;
}

@media (max-width: 600px) {
    .age-hint { display: none; }
    .age-input { width: 100px; }
}

.filters-selects {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
}
.filters-selects select {
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13.5px;
    background: white;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}
.filters-selects select:focus {
    border-color: var(--accent, #0284c7);
}

.sort-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.sort-label {
    font-size: 13px;
    font-weight: 700;
    color: #555;
}

.sort-buttons button {
    padding: 5px 10px;
    font-size: 12.5px;
    background: #eee;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}
.sort-buttons button:hover { background: #ddd; }
.sort-buttons button.active-sort {
    background: var(--accent, #0284c7);
    color: white;
    border-color: transparent;
}

.result-count {
    font-size: 13px;
    color: #888;
    font-style: italic;
}

/* --- Ventana Emergente (Modal) --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.program-modal {
    background: #fff;
    width: 92%;
    max-width: 760px;
    max-height: 90vh;
    border-radius: 14px;
    overflow-y: auto;
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
    animation: modalSlideIn 0.25s ease;
}

@keyframes modalSlideIn {
    from { transform: translateY(30px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.modal-header {
    padding: 16px 22px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 10;
    gap: 10px;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
    color: #222;
    line-height: 1.3;
    flex: 1;
}

.btn-close-modal {
    background: none;
    border: none;
    font-size: 30px;
    cursor: pointer;
    color: #aaa;
    flex-shrink: 0;
    line-height: 1;
    transition: color 0.2s;
}
.btn-close-modal:hover { color: #333; }

.modal-body {
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* Caja de objetivo/descripción */
.modal-objetivo-box {
    background: #f0f9ff;
    border-left: 4px solid var(--accent, #0284c7);
    padding: 12px 15px;
    border-radius: 0 8px 8px 0;
    font-size: 15px;
    color: #1e3a5f;
    line-height: 1.5;
}
.modal-objetivo-box b {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--accent, #0284c7);
    margin-bottom: 4px;
}

/* Grid de información principal */
.modal-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.modal-info-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.modal-info-item .info-label {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--accent, #0284c7);
}
.modal-info-item .info-value {
    font-size: 15px;
    color: #222;
}
.modal-info-item .info-value a {
    color: var(--accent, #0284c7);
    text-decoration: underline;
    word-break: break-all;
}

/* Cajas de secciones (consideraciones, observaciones) */
.modal-section-box {
    background: #fafafa;
    border: 1px solid #eaeaea;
    border-radius: 8px;
    padding: 12px 15px;
    font-size: 14px;
    color: #444;
    line-height: 1.5;
}
.modal-section-box b {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #888;
    margin-bottom: 5px;
}
.modal-section-box:empty { display: none; }

/* Acciones (botones de contacto y web) */
.modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: filter 0.2s, transform 0.15s;
}
.btn-action:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.btn-web {
    background: var(--accent, #0284c7);
    color: #fff;
}
.btn-tel {
    background: #16a34a;
    color: #fff;
}
.btn-email {
    background: #7c3aed;
    color: #fff;
}
.btn-facebook {
    background: #1877f2;
    color: #fff;
}

/* Compartir enlace */
.share-link-box {
    background: #fcfcfc;
    border: 1px dashed #ccc;
    padding: 10px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.share-link-box input {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    color: #555;
    background: #fff;
}
.btn-copy {
    padding: 8px 14px;
    background: var(--accent, #0284c7);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
    white-space: nowrap;
}
.btn-copy:hover { background: var(--accent-hover, #0369a1); }

/* --- Estado vacío --- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #aaa;
    width: 100%;
}
.empty-state p { font-size: 16px; margin-top: 10px; }

/* --- Responsivo --- */
@media (max-width: 600px) {
    .program-cards-container {
        grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
        gap: 15px;
    }
    .modal-header h2 { font-size: 17px; }
    .modal-body { padding: 15px; }

    /* Botón Limpiar debajo del buscador en móvil */
    .search-main {
        flex-direction: column;
        align-items: stretch;
    }
    .btn-clear-filters {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 380px) {
    .program-card { width: 100%; }
}
