/* apcob-directorio.css COMPLETO CON SISTEMA DE ALERTAS */

/* Cargar las fuentes Hind y Lexend Deca desde Google Fonts (OPTIMIZADO) */
@import url('https://fonts.googleapis.com/css2?family=Hind:wght@400;500;600;700&family=Lexend+Deca:wght@400;500;600&display=swap');

/* --- Estilos del Directorio de Asociados --- */
.apcob-directorio-asociados {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); /* OPTIMIZADO para mejor responsive */
    gap: 20px;
    padding: 20px;
    margin-top: 20px;
}

.apcob-asociado-item {
    border: 1px solid #eee;
    border-radius: 15px;
    padding: 30px;
    text-align: left;
    background-color: #fff;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    /* OPTIMIZADO: usar transform para mejor performance */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    will-change: transform;
}

.apcob-asociado-item:hover {
    transform: translateY(-2px); /* NUEVO: efecto de "levantar" la tarjeta */
    box-shadow: 0px 8px 25px -5px rgba(0, 0, 0, 0.15);
}

.apcob-asociado-logo {
    margin-bottom: 15px;
    width: 45%;
    aspect-ratio: 1; /* NUEVO: mantiene proporción cuadrada */
    display: flex;
    align-items: center;
    justify-content: flex-start;
    overflow: hidden;
    border-radius: 7%; /* Movido aquí para mejor performance */
}

.apcob-asociado-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* OPTIMIZADO: mejor que max-width/max-height */
    border-radius: inherit;
    border: 2px solid #f8f9fa; /* NUEVO: borde sutil */
    transition: all 0.3s ease; /* NUEVO: transición suave */
}

/* NUEVO: efecto hover en logos */
.apcob-asociado-item:hover .apcob-asociado-logo img {
    border-color: #7f2468;
    transform: scale(1.05);
}

.apcob-asociado-name {
    font-size: 1.4em;
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
}

.apcob-asociado-item p {
    font-size: 0.95em;
    margin-bottom: 5px;
    color: #444; /* OPTIMIZADO: mejor contraste para accesibilidad */
    word-wrap: break-word;
    font-family: 'Hind', sans-serif;
    line-height: 1.4; /* NUEVO: mejor legibilidad */
}

.apcob-asociado-item p a {
    color: #555;
    text-decoration: none;
    margin-top: 3px;
}

.apcob-asociado-item p a:hover {
    text-decoration: underline;
    color: #7f2468;
    text-shadow: 0 1px 2px rgba(127, 36, 104, 0.1); /* NUEVO: sombra sutil */
}

/* --- Reglas para los iconos de Google Material Symbols --- */
.apcob-asociado-item p.apcob-asociado-info {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.95em;
    margin-bottom: 5px;
    color: #555;
}

.apcob-asociado-item p.apcob-asociado-info .material-symbols-outlined {
    font-size: 1.2em;
    font-variation-settings:
        'FILL' 0,
        'wght' 400,
        'GRAD' 0,
        'opsz' 24;
    color: #7f2468;
    min-width: 24px;
    text-align: center;
    position: relative;
    top: 3.5px;
    flex-shrink: 0; /* NUEVO: evita layout shift */
}

/* --- Estilos para el Formulario de Búsqueda (Desktop First) --- */
.apcob-search-form {
    display: flex;
    gap: 0;
    margin-bottom: 30px;
    flex-wrap: nowrap;
    align-items: stretch; /* OPTIMIZADO: hace que ambos elementos tengan la misma altura */
    max-width: 100%;
    margin-left: 20px;
    margin-right: 20px;
    box-sizing: border-box;
    position: relative;
}

