/**
 * SimRacing Affiliate Tables - Search Styles
 * Version: 2.1.1
 * 
 * Modern styles matching simracingcockpit.gg homepage aesthetic
 */

/* ==========================================================================
   Search Form Section - Full Width Modern Design
   ========================================================================== */

/* Full-width wrapper matching partners section */
.sps-search-wrapper {
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    padding: 80px 0;
    background: #f8f9fa;
    position: relative;
    overflow: hidden;
}

/* Subtle pattern overlay for consistency */
.sps-search-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        repeating-linear-gradient(45deg, transparent, transparent 50px, rgba(0,15,65,.02) 50px, rgba(0,15,65,.02) 100px);
    pointer-events: none;
}

/* Container for proper width control */
.sps-search-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 1;
}

/* Main heading matching partners style */
.sps-search-heading {
    font-size: 2.5rem;
    color: #000F41;
    font-weight: 700;
    text-align: center;
    margin: 0 0 50px 0;
    animation: fadeInUp 0.8s ease-out;
}

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

.sps-search-form {
    max-width: 800px;
    margin: 0 auto 2rem;
    animation: fadeInUp 0.8s ease-out 0.2s backwards;
}

.sps-search-box {
    position: relative;
    display: flex;
    gap: 1rem;
    align-items: stretch;
    background: white;
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 10px 40px rgba(0, 15, 65, 0.08);
    transition: all 0.3s ease;
}

.sps-search-box:hover {
    box-shadow: 0 15px 50px rgba(0, 15, 65, 0.12);
    transform: translateY(-2px);
}

.sps-search-input {
    flex: 1;
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    border: none;
    border-radius: 8px;
    outline: none;
    background: transparent;
    color: #000F41;
    font-weight: 500;
}

.sps-search-input::placeholder {
    color: #999;
    font-weight: 400;
}

.sps-search-button {
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    background: #FB643C;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.sps-search-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.sps-search-button:hover {
    background: #e5542f;
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(251, 100, 60, 0.3);
}

.sps-search-button:hover::before {
    left: 100%;
}

.sps-search-button:active {
    transform: translateY(0);
}

/* ==========================================================================
   Popular Searches / Suggestions - Modern Pills
   ========================================================================== */

.sps-search-suggestions {
    margin: 3rem 0 0;
    text-align: center;
    animation: fadeInUp 0.8s ease-out 0.4s backwards;
}

.sps-search-suggestions h3 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    color: #000F41;
    font-weight: 600;
    opacity: 0.9;
}

.sps-search-suggestion-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    list-style: none;
    margin: 0;
    padding: 0;
}

.sps-search-suggestion {
    display: inline-block;
    padding: 0.6rem 1.4rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: #000F41;
    background: white;
    border-radius: 25px;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    box-shadow: 0 2px 10px rgba(0, 15, 65, 0.06);
    opacity: 0;
    animation: suggestionFadeIn 0.5s ease-out forwards;
}

/* Stagger animations for suggestions */
.sps-search-suggestion:nth-child(1) { animation-delay: 0.5s; }
.sps-search-suggestion:nth-child(2) { animation-delay: 0.55s; }
.sps-search-suggestion:nth-child(3) { animation-delay: 0.6s; }
.sps-search-suggestion:nth-child(4) { animation-delay: 0.65s; }
.sps-search-suggestion:nth-child(5) { animation-delay: 0.7s; }
.sps-search-suggestion:nth-child(6) { animation-delay: 0.75s; }
.sps-search-suggestion:nth-child(7) { animation-delay: 0.8s; }
.sps-search-suggestion:nth-child(8) { animation-delay: 0.85s; }
.sps-search-suggestion:nth-child(9) { animation-delay: 0.9s; }
.sps-search-suggestion:nth-child(10) { animation-delay: 0.95s; }

.sps-search-suggestion:hover {
    color: white;
    background: #FB643C;
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(251, 100, 60, 0.2);
}

/* ==========================================================================
   Dynamic Page Title
   ========================================================================== */

.sps-dynamic-page-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #000F41;
    margin: 0 0 2rem 0;
    line-height: 1.2;
    animation: fadeInUp 0.8s ease-out;
}

/* ==========================================================================
   Search Results Summary
   ========================================================================== */

.sps-search-summary {
    margin: 2rem 0;
    padding: 1.5rem 2rem;
    background: white;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 5px 20px rgba(0, 15, 65, 0.08);
    animation: fadeInUp 0.8s ease-out 0.2s backwards;
}

.sps-search-summary h2 {
    margin: 0 0 0.5rem;
    font-size: 1.5rem;
    color: #000F41;
    font-weight: 600;
}

.sps-search-summary p {
    margin: 0;
    color: #666;
    font-size: 1.05rem;
}

/* ==========================================================================
   Refinement Links - Modern Card Layout
   ========================================================================== */

.sps-refinement-section {
    margin: 3rem 0;
    padding: 2rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 15, 65, 0.08);
    animation: fadeInUp 0.8s ease-out 0.3s backwards;
}

.sps-refinement-title {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    text-align: center;
    color: #000F41;
    font-weight: 600;
}

