/**
 * YAWC Advanced Search - Styles
 *
 * @package YAWC_Core
 */

/* ============================================
   Search Container
   ============================================ */

.yawc-search-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* ============================================
   Search Form
   ============================================ */

.yawc-search-form {
    margin-bottom: 2rem;
}

.yawc-search-wrapper {
    position: relative;
    margin-bottom: 1.5rem;
}

.yawc-search-input-group {
    position: relative;
    display: flex;
    gap: 0.5rem;
}

#yawc-search-input {
    flex: 1;
    padding: 0.875rem 1rem 0.875rem 3rem;
    font-size: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    background-color: #fff;
    transition: all 0.2s ease;
}

#yawc-search-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.yawc-search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.25rem;
    height: 1.25rem;
    color: #9ca3af;
    pointer-events: none;
}

.yawc-search-icon svg {
    width: 100%;
    height: 100%;
    stroke-width: 2;
}

/* ============================================
   Autocomplete
   ============================================ */

.yawc-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.5rem;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.yawc-autocomplete.active {
    display: block;
}

.yawc-autocomplete-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.15s ease;
}

.yawc-autocomplete-item:last-child {
    border-bottom: none;
}

.yawc-autocomplete-item:hover,
.yawc-autocomplete-item.active {
    background-color: #f9fafb;
}

.yawc-autocomplete-title {
    font-weight: 500;
    color: #1f2937;
}

.yawc-autocomplete-type {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    background-color: #e5e7eb;
    color: #6b7280;
    border-radius: 0.25rem;
}

/* ============================================
   Filters
   ============================================ */

.yawc-search-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    padding: 1.5rem;
    background-color: #f9fafb;
    border-radius: 0.5rem;
    margin-bottom: 2rem;
}

.yawc-filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.yawc-filter-group label.yawc-filter-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: #374151;
    margin-bottom: 0.25rem;
}

.yawc-filter-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.yawc-filter-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.yawc-filter-option input[type="checkbox"],
.yawc-filter-option input[type="radio"] {
    width: 1rem;
    height: 1rem;
    cursor: pointer;
}

.yawc-filter-option label {
    flex: 1;
    cursor: pointer;
    font-size: 0.875rem;
    color: #4b5563;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.yawc-filter-count {
    font-size: 0.75rem;
    color: #9ca3af;
}

.yawc-filter-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    background-color: #fff;
    font-size: 0.875rem;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.yawc-filter-select:focus {
    outline: none;
    border-color: #3b82f6;
}

.yawc-filter-date {
    padding: 0.5rem 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    background-color: #fff;
    font-size: 0.875rem;
}

.yawc-filter-date:focus {
    outline: none;
    border-color: #3b82f6;
}

.yawc-filter-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.yawc-clear-filters {
    padding: 0.5rem 1rem;
    background-color: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.yawc-clear-filters:hover {
    background-color: #f9fafb;
    border-color: #d1d5db;
}

/* ============================================
   Results Header
   ============================================ */

.yawc-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e5e7eb;
}

.yawc-results-info {
    font-size: 0.875rem;
    color: #6b7280;
}

.yawc-results-sort {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.yawc-results-sort label {
    font-size: 0.875rem;
    color: #6b7280;
}

#yawc-sort-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    background-color: #fff;
    font-size: 0.875rem;
    cursor: pointer;
}

/* ============================================
   Results Grid
   ============================================ */

#yawc-search-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
    min-height: 200px;
}

.yawc-result-item {
    background-color: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    overflow: hidden;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
}

.yawc-result-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #d1d5db;
    transform: translateY(-2px);
}

.yawc-result-item.fade-in {
    animation: fadeIn 0.3s ease;
}

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

.yawc-result-thumbnail {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    background-color: #f3f4f6;
    overflow: hidden;
}

.yawc-result-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.yawc-result-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: bold;
    color: #9ca3af;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.yawc-result-type {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    background-color: rgba(255, 255, 255, 0.95);
    color: #3b82f6;
    border-radius: 0.25rem;
    backdrop-filter: blur(4px);
}

