/**
 * Filtro Consular Service - Estilos
 */

:root {
    --fc-primary: #003366;
    --fc-primary-dark: #002244;
    --fc-bg-field: #F8F9FA;
    --fc-border: #DEE2E6;
    --fc-text: #212529;
    --fc-text-muted: #6C757D;
    --fc-error: #DC3545;
    --fc-success: #28A745;
    --fc-radius: 10px;
    --fc-radius-sm: 8px;
    --fc-transition: 0.25s ease-out;
    --fc-shadow: 0 2px 8px rgba(0, 51, 102, 0.08);
    --fc-shadow-hover: 0 8px 24px rgba(0, 51, 102, 0.15);
}

/* --- CONTENEDOR PRINCIPAL --- */
.fc-form-container {
    margin-bottom: 32px;
}

/* --- FORMULARIO --- */
.fc-form {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: stretch;
    background: #fff;
    padding: 20px 24px;
    border-radius: var(--fc-radius);
    border: 1px solid var(--fc-border);
    box-shadow: var(--fc-shadow);
    margin-bottom: 10px;
}

.fc-form fieldset {
    flex: 1 1 180px;
    margin: 0;
    padding: 0;
    border: none;
}

.fc-form label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--fc-text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- SELECTS --- */
.fc-form select {
    width: 100%;
    padding: 2px 16px !important;
    border-radius: var(--fc-radius-sm);
    border: 1.5px solid var(--fc-border);
    background: var(--fc-bg-field);
    color: var(--fc-text);
    font-size: 15px;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--fc-transition);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236C757D' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

.fc-form select:hover {
    border-color: #ADB5BD;
    background-color: #fff;
}

.fc-form select:focus {
    outline: none;
    border-color: var(--fc-primary);
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(0, 51, 102, 0.15);
}

.fc-form select option {
    padding: 8px;
}

/* --- BOTÓN --- */
.fc-form button[type="submit"] {
    flex: 0 0 auto;
    padding: 12px 28px;
    border: none;
    border-radius: var(--fc-radius-sm);
    background: var(--fc-primary);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--fc-transition);
    align-self: flex-end;
    white-space: nowrap;
}

.fc-form button[type="submit"]:hover {
    background: var(--fc-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 51, 102, 0.25);
}

.fc-form button[type="submit"]:active {
    transform: translateY(0);
}

.fc-form button[type="submit"]:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 51, 102, 0.25);
}

/* --- MENSAJES DE ERROR --- */
.fc-error,
.fc-error-msg {
    width: 100%;
    padding: 12px 16px;
    background: #FFF5F5;
    border-left: 4px solid var(--fc-error);
    color: var(--fc-error);
    border-radius: var(--fc-radius-sm);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 16px;
    animation: fc-shake 0.4s ease-out;
}

@keyframes fc-shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

/* --- SPINNER DE CARGA --- */
.fc-loading {
    position: relative;
    pointer-events: none;
}

.fc-loading::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.fc-spinner {
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3px solid var(--fc-border);
    border-top-color: var(--fc-primary);
    border-radius: 50%;
    animation: fc-spin 0.8s linear infinite;
    margin: 40px auto;
    text-align: center;
}

.fc-loading-text {
    text-align: center;
    color: var(--fc-text-muted);
    font-size: 14px;
    padding: 20px;
}

@keyframes fc-spin {
    to { transform: rotate(360deg); }
}

/* --- RESULTADOS --- */
.fc-resultados {
    min-height: 200px;
}

.fc-resultados[aria-busy="true"] {
    opacity: 0.7;
}

/* --- GRID DE RESULTADOS --- */
.fc-loop {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

/* --- TARJETAS DE RESULTADO --- */
.fc-item {
    background: #fff;
    padding: 20px;
    border-radius: var(--fc-radius);
    border: 1px solid var(--fc-border);
    box-shadow: var(--fc-shadow);
    transition: all var(--fc-transition);
}

/* Tarjeta enlazada: todo el <a> es clickable */
a.fc-item-card {
    display: block;
    text-decoration: none;
}

a.fc-item-card h3 {
    color: var(--fc-primary);
}

a.fc-item-card .fc-excerpt {
    color: var(--fc-text-muted);
}

a.fc-item-card:hover {
    text-decoration: none;
}

a.fc-item-card:hover h3 {
    text-decoration: underline;
}

.fc-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--fc-shadow-hover);
    border-color: var(--fc-primary);
}

.fc-item h3 {
    margin: 0 0 12px;
    font-size: 18px;
    line-height: 1.4;
}

.fc-item h3 a {
    color: var(--fc-primary);
    text-decoration: none;
    transition: color var(--fc-transition);
}

.fc-item h3 a:hover {
    color: var(--fc-primary-dark);
    text-decoration: underline;
}

.fc-excerpt {
    color: var(--fc-text-muted);
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
}

.fc-content {
    color: var(--fc-text);
    font-size: 15px;
    line-height: 1.7;
    margin-top: 12px;
}

/* --- POST POR DEFECTO (FULL WIDTH) --- */
.fc-item-default {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, #F8F9FA 0%, #E9ECEF 100%);
    border-left: 5px solid var(--fc-primary);
}

.fc-item-default h3 {
    font-size: 22px;
    margin-bottom: 16px;
}

.fc-item-default h3 a {
    color: var(--fc-primary);
}

/* --- SIN RESULTADOS --- */
.fc-no-results {
    text-align: center;
    padding: 40px 20px;
    color: var(--fc-text-muted);
    font-size: 16px;
    background: var(--fc-bg-field);
    border-radius: var(--fc-radius);
    border: 2px dashed var(--fc-border);
}

/* --- ACCESIBILIDAD: SOLO LECTORES --- */
.fc-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --- FOCUS VISIBLE MEJORADO --- */
*:focus-visible {
    outline: 3px solid var(--fc-primary);
    outline-offset: 2px;
}

/* --- RESPONSIVE MOBILE FIRST --- */
@media (max-width: 768px) {
    .fc-form {
        flex-direction: column;
        padding: 16px;
    }

    .fc-form fieldset {
        flex: 1 1 100%;
    }

    .fc-form select {
        min-height: 44px;
        font-size: 13px;
    }

    .fc-form button[type="submit"] {
        width: 100%;
        padding: 14px 20px;
    }

    .fc-loop {
        grid-template-columns: 1fr;
    }

    .fc-item {
        padding: 16px;
    }

    .fc-item-default {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .fc-form {
        gap: 12px;
    }

    .fc-form label {
        font-size: 12px;
    }

    .fc-item h3 {
        font-size: 16px;
    }

    .fc-item-default h3 {
        font-size: 18px;
    }
}