.sps-refinement-groups {
    display: flex;
    flex-wrap: wrap;
    gap: 3rem;
    justify-content: center;
}

.sps-refinement-group {
    flex: 0 1 auto;
}

.sps-refinement-group h4 {
    margin: 0 0 1rem;
    font-size: 1.1rem;
    color: #FB643C;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sps-refinement-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.sps-refinement-links li {
    margin: 0;
}

.sps-refinement-links a {
    color: #000F41;
    text-decoration: none;
    display: inline-block;
    padding: 0.5rem 1.2rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
    background: white;
}

.sps-refinement-links a:hover {
    background: #FB643C;
    color: white;
    border-color: #FB643C;
    transform: translateY(-2px);
    box-shadow: 0 3px 15px rgba(251, 100, 60, 0.2);
}

/* ==========================================================================
   Related Searches
   ========================================================================== */

.sps-related-searches {
    margin: 2rem 0;
    text-align: center;
    animation: fadeInUp 0.8s ease-out 0.4s backwards;
}

.sps-related-searches h3 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    color: #000F41;
    font-weight: 600;
}

.sps-related-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    list-style: none;
    margin: 0;
    padding: 0;
}

.sps-related-item a {
    display: inline-block;
    padding: 0.6rem 1.4rem;
    color: #FB643C;
    background: white;
    border: 2px solid #FB643C;
    border-radius: 25px;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(251, 100, 60, 0.1);
}

.sps-related-item a:hover {
    color: white;
    background: #FB643C;
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(251, 100, 60, 0.3);
}

/* ==========================================================================
   Empty State
   ========================================================================== */

.sps-search-empty {
    text-align: center;
    padding: 4rem 2rem;
    color: #666;
    animation: fadeInUp 0.8s ease-out 0.2s backwards;
}

.sps-search-empty h3 {
    color: #000F41;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

/* ==========================================================================
   Animations
   ========================================================================== */

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

@keyframes suggestionFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ==========================================================================
   Mobile Responsive
   ========================================================================== */

@media (max-width: 768px) {
    .sps-search-wrapper {
        padding: 60px 0;
    }
    
    .sps-search-heading {
        font-size: 2rem;
        margin-bottom: 40px;
    }
    
    .sps-search-box {
        flex-direction: column;
        gap: 0.5rem;
        padding: 6px;
    }
    
    .sps-search-input,
    .sps-search-button {
        width: 100%;
    }
    
    .sps-search-button {
        padding: 1rem 2rem;
    }
    
    .sps-search-suggestion-list,
    .sps-related-list {
        gap: 0.5rem;
    }
    
    .sps-search-suggestion,
    .sps-related-item a {
        font-size: 0.85rem;
        padding: 0.5rem 1rem;
    }
    
    .sps-refinement-groups {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .sps-refinement-section {
        padding: 1.5rem;
    }
    
    .sps-refinement-links {
        justify-content: center;
    }
    
    .sps-dynamic-page-title {
        font-size: 1.75rem;
    }
}

@media (max-width: 480px) {
    .sps-search-heading {
        font-size: 1.75rem;
    }
    
    .sps-search-input {
        font-size: 1rem;
        padding: 0.875rem 1.25rem;
    }
    
    .sps-search-button {
        font-size: 1rem;
    }
}

/* ==========================================================================
   Theme Compatibility
   ========================================================================== */

/* Hide static page titles when dynamic title is present */
.sps-search-results-wrapper + .entry-header,
.sps-search-results-wrapper ~ .entry-header {
    display: none !important;
}

body.page-template-default:has(.sps-search-results-wrapper) {
    /* Various theme selectors */
    .tg-page-header__title,
    .zakra-page-header__title,
    .page-header h1,
    .ast-single-post .entry-header .entry-title,
    .entry-title,
    .page-title,
    h1.entry-title {
        display: none !important;
    }
}

/* Box sizing for all search elements */
.sps-search-wrapper *,
.sps-search-form *,
.sps-search-suggestions *,
.sps-refinement-section *,
.sps-related-searches * {
    box-sizing: border-box;
}

/* Focus states for accessibility */
.sps-search-input:focus {
    outline: 2px solid #FB643C;
    outline-offset: -2px;
}

.sps-search-button:focus,
.sps-search-suggestion:focus,
.sps-refinement-links a:focus,
.sps-related-item a:focus {
    outline: 2px solid #FB643C;
    outline-offset: 2px;
}

/* Aggregate statistics - Modern card style */
.sps-aggregate-stats {
    background-color: white;
    border-left: 4px solid #FB643C;
    padding: 1.5rem 2rem;
    margin: 2rem 0;
    border-radius: 8px;
    box-shadow: 0 3px 15px rgba(0, 15, 65, 0.08);
    animation: fadeInUp 0.8s ease-out 0.3s backwards;
}

.sps-aggregate-stats p {
    margin: 0;
    font-size: 1.1rem;
    line-height: 1.6;
    color: #000F41;
}

.sps-aggregate-stats a {
    color: #FB643C;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.sps-aggregate-stats a:hover {
    color: #e5542f;
    text-decoration: underline;
}
