/* Buscador de Cursos Microsistemas - Frontend Styles */

.bcm-buscador-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Título */
.bcm-title {
    font-size: 28px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 25px;
    text-align: center;
}

/* Título versión simplificada */
.bcm-title-simplificado {
    font-size: 14px;
    color: #7f8c8d;
    margin-bottom: 20px;
    text-align: center;
    font-weight: normal;
}

/* Sección de filtros */
.bcm-filters-section {
    background: #ffffff;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    margin-bottom: 30px;
}

/* Barra de búsqueda */
.bcm-search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
}

.bcm-search-input {
    flex: 1;
    padding: 12px 16px;
    font-size: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: border-color 0.3s;
    height: 48px;
    box-sizing: border-box;
}

.bcm-search-input:focus {
    outline: none;
    border-color: #3498db;
}

.bcm-search-btn {
    padding: 12px 24px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
    height: 48px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bcm-search-btn:hover {
    background: #2980b9;
}

/* Grid de filtros */
.bcm-filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.bcm-filter-group {
    display: flex;
    flex-direction: column;
}

.bcm-filter-group label {
    font-weight: 600;
    color: #34495e;
    margin-bottom: 8px;
    font-size: 14px;
}

.bcm-filter-select {
    padding: 10px 12px;
    font-size: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

.bcm-filter-select:focus {
    outline: none;
    border-color: #3498db;
}

/* Acciones de filtros */
.bcm-filter-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 25px;
}

.bcm-btn {
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.bcm-btn-primary {
    background: #27ae60;
    color: white;
}

.bcm-btn-primary:hover {
    background: #229954;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

.bcm-btn-secondary {
    background: #95a5a6;
    color: white;
}

.bcm-btn-secondary:hover {
    background: #7f8c8d;
}

/* Sección de resultados */
.bcm-results-section {
    margin-top: 30px;
}

.bcm-results-header {
    margin-bottom: 20px;
}

.bcm-results-count {
    font-size: 16px;
    color: #7f8c8d;
    text-align: center;
}

.bcm-results-count strong {
    color: #2c3e50;
    font-size: 18px;
}

/* Loading spinner */
.bcm-loading {
    text-align: center;
    padding: 40px;
}

.bcm-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: bcm-spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes bcm-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Grid de resultados - Base: 1 columna (mobile-first) */
.bcm-buscador-container .bcm-results-grid,
#bcm-results.bcm-results-grid,
.bcm-results-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 25px;
}

/* Tablet - 2 columnas desde 769px */
@media (min-width: 769px) {
    .bcm-buscador-container .bcm-results-grid,
    #bcm-results.bcm-results-grid,
    .bcm-results-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Desktop - 3 columnas desde 900px - PRIMERO aplicamos la regla general */
@media (min-width: 900px) {
    /* Regla general con máxima especificidad - 3 columnas por defecto */
    html body .bcm-buscador-container .bcm-results-grid,
    html body #bcm-results.bcm-results-grid,
    html body .bcm-results-grid,
    body .bcm-buscador-container .bcm-results-grid,
    body #bcm-results.bcm-results-grid,
    body .bcm-results-grid,
    .bcm-buscador-container .bcm-results-grid,
    #bcm-results.bcm-results-grid,
    .bcm-results-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

/* Forzar 2 columnas SOLO cuando el buscador está en un contenedor con ancho reducido (Visual Composer, etc.) */
/* NOTA: .entry-content NO se considera contenedor reducido porque es muy común en WordPress */
/* Solo se aplica a contenedores específicos como .wpb_text_column y .tablas */
@media (min-width: 769px) {
    .wpb_text_column .bcm-buscador-container .bcm-results-grid,
    .tablas .bcm-buscador-container .bcm-results-grid,
    .wpb_text_column #bcm-results.bcm-results-grid,
    .tablas #bcm-results.bcm-results-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* En móvil, siempre 1 columna */
@media (max-width: 768px) {
    .bcm-buscador-container .bcm-results-grid,
    #bcm-results.bcm-results-grid,
    .bcm-results-grid,
    .wpb_text_column .bcm-buscador-container .bcm-results-grid,
    .tablas .bcm-buscador-container .bcm-results-grid,
    .wpb_text_column #bcm-results.bcm-results-grid,
    .tablas #bcm-results.bcm-results-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Tarjeta de curso */
.bcm-curso-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
}

.bcm-curso-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.bcm-curso-header {
    padding: 20px;
    background: linear-gradient(135deg, #f6b800 0%, #d99e12 100%);
    color: white;
    position: relative;
}

.bcm-curso-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 10px 0;
    line-height: 1.4;
    color: #000000;
}

.bcm-badges-container {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.bcm-curso-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.bcm-badge-modalidad {
    background: rgba(0, 0, 0, 0.2);
    color: #000000;
    font-weight: 600;
}

.bcm-badge-isla {
    background: #000000;
    color: #f6b800;
    font-weight: 600;
}

.bcm-curso-body {
    padding: 20px;
}

.bcm-curso-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bcm-info-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 14px;
}

.bcm-info-label {
    font-weight: 600;
    color: #34495e;
    min-width: 100px;
}

.bcm-info-value {
    color: #7f8c8d;
    flex: 1;
}

.bcm-info-item.bcm-info-titulacion {
    flex-direction: column;
}

.bcm-info-item.bcm-info-titulacion .bcm-info-label {
    min-width: auto;
}

.bcm-info-item.bcm-info-titulacion .bcm-info-value {
    width: 100%;
    white-space: normal;
    word-break: break-word;
}

.bcm-curso-actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #ecf0f1;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.bcm-btn-action {
    flex: 1;
    min-width: 140px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s;
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bcm-btn-inscripcion {
    background: #27ae60;
    color: white;
    border: 2px solid #27ae60;
}

.bcm-btn-inscripcion:hover {
    background: #229954;
    border-color: #229954;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
    color: white;
}

.bcm-btn-whatsapp {
    background: #25d366;
    color: white;
    border: 2px solid #25d366;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
    padding: 10px 20px;
}

.bcm-btn-whatsapp:hover {
    background: #20ba5a;
    border-color: #20ba5a;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
    color: white;
}

.bcm-btn-line1 {
    font-size: 14px;
    font-weight: 700;
    display: block;
}

.bcm-btn-line2 {
    font-size: 11px;
    font-weight: 600;
    display: block;
    margin-top: 2px;
}

/* Sin resultados */
.bcm-no-results {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.bcm-no-results p {
    font-size: 18px;
    color: #7f8c8d;
    margin: 0;
}

/* Alinear textos del buscador (evitar justificado global del tema) */
.bcm-buscador-container,
.bcm-buscador-container p,
.bcm-buscador-container h2,
.bcm-buscador-container h3,
.bcm-buscador-container h4 {
    text-align: left;
}

/* Responsive - Tablets y móviles (1 columna) */
@media (max-width: 768px) {
    .bcm-buscador-container {
        padding: 15px;
    }
    
    .bcm-title {
        font-size: 24px;
    }
    
    .bcm-filters-section {
        padding: 20px;
    }
    
    .bcm-filters-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .bcm-search-box {
        flex-direction: column;
    }
    
    .bcm-search-btn {
        width: 100%;
    }
    
    .bcm-filter-actions {
        flex-direction: column;
    }
    
    .bcm-btn {
        width: 100%;
    }
    
    .bcm-buscador-container .bcm-results-grid,
    #bcm-results.bcm-results-grid,
    .bcm-results-grid {
        grid-template-columns: 1fr !important;
        gap: 20px;
    }
}

/* Ajuste de gap para tablets */
@media (min-width: 769px) and (max-width: 899px) {
    .bcm-buscador-container .bcm-results-grid,
    #bcm-results.bcm-results-grid,
    .bcm-results-grid {
        gap: 20px;
    }
}

/* Responsive - Móviles */
@media (max-width: 480px) {
    .bcm-buscador-container {
        padding: 10px;
    }
    
    .bcm-title {
        font-size: 20px;
        margin-bottom: 20px;
    }
    
    .bcm-filters-section {
        padding: 15px;
    }
    
    .bcm-curso-header {
        padding: 15px;
    }
    
    .bcm-curso-title {
        font-size: 16px;
    }
    
    .bcm-curso-body {
        padding: 15px;
    }
    
    .bcm-info-item {
        flex-direction: column;
        gap: 4px;
    }
    
    .bcm-info-label {
        min-width: auto;
    }
    
    .bcm-curso-actions {
        flex-direction: column;
    }
    
    .bcm-btn-action {
        width: 100%;
    }
}
