/**
 * BBQ Report - Recipe Filter System Styles
 * Version: 1.0.0
 *
 * Styles for AJAX-powered recipe filtering
 * - Filter interface styling
 * - Active/selected states
 * - Results grid layout
 * - Loading states
 * - Mobile-responsive
 */

/* ============================================
   FILTER CONTAINER
   ============================================ */

.bbq-recipe-filters {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    margin-bottom: var(--space-2xl);
    box-shadow: var(--shadow-md);
}

.bbq-recipe-filters__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 2px solid var(--ash);
}

.bbq-recipe-filters__title {
    font-family: var(--font-heading);
    font-size: var(--fs-3xl);
    color: var(--charcoal);
    margin: 0;
    letter-spacing: 0.02em;
}

.bbq-recipe-filters__reset {
    padding: var(--space-sm) var(--space-lg);
    background-color: var(--smoke);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: var(--fs-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.bbq-recipe-filters__reset:hover {
    background-color: var(--coal);
    transform: translateY(-1px);
}

.bbq-recipe-filters__reset:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ============================================
   FILTER GROUPS
   ============================================ */

.filter-group {
    margin-bottom: var(--space-xl);
}

.filter-group:last-child {
    margin-bottom: 0;
}

.filter-group__label {
    display: block;
    font-family: var(--font-heading);
    font-size: var(--fs-xl);
    color: var(--charcoal);
    margin-bottom: var(--space-md);
    letter-spacing: 0.02em;
}

.filter-group__options {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

/* ============================================
   FILTER BUTTONS (CHECKBOX STYLE)
   ============================================ */

.filter-option {
    position: relative;
}

.filter-option__input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.filter-option__label {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-lg);
    background-color: var(--ash);
    color: var(--coal);
    border: 2px solid transparent;
    border-radius: var(--radius-full);
    font-family: var(--font-body);
    font-size: var(--fs-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-base);
    user-select: none;
}

.filter-option__label:hover {
    background-color: #d6d6d6;
    border-color: var(--smoke);
}

/* Active/Selected State */
.filter-option__input:checked + .filter-option__label {
    background-color: var(--ember);
    color: white;
    border-color: var(--ember);
    font-weight: 600;
    box-shadow: var(--shadow-md);
}

.filter-option__input:checked + .filter-option__label:hover {
    background-color: var(--flame);
    border-color: var(--flame);
}

/* Focus State */
.filter-option__input:focus-visible + .filter-option__label {
    outline: 3px solid var(--ember);
    outline-offset: 2px;
}

/* Icon in filter option */
.filter-option__icon {
    font-size: var(--fs-lg);
    line-height: 1;
}

/* ============================================
   FILTER COUNT BADGE
   ============================================ */

.filter-option__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 var(--space-xs);
    background-color: var(--smoke);
    color: white;
    font-size: var(--fs-xs);
    font-weight: 600;
    border-radius: var(--radius-full);
    margin-left: var(--space-xs);
}

.filter-option__input:checked + .filter-option__label .filter-option__count {
    background-color: rgba(255, 255, 255, 0.3);
}

/* ============================================
   ACTIVE FILTERS DISPLAY
   ============================================ */

.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    padding: var(--space-md);
    background-color: #fff9e6;
    border-left: 4px solid var(--warning);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
}

.active-filters.hidden {
    display: none;
}

.active-filters__label {
    font-weight: 600;
    color: var(--charcoal);
    margin-right: var(--space-sm);
}

.active-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    background-color: var(--ember);
    color: white;
    border-radius: var(--radius-full);
    font-size: var(--fs-sm);
    font-weight: 500;
}

.active-filter-tag__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background-color: rgba(255, 255, 255, 0.3);
    border: none;
    border-radius: var(--radius-full);
    color: white;
    cursor: pointer;
    transition: background-color var(--transition-fast);
    padding: 0;
    font-size: var(--fs-xs);
}

.active-filter-tag__remove:hover {
    background-color: rgba(255, 255, 255, 0.5);
}

/* ============================================
   RESULTS SECTION
   ============================================ */

.bbq-recipe-results {
    min-height: 400px;
    position: relative;
}

.bbq-recipe-results__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-md);
    border-bottom: 2px solid var(--ash);
}

.bbq-recipe-results__count {
    font-family: var(--font-heading);
    font-size: var(--fs-2xl);
    color: var(--charcoal);
    letter-spacing: 0.02em;
}

.bbq-recipe-results__count-number {
    color: var(--ember);
}

.bbq-recipe-results__sort {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.bbq-recipe-results__sort-label {
    font-weight: 600;
    color: var(--smoke);
    font-size: var(--fs-sm);
}

.bbq-recipe-results__sort-select {
    padding: var(--space-sm) var(--space-md);
    border: 2px solid var(--ash);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: var(--fs-sm);
    color: var(--coal);
    background-color: white;
    cursor: pointer;
    transition: border-color var(--transition-base);
}

.bbq-recipe-results__sort-select:hover {
    border-color: var(--smoke);
}

.bbq-recipe-results__sort-select:focus {
    outline: none;
    border-color: var(--ember);
}

/* ============================================
   RECIPE GRID
   ============================================ */

.recipe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-xl);
    margin-bottom: var(--space-2xl);
}

.recipe-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
    display: flex;
    flex-direction: column;
}

.recipe-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.recipe-card__image {
    position: relative;
    width: 100%;
    padding-bottom: 66.67%; /* 3:2 aspect ratio */
    overflow: hidden;
    background-color: var(--ash);
}

