/**
 * Alynt Enhanced Search - Frontend Styles
 * Minimalistic, mobile-responsive design with accessibility focus
 */

/* Reset and base styles */
.alynt-es-search-page * {
    box-sizing: border-box;
}

.alynt-es-search-page {
    font-family: inherit;
    color: #000000;
    line-height: 1.6;
}

.alynt-es-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 4rem 1rem;
}

/* Main header styling */
.alynt-es-header {
    text-align: center;
    margin-bottom: 2rem;
}

.alynt-es-main-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #000000;
    margin: 0;
    line-height: 1.2;
}

/* Shortcode styles */
.alynt-es-shortcode-wrapper {
    display: inline-flex;
    align-items: center;
    height: 100%;
}

.alynt-es-search-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border: 1px solid #000000;
    background: transparent;
    color: #000000;
    text-decoration: none;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.alynt-es-search-button:hover,
.alynt-es-search-button:focus {
    background: #000000;
    color: #ffffff;
    outline: 2px solid #000000;
    outline-offset: 2px;
}

.alynt-es-search-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border: 1px solid #000000;
    background: transparent;
    color: #000000;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.alynt-es-search-icon:hover,
.alynt-es-search-icon:focus {
    background: #000000;
    color: #ffffff;
    outline: 2px solid #000000;
    outline-offset: 2px;
}

.alynt-es-search-icon svg {
    width: 24px;
    height: 24px;
}

/* Header integration styles for Blocksy theme */
.ct-header [data-id="widget-area-1"] {
    display: flex;
    align-items: center;
    height: 100%;
}

.ct-header [data-id="widget-area-1"] .ct-widget {
    display: flex;
    align-items: center;
    height: 100%;
    margin: 0;
}

.ct-header [data-id="widget-area-1"] .widget_block {
    display: flex;
    align-items: center;
    height: 100%;
}

.ct-header [data-id="widget-area-1"] p {
    margin: 0;
    display: flex;
    align-items: center;
}

.ct-header .alynt-es-shortcode-wrapper {
    display: flex;
    align-items: center;
    height: 100%;
}

.ct-header .alynt-es-search-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border: none;
    background: transparent;
    color: currentColor;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    height: auto;
    min-height: 40px;
}

.ct-header .alynt-es-search-icon:hover,
.ct-header .alynt-es-search-icon:focus {
    background: rgba(0, 0, 0, 0.1);
    color: currentColor;
    outline: none;
    border-radius: 4px;
}

.ct-header .alynt-es-search-icon svg {
    width: 32px;
    height: 32px;
}

/* Toggle pills for WooCommerce */
.alynt-es-toggle-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.alynt-es-toggle-pills {
    display: flex;
    border: 1px solid #000000;
    border-radius: 50px;
    overflow: hidden;
    background: transparent;
    min-width: 300px;
}

.alynt-es-toggle-pill {
    flex: 1;
    padding: 0.75rem;
    border: none;
    background: transparent;
    color: #000000;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    text-align: center;
}

.alynt-es-toggle-pill:first-child {
    border-right: 1px solid #000000;
}

.alynt-es-toggle-pill.active {
    background: #000000;
    color: #ffffff;
}

.alynt-es-toggle-pill.active[data-type="products"]:focus {
    border-bottom-left-radius: 25px;
    border-top-left-radius: 25px;
}

.alynt-es-toggle-pill.active[data-type="general"]:focus {
    border-bottom-right-radius: 25px;
    border-top-right-radius: 25px;
}

.alynt-es-toggle-pill:hover:not(.active),
.alynt-es-toggle-pill:focus:not(.active) {
    background: rgba(0, 0, 0, 0.1);
    outline: none;
}

.alynt-es-toggle-pill:focus {
    outline: 2px solid #000000;
    outline-offset: -2px;
}

/* Search form */
.alynt-es-search-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 4rem;
}

.alynt-es-search-form {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 600px;
    border: 2px solid #000000;
    border-radius: 50px;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    overflow: hidden;
}

.alynt-es-search-form:focus-within {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

input.alynt-es-search-input {
    flex: 1;
    padding: 1.25rem 1.5rem;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 1.1rem;
    color: #000000;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border-radius: 0;
}

.alynt-es-search-input::placeholder {
    color: rgba(0, 0, 0, 0.5);
    font-weight: 400;
}

/* Fix browser autocomplete styling */
.alynt-es-search-input:-webkit-autofill,
.alynt-es-search-input:-webkit-autofill:hover,
.alynt-es-search-input:-webkit-autofill:focus,
.alynt-es-search-input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px #ffffff inset !important;
    -webkit-text-fill-color: #000000 !important;
    background-color: transparent !important;
    background-image: none !important;
}

.alynt-es-search-submit {
    padding: 1.25rem 1.5rem;
    border: none;
    background: #000000;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0 50px 50px 0;
    min-width: 60px;
}

.alynt-es-search-submit:hover,
.alynt-es-search-submit:focus {
    background: #333333;
    transform: scale(1.05);
    outline: none;
}

.alynt-es-search-submit svg {
    width: 22px;
    height: 22px;
    transition: transform 0.2s ease;
}

.alynt-es-search-submit:hover svg {
    transform: scale(1.1);
}

/* Loading indicator */
.alynt-es-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    margin-bottom: 2rem;
}