.apcob-search-field {
    flex-grow: 1;
    padding: 18px 25px;
    border: 1px solid #f4f7fc;
    border-right: 1px solid #f4f7fc;
    border-radius: 15px 0 0 15px;
    font-size: 1em;
    font-family: 'Hind', sans-serif;
    box-sizing: border-box;
    outline: none;
    -webkit-appearance: none;
    /* NUEVO: mejoras en accesibilidad */
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.apcob-search-field:focus {
    border-color: #7f2468;
    box-shadow: 0 0 0 2px rgba(127, 36, 104, 0.1); /* NUEVO: focus ring más visible */
}

.apcob-search-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px 60px !important;
    font-family: 'Lexend Deca', sans-serif;
    border: none;
    border-radius: 0px 15px 15px 0px !important;
    cursor: pointer;
    font-size: 1em;
    text-decoration: none;
    text-align: center;
    white-space: nowrap;
    box-sizing: border-box;
    background-color: #7f2468;
    color: #fff;
    flex-shrink: 0;
    margin-left: -1px;
}

.apcob-search-submit:hover {
    background-color: #6a1d56;
}

/* Ocultar el icono por defecto en desktop */
.apcob-search-submit .apcob-search-submit-icon {
    display: none;
}

.apcob-search-submit .apcob-search-submit-text {
    display: inline-block;
}

.screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    position: absolute;
    height: 1px;
    width: 1px;
    overflow: hidden;
}

/* --- Ajustes Responsivos (Mobile First) --- */
@media (max-width: 600px) {
    .apcob-search-form {
        flex-direction: row;
        align-items: stretch;
        max-width: 100%;
        margin-left: 20px;
        margin-right: 20px;
        gap: 8px;
    }

    .apcob-search-field {
        flex-grow: 1;
        width: 100%;
        max-width: none;
        border-radius: 15px;
        padding: 12px 15px; /* OPTIMIZADO: mejor proporción */
        border: 1px solid #f4f7fc;
        border-right: 1px solid #f4f7fc;
        min-height: 45px; /* NUEVO: asegura altura mínima */
    }

    .apcob-search-submit {
        width: 45px;
        height: 45px;
        padding: 0 !important;
        border-radius: 15px !important;
        display: flex;
        justify-content: center;
        align-items: center;
        flex-shrink: 0;
        font-size: 1.3em; /* OPTIMIZADO: mejor proporción */
        margin-left: 0;
    }

    /* Mostrar el icono y ocultar el texto en móvil */
    .apcob-search-submit .apcob-search-submit-text {
        display: none;
    }
    
    .apcob-search-submit .apcob-search-submit-icon {
        display: inline-block;
        line-height: 1;
        color: #fff;
    }
    
    /* NUEVO: iconos más pequeños en mobile */
    .apcob-asociado-item p.apcob-asociado-info .material-symbols-outlined {
        top: 2px;
        font-size: 1.1em;
    }
}

/* ==========================================
   SISTEMA DE ALERTAS - ESTILOS FRONTEND
   ========================================== */

/* --- BADGES DE ESTADO DE MEMBRESÍA EN FRONTEND --- */
.membership-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: 'Lexend Deca', sans-serif;
    position: relative;
    top: -2px;
    animation: apcobFadeIn 0.5s ease-out; /* NUEVO: animación de entrada */
}

.membership-badge.expired {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
    border: 1px solid #f1aeb5;
}

.membership-badge.expiring {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    color: #856404;
    border: 1px solid #ffeaa7;
}