.yawc-result-content {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.yawc-result-title {
    margin: 0 0 0.75rem 0;
    font-size: 1.125rem;
    line-height: 1.4;
}

.yawc-result-title a {
    color: #1f2937;
    text-decoration: none;
    transition: color 0.2s ease;
}

.yawc-result-title a:hover {
    color: #3b82f6;
}

.yawc-result-excerpt {
    font-size: 0.875rem;
    line-height: 1.6;
    color: #6b7280;
    margin-bottom: 1rem;
    flex: 1;
}

.yawc-result-excerpt mark {
    background-color: #fef3c7;
    color: #92400e;
    padding: 0.125rem 0.25rem;
    border-radius: 0.125rem;
}

.yawc-result-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.yawc-tag {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    background-color: #eff6ff;
    color: #1e40af;
    border-radius: 0.25rem;
    font-weight: 500;
}

.yawc-result-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid #f3f4f6;
    font-size: 0.75rem;
    color: #9ca3af;
}

.yawc-result-date {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.yawc-result-meta {
    display: flex;
    gap: 0.75rem;
}

.yawc-meta-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* ============================================
   Load More
   ============================================ */

.yawc-load-more-container {
    text-align: center;
    margin-top: 2rem;
}

#yawc-load-more {
    padding: 0.875rem 2rem;
    font-size: 0.9375rem;
    font-weight: 600;
    background-color: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

#yawc-load-more:hover {
    background-color: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

#yawc-load-more.loading {
    background-color: #9ca3af;
    cursor: not-allowed;
    pointer-events: none;
}

/* ============================================
   Loading & Empty States
   ============================================ */

.yawc-loading,
.yawc-no-results,
.yawc-error {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 1rem;
}

.yawc-loading svg,
.yawc-no-results svg,
.yawc-error svg {
    width: 4rem;
    height: 4rem;
    margin: 0 auto 1rem;
    color: #9ca3af;
}

.yawc-spinner {
    display: inline-block;
    width: 3rem;
    height: 3rem;
    border: 4px solid #f3f4f6;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.yawc-no-results p,
.yawc-error p {
    font-size: 1.125rem;
    color: #6b7280;
    margin: 0;
}

.yawc-loading p {
    font-size: 1rem;
    color: #6b7280;
    margin-top: 1rem;
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 768px) {
    .yawc-search-filters {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    #yawc-search-results {
        grid-template-columns: 1fr;
    }

    .yawc-results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .yawc-filter-actions {
        flex-direction: column;
    }

    .yawc-clear-filters {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .yawc-search-container {
        padding: 1rem 0.75rem;
    }

    #yawc-search-input {
        padding: 0.75rem 1rem 0.75rem 2.5rem;
        font-size: 0.9375rem;
    }

    .yawc-search-icon {
        left: 0.75rem;
        width: 1rem;
        height: 1rem;
    }

    .yawc-result-content {
        padding: 1rem;
    }

    .yawc-result-title {
        font-size: 1rem;
    }

    .yawc-result-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

/* ============================================
   Dark Mode Support (Optional)
   ============================================ */

@media (prefers-color-scheme: dark) {
    .yawc-search-container {
        color: #e5e7eb;
    }

    #yawc-search-input {
        background-color: #1f2937;
        border-color: #374151;
        color: #e5e7eb;
    }

    #yawc-search-input:focus {
        border-color: #3b82f6;
    }

    .yawc-autocomplete {
        background-color: #1f2937;
        border-color: #374151;
    }

    .yawc-autocomplete-item:hover,
    .yawc-autocomplete-item.active {
        background-color: #374151;
    }

    .yawc-autocomplete-title {
        color: #e5e7eb;
    }

    .yawc-search-filters {
        background-color: #1f2937;
    }

    .yawc-filter-select,
    .yawc-filter-date {
        background-color: #374151;
        border-color: #4b5563;
        color: #e5e7eb;
    }

    .yawc-result-item {
        background-color: #1f2937;
        border-color: #374151;
    }

    .yawc-result-title a {
        color: #e5e7eb;
    }

    .yawc-result-excerpt {
        color: #9ca3af;
    }

    .yawc-result-footer {
        border-top-color: #374151;
    }
}

/* ============================================
   Accessibility
   ============================================ */

.yawc-search-form *:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.yawc-result-item:focus-within {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

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