.alynt-es-spinner {
    width: 40px;
    height: 40px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-left: 2px solid #000000;
    border-radius: 50%;
    animation: alynt-es-spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

.screen-reader-text {
    position: absolute !important;
    clip: rect(1px, 1px, 1px, 1px);
    width: 1px !important;
    height: 1px !important;
    overflow: hidden;
}

/* Results grid */
.alynt-es-results {
    margin-bottom: 2rem;
}

.alynt-es-results-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* Dynamic column classes */
.alynt-es-results[data-columns="1"] .alynt-es-results-grid {
    grid-template-columns: 1fr;
}

.alynt-es-results[data-columns="2"] .alynt-es-results-grid {
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
}

.alynt-es-results[data-columns="3"] .alynt-es-results-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.alynt-es-results[data-columns="4"] .alynt-es-results-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.alynt-es-results[data-columns="5"] .alynt-es-results-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

/* Result cards */
.alynt-es-result-card {
    display: block;
    border: 1px solid #000000;
    background: #ffffff;
    text-decoration: none;
    color: #000000;
    transition: all 0.2s ease;
    overflow: hidden;
}

.alynt-es-result-card:hover,
.alynt-es-result-card:focus {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    outline: 2px solid #000000;
    outline-offset: 2px;
}

.alynt-es-card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    border-bottom: 1px solid #000000;
}

.alynt-es-card-image.product-image {
    height: 300px;
}

.alynt-es-card-content {
    padding: 1rem .75rem;
}

.alynt-es-card-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.alynt-es-card-category {
    padding: 0.25rem 0.5rem;
    border: 1px solid #000000;
    border-radius: 12px;
    background: transparent;
    font-size: 0.75rem;
    color: #000000;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.alynt-es-card-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0 0 1.25rem 0;
    line-height: 1.4;
    color: #000000;
}

.alynt-es-card-excerpt-container {
    padding: 6px;
    border-radius: 8px;
}

.alynt-es-card-excerpt {
    font-size: 0.875rem;
    line-height: 1.5;
    color: rgba(0, 0, 0, 0.8);
    margin: 0;
}

/* Search term highlighting */
.alynt-es-highlight {
    background-color: #ffeb3b;
    color: #000000;
    padding: 0.1em 0.2em;
    border-radius: 2px;
    font-weight: 600;
}

/* No results message */
.alynt-es-no-results {
    text-align: center;
    padding: 3rem 1rem;
    color: rgba(0, 0, 0, 0.6);
}

.alynt-es-no-query {
    text-align: center;
    padding: 3rem 1rem;
    color: rgba(0, 0, 0, 0.6);
}

/* Pagination */
.alynt-es-pagination-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
}

.alynt-es-pagination {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.alynt-es-pagination-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0.5rem;
    border: 1px solid #000000;
    background: transparent;
    color: #000000;
    text-decoration: none;
    font-family: inherit;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.alynt-es-pagination-item:hover,
.alynt-es-pagination-item:focus {
    background: #000000;
    color: #ffffff;
    outline: 2px solid #000000;
    outline-offset: 2px;
}

.alynt-es-pagination-item.current {
    background: #000000;
    color: #ffffff;
}

.alynt-es-pagination-item.ellipsis {
    border: none;
    background: transparent;
    cursor: default;
    pointer-events: none;
}

.alynt-es-pagination-item.ellipsis:hover {
    background: transparent;
    color: #000000;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .alynt-es-container {
        padding: 2rem 0.75rem;
    }
    
    .alynt-es-main-title {
        font-size: 2rem;
    }
    
    .alynt-es-toggle-pill {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
    }
    
    .alynt-es-search-wrapper {
        margin-bottom: 3rem;
    }
    
    .alynt-es-search-input {
        padding: 1rem 1.25rem;
        font-size: 1rem;
    }
    
    .alynt-es-search-submit {
        padding: 1rem 1.25rem;
        min-width: 50px;
    }
    
    .alynt-es-search-submit svg {
        width: 20px;
        height: 20px;
    }
    
    .alynt-es-results-grid {
        gap: 1rem;
        grid-template-columns: 1fr;
    }
    
    .alynt-es-results[data-columns="2"] .alynt-es-results-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .alynt-es-results[data-columns="3"] .alynt-es-results-grid,
    .alynt-es-results[data-columns="4"] .alynt-es-results-grid,
    .alynt-es-results[data-columns="5"] .alynt-es-results-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .alynt-es-card-content {
        padding: 0.75rem;
    }
    
    .alynt-es-card-title {
        font-size: 1rem;
    }
    
    .alynt-es-pagination {
        gap: 0.25rem;
    }
    
    .alynt-es-pagination-item {
        min-width: 36px;
        height: 36px;
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .alynt-es-container {
        padding: 2rem 0.5rem;
    }
    
    .alynt-es-main-title {
        font-size: 1.75rem;
    }
    
    .alynt-es-toggle-pills {
        width: 100%;
    }
    
    .alynt-es-toggle-pill {
        flex: 1;
        text-align: center;
    }
    
    .alynt-es-search-form {
        max-width: 100%;
    }
    
    .alynt-es-results-grid {
        grid-template-columns: 1fr;
    }
    
    .alynt-es-card-image {
        height: 180px;
    }
    
    .alynt-es-card-image.product-image {
        height: 250px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .alynt-es-search-page {
        color: #000000;
    }
    
    .alynt-es-result-card:hover,
    .alynt-es-result-card:focus {
        outline: 3px solid #000000;
    }
    
    .alynt-es-toggle-pill:focus,
    .alynt-es-search-submit:focus,
    .alynt-es-search-button:focus,
    .alynt-es-search-icon:focus {
        outline: 3px solid #000000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .alynt-es-result-card,
    .alynt-es-toggle-pill,
    .alynt-es-search-submit,
    .alynt-es-search-button,
    .alynt-es-search-icon,
    .alynt-es-pagination-item {
        transition: none;
    }
    
    .alynt-es-result-card:hover,
    .alynt-es-result-card:focus {
        transform: none;
    }
    
    .alynt-es-spinner {
        animation: none;
        border: 2px solid #000000;
    }
}