.membership-badge.active {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* --- ESTILOS PARA MEMBRESÍAS EXPIRADAS --- */
.apcob-asociado-item.membership-expired {
    opacity: 0.75;
    border-left: 4px solid #dc3545;
    background: linear-gradient(135deg, #ffffff 0%, #fefefe 100%);
    position: relative;
}

.apcob-asociado-item.membership-expired::before {
    content: "⚠️";
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 1.2em;
    opacity: 0.6;
}

.apcob-asociado-item.membership-expired .apcob-asociado-name {
    color: #6c757d;
}

.apcob-asociado-item.membership-expired .apcob-asociado-info a {
    color: #6c757d;
}

/* --- TOOLTIPS PARA BADGES --- */
.membership-badge[title] {
    cursor: help;
    position: relative;
}

.membership-badge[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 5px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 5px;
}

.membership-badge[title]:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: #333;
    z-index: 1000;
}

/* ==========================================
   SISTEMA DE ALERTAS - ESTILOS BACKEND
   ========================================== */

/* --- ESTILOS PARA EL BACKEND/ADMIN --- */

/* Meta box de configuración de alertas */
.apcob-alerts-config {
    font-family: 'Hind', sans-serif;
}

.apcob-alert-section {
    margin: 15px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #7f2468;
    animation: apcobFadeIn 0.3s ease-out; /* NUEVO: animación de entrada */
}

.apcob-alert-section h4 {
    margin: 0 0 12px 0;
    color: #7f2468;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Lexend Deca', sans-serif;
}

.apcob-alert-checkboxes label {
    display: flex;
    align-items: center;
    margin: 8px 0;
    font-size: 13px;
    color: #495057;
    cursor: pointer;
    transition: color 0.2s ease;
}

.apcob-alert-checkboxes label:hover {
    color: #7f2468;
}

.apcob-alert-checkboxes input[type="checkbox"] {
    margin-right: 8px;
    accent-color: #7f2468;
}

/* Estilos para inputs en meta box */
.apcob-alerts-config input[type="email"] {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 8px 12px;
    font-family: 'Hind', sans-serif;
    transition: border-color 0.2s ease;
}

.apcob-alerts-config input[type="email"]:focus {
    border-color: #7f2468;
    outline: none;
    box-shadow: 0 0 0 2px rgba(127, 36, 104, 0.1);
}

/* --- PÁGINA DE CONFIGURACIÓN DE ALERTAS --- */

.apcob-alerts-settings-page {
    max-width: 1200px;
    margin: 0 auto;
}

.apcob-alerts-settings-page .form-table th {
    font-family: 'Lexend Deca', sans-serif;
    color: #7f2468;
    font-weight: 500;
}

.apcob-alerts-settings-page .form-table td input[type="text"],
.apcob-alerts-settings-page .form-table td input[type="email"],
.apcob-alerts-settings-page .form-table td input[type="time"],
.apcob-alerts-settings-page .form-table td textarea {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px 12px;
    font-family: 'Hind', sans-serif;
    transition: all 0.2s ease;
}

.apcob-alerts-settings-page .form-table td input:focus,
.apcob-alerts-settings-page .form-table td textarea:focus {
    border-color: #7f2468;
    box-shadow: 0 0 0 2px rgba(127, 36, 104, 0.1);
    outline: none;
}

.apcob-alerts-settings-page textarea.widefat {
    font-family: 'Hind', sans-serif;
    line-height: 1.5;
    resize: vertical;
}

/* --- ESTADÍSTICAS DE ALERTAS MEJORADAS --- */
.apcob-stats {
    display: flex;
    justify-content: space-around;
    margin: 20px 0;
    padding: 15px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    border: 1px solid #dee2e6;
}

.apcob-stat {
    text-align: center;
    padding: 10px;
    flex: 1;
}

.apcob-stat-number {
    font-size: 28px;
    font-weight: bold;
    display: block;
    margin-bottom: 5px;
    font-family: 'Lexend Deca', sans-serif;
}

.apcob-stat span:not(.apcob-stat-number) {
    font-size: 12px;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: 'Lexend Deca', sans-serif;
}

.apcob-stat.active .apcob-stat-number { 
    color: #28a745; 
    text-shadow: 0 1px 2px rgba(40, 167, 69, 0.1);
}

.apcob-stat.expiring .apcob-stat-number { 
    color: #ffc107; 
    text-shadow: 0 1px 2px rgba(255, 193, 7, 0.1);
}

.apcob-stat.expired .apcob-stat-number { 
    color: #dc3545; 
    text-shadow: 0 1px 2px rgba(220, 53, 69, 0.1);
}

.apcob-stat.alerts .apcob-stat-number { 
    color: #7f2468; 
    text-shadow: 0 1px 2px rgba(127, 36, 104, 0.1);
}

/* --- LISTA DE MIEMBROS URGENTES --- */
.apcob-urgent-list {
    margin: 15px 0;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #dee2e6;
}

.apcob-urgent-item {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s ease;
}

.apcob-urgent-item:hover {
    background-color: #f8f9fa;
}

.apcob-urgent-item:last-child {
    border-bottom: none;
}

.apcob-urgent-item strong {
    color: #7f2468;
    font-family: 'Lexend Deca', sans-serif;
}

.apcob-urgent-item small {
    color: #dc3545;
    font-weight: 500;
}

.apcob-urgent-item a {
    background: #7f2468;
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 12px;
    transition: background-color 0.2s ease;
}

.apcob-urgent-item a:hover {
    background: #6a1d56;
}

/* --- TABLAS DE ESTADO DE ALERTAS --- */
.wp-list-table.apcob-alerts-table {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.wp-list-table.apcob-alerts-table thead th {
    background: linear-gradient(135deg, #7f2468 0%, #6a1d56 100%);
    color: white;
    font-family: 'Lexend Deca', sans-serif;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 12px;
}

.wp-list-table.apcob-alerts-table tbody tr:hover {
    background-color: rgba(127, 36, 104, 0.05);
}

/* --- BOTONES PERSONALIZADOS --- */
.button.apcob-button-primary {
    background: linear-gradient(135deg, #7f2468 0%, #6a1d56 100%);
    border-color: #7f2468;
    color: white;
    font-family: 'Lexend Deca', sans-serif;
    border-radius: 6px;
    padding: 8px 16px;
    text-shadow: none;
    box-shadow: 0 2px 4px rgba(127, 36, 104, 0.2);
    transition: all 0.2s ease;
}

.button.apcob-button-primary:hover {
    background: linear-gradient(135deg, #6a1d56 0%, #5a1a4a 100%);
    box-shadow: 0 3px 6px rgba(127, 36, 104, 0.3);
    transform: translateY(-1px);
}

/* --- NOTIFICACIONES Y ALERTS --- */
.notice.apcob-notice {
    border-left-color: #7f2468 !important;
    background: linear-gradient(135deg, rgba(127, 36, 104, 0.05) 0%, rgba(127, 36, 104, 0.02) 100%);
}

.notice.apcob-notice.notice-success {
    border-left-color: #28a745 !important;
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.05) 0%, rgba(40, 167, 69, 0.02) 100%);
}

.notice.apcob-notice.notice-warning {
    border-left-color: #ffc107 !important;
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.05) 0%, rgba(255, 193, 7, 0.02) 100%);
}

.notice.apcob-notice.notice-error {
    border-left-color: #dc3545 !important;
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.05) 0%, rgba(220, 53, 69, 0.02) 100%);
}