.recipe-card__image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.recipe-card:hover .recipe-card__image img {
    transform: scale(1.05);
}

.recipe-card__difficulty {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--fs-xs);
    font-weight: 600;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    z-index: 1;
}

.recipe-card__difficulty--beginner {
    background-color: var(--success);
    color: white;
}

.recipe-card__difficulty--intermediate {
    background-color: var(--warning);
    color: var(--coal);
}

.recipe-card__difficulty--advanced {
    background-color: var(--danger);
    color: white;
}

.recipe-card__content {
    padding: var(--space-lg);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.recipe-card__title {
    font-family: var(--font-heading);
    font-size: var(--fs-2xl);
    color: var(--charcoal);
    margin: 0 0 var(--space-sm) 0;
    letter-spacing: 0.02em;
    line-height: 1.2;
}

.recipe-card__title a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition-fast);
}

.recipe-card__title a:hover {
    color: var(--ember);
}

.recipe-card__excerpt {
    color: var(--smoke);
    font-size: var(--fs-sm);
    line-height: 1.6;
    margin-bottom: var(--space-md);
    flex: 1;
}

.recipe-card__meta {
    display: flex;
    gap: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--ash);
    font-size: var(--fs-sm);
    color: var(--smoke);
}

.recipe-card__meta-item {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.recipe-card__meta-icon {
    color: var(--ember);
    font-size: var(--fs-base);
}

.recipe-card__tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    margin-top: var(--space-md);
}

.recipe-card__tag {
    padding: var(--space-xs) var(--space-sm);
    background-color: var(--ash);
    color: var(--coal);
    font-size: var(--fs-xs);
    border-radius: var(--radius-sm);
    font-weight: 500;
}

/* ============================================
   LOADING STATE
   ============================================ */

.bbq-recipe-results.loading {
    position: relative;
}

.bbq-recipe-results.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.loading-spinner {
    display: none;
    width: 60px;
    height: 60px;
    border: 4px solid var(--ash);
    border-top-color: var(--ember);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 11;
}

.bbq-recipe-results.loading .loading-spinner {
    display: block;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* ============================================
   NO RESULTS STATE
   ============================================ */

.no-results {
    display: none;
    text-align: center;
    padding: var(--space-3xl) var(--space-xl);
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.no-results.visible {
    display: block;
}

.no-results__icon {
    font-size: 4rem;
    margin-bottom: var(--space-lg);
    opacity: 0.3;
}

.no-results__title {
    font-family: var(--font-heading);
    font-size: var(--fs-3xl);
    color: var(--charcoal);
    margin-bottom: var(--space-md);
}

.no-results__message {
    color: var(--smoke);
    font-size: var(--fs-lg);
    margin-bottom: var(--space-xl);
}

.no-results__actions {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
    flex-wrap: wrap;
}

/* ============================================
   PAGINATION
   ============================================ */

.bbq-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-sm);
    margin-top: var(--space-2xl);
    padding-top: var(--space-xl);
    border-top: 2px solid var(--ash);
}

.bbq-pagination__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    padding: var(--space-sm) var(--space-md);
    background-color: var(--bg-card);
    color: var(--coal);
    border: 2px solid var(--ash);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: var(--fs-base);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
}

.bbq-pagination__button:hover:not(:disabled) {
    background-color: var(--ember);
    color: white;
    border-color: var(--ember);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.bbq-pagination__button.active {
    background-color: var(--ember);
    color: white;
    border-color: var(--ember);
}

.bbq-pagination__button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.bbq-pagination__dots {
    padding: 0 var(--space-sm);
    color: var(--smoke);
}

/* ============================================
   MOBILE OPTIMIZATIONS
   ============================================ */

@media (max-width: 768px) {
    .bbq-recipe-filters {
        padding: var(--space-lg);
    }

    .bbq-recipe-filters__header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-md);
    }

    .bbq-recipe-filters__title {
        font-size: var(--fs-2xl);
    }

    .bbq-recipe-filters__reset {
        width: 100%;
    }

    .filter-group__label {
        font-size: var(--fs-lg);
    }

    .filter-group__options {
        gap: var(--space-xs);
    }

    .filter-option__label {
        padding: var(--space-xs) var(--space-md);
        font-size: var(--fs-xs);
    }

    .recipe-grid {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }

    .bbq-recipe-results__header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-md);
    }

    .bbq-recipe-results__sort {
        width: 100%;
    }

    .bbq-recipe-results__sort-select {
        flex: 1;
    }

    .bbq-pagination {
        gap: var(--space-xs);
    }

    .bbq-pagination__button {
        min-width: 40px;
        height: 40px;
        padding: var(--space-xs) var(--space-sm);
        font-size: var(--fs-sm);
    }
}

@media (max-width: 480px) {
    .active-filters {
        flex-direction: column;
        align-items: flex-start;
    }

    .recipe-card__meta {
        flex-direction: column;
        gap: var(--space-xs);
    }
}

/* ============================================
   ACCESSIBILITY ENHANCEMENTS
   ============================================ */

/* Announce changes to screen readers */
.sr-announcement {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .filter-option__label {
        border-color: var(--coal);
    }

    .filter-option__input:checked + .filter-option__label {
        border-width: 3px;
    }

    .recipe-card {
        border: 2px solid var(--coal);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .filter-option__label,
    .recipe-card,
    .bbq-pagination__button {
        transition: none !important;
    }

    .recipe-card:hover {
        transform: none !important;
    }

    .recipe-card:hover .recipe-card__image img {
        transform: none !important;
    }

    .loading-spinner {
        animation: none !important;
    }
}
