/**
 * Search Plus WP - Frontend Styles
 * Modern 2025 Minimal Design
 */

/* ========================================
   Search Field Styles - Minimal Design
   ======================================== */

.spwp-search-container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

.spwp-search-field {
	width: 100%;
    padding: 14px 20px;
    font-size: 16px;
    color: #111;
    background-color: #f6f6f6;
    border: 2px solid #EEEEEE;
    outline: none;
    transition: border-color 0.2s ease;
    box-shadow: none;
}

.spwp-search-field:focus {
    border-color: #bdbdbd;
    box-shadow: none; 
}

.spwp-search-field::placeholder {
    color: #999999;
    opacity: 1;
}

.spwp-search-field:hover {
    border-color: #bdbdbd;
}

/* ========================================
   Results Container - Modern 2025 Design
   ======================================== */

.spwp-results-container {
    width: 100%;
    max-width: 600px;
    margin: 12px auto 0;
    background-color: #ffffff;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    overflow: hidden;
    display: none; 
}

.spwp-results-container.spwp-has-results {
    display: block;
}

.spwp-results-wrapper {
    max-height: 500px;
    overflow-y: auto;
    padding: 8px 0;
}

/* Custom scrollbar for modern look */
.spwp-results-wrapper::-webkit-scrollbar {
    width: 6px;
}

.spwp-results-wrapper::-webkit-scrollbar-track {
    background: #f5f5f5;
}

.spwp-results-wrapper::-webkit-scrollbar-thumb {
    background: #d0d0d0;
    border-radius: 3px;
}

.spwp-results-wrapper::-webkit-scrollbar-thumb:hover {
    background: #b0b0b0;
}

/* ========================================
   Results Grouping and Headers
   ======================================== */

.spwp-result-group {
    margin-bottom: 4px;
}

.spwp-result-group:last-child {
    margin-bottom: 0;
}

.spwp-group-header {
    padding: 12px 20px 8px;
    font-size: 13px;
    font-weight: 600;
    color: #666666;
    text-transform: none;
    letter-spacing: 0;
    background-color: #fafafa;
    border-bottom: 1px solid #f0f0f0;
}

/* ========================================
   Individual Result Items
   ======================================== */

.spwp-result-item {
    padding: 12px 20px;
    border-bottom: 1px solid #f5f5f5;
    transition: background-color 0.15s ease;
}

.spwp-result-item:last-child {
    border-bottom: none;
}

.spwp-result-item:hover {
    background-color: #f9f9f9;
}

.spwp-result-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.spwp-result-title {
    font-size: 15px;
    font-weight: 500;
    color: #1a1a1a;
    margin: 0 0 4px 0;
    line-height: 1.4;
}

.spwp-result-price {
    font-size: 14px;
    font-weight: 600;
    color: #FF4D4D;
    margin: 4px 0 0 0;
}

/* ========================================
   "View More" Button
   ======================================== */

.spwp-view-more {
    display: block;
    width: 100%;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    color: #FF4D4D;
    background-color: #f8f9fa;
    border: none;
    border-top: 1px solid #f0f0f0;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.spwp-view-more:hover {
    background-color: #f0f2f5;
    color: #FF4D4D;
}

.spwp-view-more:active {
    background-color: #e8eaed;
}

/* ========================================
   Empty State and Messages
   ======================================== */

.spwp-no-results {
    padding: 32px 20px;
    text-align: center;
    color: #999999;
    font-size: 14px;
}

.spwp-loading {
    padding: 32px 20px;
    text-align: center;
    color: #999999;
    font-size: 14px;
}

.spwp-error {
    padding: 16px 20px;
    background-color: #fff5f5;
    color: #d32f2f;
    font-size: 14px;
    border-radius: 8px;
    margin: 12px 0;
}

/* ========================================
   Responsive Design - Mobile
   ======================================== */

@media screen and (max-width: 768px) {
    .spwp-search-container {
        max-width: 100%;
        padding: 0 16px;
    }

    .spwp-results-container {
        max-width: 100%;
        margin-left: 16px;
        margin-right: 16px;
        border-radius: 10px;
    }

    .spwp-search-field {
        padding: 12px 16px;
        font-size: 16px; /* Prevent zoom on iOS */
    }

    .spwp-results-wrapper {
        max-height: 400px;
    }

    .spwp-group-header {
        padding: 10px 16px 6px;
        font-size: 12px;
    }

    .spwp-result-item {
        padding: 10px 16px;
    }

    .spwp-result-title {
        font-size: 14px;
    }

    .spwp-result-price {
        font-size: 13px;
    }

    .spwp-view-more {
        padding: 10px 16px;
        font-size: 13px;
    }
}

@media screen and (max-width: 480px) {
    .spwp-search-container {
        padding: 0 12px;
    }

    .spwp-results-container {
        margin-left: 12px;
        margin-right: 12px;
        border-radius: 8px;
    }

    .spwp-search-field {
        padding: 10px 14px;
    }

    .spwp-results-wrapper {
        max-height: 350px;
    }

    .spwp-group-header {
        padding: 8px 14px 6px;
    }

    .spwp-result-item {
        padding: 8px 14px;
    }
}

/* ========================================
   RTL Support for Persian/Arabic
   ======================================== */

[dir="rtl"] .spwp-search-field,
[dir="rtl"] .spwp-results-container,
[dir="rtl"] .spwp-group-header,
[dir="rtl"] .spwp-result-item {
    text-align: right;
    direction: rtl;
}

/* ========================================
   Accessibility
   ======================================== */

.spwp-search-field:focus-visible {
    outline: 2px solid #dbdbdb;
    outline-offset: 2px;
}

.spwp-result-link:focus-visible {
    outline: 2px solid #dbdbdb;
    outline-offset: -2px;
}

.spwp-view-more:focus-visible {
    outline: 2px solid #dbdbdb;
    outline-offset: -2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .spwp-search-field,
    .spwp-result-item,
    .spwp-view-more {
        transition: none;
    }
}