/* --- COLUMNAS DEL ADMIN LISTADO --- */
.fixed .column-membership_status {
    width: 120px;
}

.fixed .column-membership_expiry {
    width: 100px;
}
.fixed .column-apcob_services {
    width: 200px; /* Ancho para la nueva columna de servicios */
}


/* Estilos para el estado en las columnas */
.column-membership_status span {
    font-weight: 600;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* --- FILTROS DE ADMIN MEJORADOS --- */
.tablenav .actions select[name="membership_filter"],
.tablenav .actions select[name="service_filter_admin"] { /* Añadir selector de filtro de servicio */
    border-color: #7f2468;
    border-radius: 4px;
}

.tablenav .actions select[name="membership_filter"]:focus,
.tablenav .actions select[name="service_filter_admin"]:focus { /* Añadir selector de filtro de servicio */
    box-shadow: 0 0 0 2px rgba(127, 36, 104, 0.1);
    outline: none;
}

/* ==========================================
   NUEVOS ESTILOS PARA SERVICIOS
   ========================================== */

/* Estilos para la sección de servicios en el item del asociado */
.apcob-asociado-services-list {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    width: 100%;
}

.apcob-asociado-services-list h4 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.1em;
    color: #7f2468;
    font-family: 'Lexend Deca', sans-serif;
}

.apcob-asociado-services-list ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.apcob-asociado-services-list li {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
    font-size: 0.9em;
    color: #444;
}

/* Esfera de color para el servicio */
.apcob-service-color-sphere {
    display: inline-block;
    width: 14px;
    height: 14px;
    min-width: 14px; /* Asegura que no se achique */
    border-radius: 50%;
    margin-left: 6px;
    margin-right: 12px;
    border: 1px solid rgba(0,0,0,0.1);
    box-shadow: inset 0 0 2px rgba(0,0,0,0.1);
}

/* Contenedor de filtros de servicio en el frontend */
.apcob-service-filter-container {
    margin: 20px 20px 30px 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 15px;
    border: 1px solid #eee;
    box-shadow: 0 4px 10px rgba(0,0,0,0.0);
    text-align: center;
}

.apcob-filter-label {
    font-family: 'Lexend Deca', sans-serif;
    font-size: 1.1em;
    color: #333;
    margin-bottom: 15px;
    font-weight: 500;
}

.apcob-service-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.apcob-service-button {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 0.9em;
    font-weight: 600;
    text-decoration: none;
    color: white; /* Color de texto predeterminado para los botones */
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    border: 1px solid transparent; /* Borde para el efecto hover/active */
    font-family: 'Hind', sans-serif;
}

.apcob-service-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    opacity: 0.9;
    border-color: rgba(255,255,255,0.5); /* Borde blanco sutil en hover */
}

.apcob-service-button.active {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    border-color: white; /* Borde blanco más pronunciado para activo */
}

/* Media query para móviles */
@media (max-width: 600px) {
    .apcob-service-filter-container {
        padding: 10px;
        margin: 15px 15px 25px 15px;
    }

    .apcob-filter-label {
        font-size: 1em;
        margin-bottom: 10px;
    }

    .apcob-service-button {
        padding: 8px 15px;
        font-size: 0.85em;
    }
}


/* ==========================================
   OPTIMIZACIONES Y MEJORAS ADICIONALES
   ========================================== */

/* --- SCROLL SUAVE PARA NAVEGACIÓN --- */
html {
    scroll-behavior: smooth;
}

/* --- ANIMACIONES SUTILES --- */
@keyframes apcobFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- RESPONSIVE PARA ALERTAS --- */
@media (max-width: 782px) {
    .apcob-stats {
        flex-direction: column;
        gap: 10px;
    }
    
    .apcob-stat {
        border-bottom: 1px solid #dee2e6;
        padding-bottom: 10px;
    }
    
    .apcob-stat:last-child {
        border-bottom: none;
        padding-bottom: 10px;
    }
    
    .apcob-urgent-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .apcob-urgent-item a {
        align-self: flex-end;
    }
}

/* --- OPTIMIZACIÓN PARA IMPRESIÓN --- */
@media print {
    .apcob-search-form {
        display: none;
    }
    
    .apcob-asociado-item {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .apcob-asociado-item p a {
        color: #000 !important;
        text-decoration: underline;
    }
    
    .membership-badge {
        background: transparent !important;
        border: 1px solid #000 !important;
        color: #000 !important;
    }

    .apcob-service-filter-container {
        display: none; /* Ocultar filtros de servicio en la impresión */
    }

    .apcob-service-color-sphere {
        border: 1px solid #000 !important; /* Asegurar visibilidad de la esfera en impresión */
    }
}
