/**
 * Search Functionality Styles
 * For visitor search on home page and books page
 */

/* ============================================
   BOOKS PAGE SEARCH
   ============================================ */

.search-box {
    margin: 2rem auto 0;
    max-width: 800px;
}

.search-form {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.search-input-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 1.25rem;
    font-size: 1.25rem;
    opacity: 0.5;
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 1rem 3.5rem 1rem 3.5rem;
    font-size: 1rem;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: white;
    transition: all 0.3s ease;
    font-family: inherit;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.search-input::placeholder {
    color: var(--text-light);
}

.search-clear {
    position: absolute;
    right: 1rem;
    font-size: 1.25rem;
    color: var(--text-light);
    text-decoration: none;
    cursor: pointer;
    transition: color 0.3s ease;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.search-clear:hover {
    color: var(--primary);
    background: var(--background);
}

.search-btn {
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 500;
    color: white;
    background: var(--primary);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    font-family: inherit;
}

.search-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

/* Search Results Info */
.search-results-info {
    margin-top: 1.5rem;
    padding: 1rem 1.5rem;
    background: var(--background);
    border-radius: 8px;
    text-align: center;
}

.search-results-info p {
    margin: 0;
    color: var(--text);
    font-size: 1rem;
}

.search-results-info strong {
    color: var(--primary);
    font-weight: 600;
}

/* No Results Message */
.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
}

.no-results-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.no-results h3 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
    color: var(--text);
}

.no-results p {
    font-size: 1.125rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.no-results a {
    color: var(--primary);
    text-decoration: underline;
}

.no-results a:hover {
    text-decoration: none;
}

/* ============================================
   HOME PAGE HERO SEARCH
   ============================================ */

.hero-search {
    margin: 2rem 0;
    max-width: 650px;
}

.hero-search-form {
    width: 100%;
}

.hero-search-wrapper {
    position: relative;
    display: flex;
    align-items: stretch;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    transition: all 0.3s ease;
}

.hero-search-wrapper:focus-within {
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
    transform: translateY(-2px);
}

.hero-search-icon {
    position: absolute;
    left: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
    opacity: 0.4;
    pointer-events: none;
    z-index: 1;
}

.hero-search-input {
    flex: 1;
    padding: 1.25rem 1.5rem 1.25rem 4rem;
    font-size: 1.125rem;
    border: none;
    background: transparent;
    font-family: inherit;
}

.hero-search-input:focus {
    outline: none;
}

.hero-search-input::placeholder {
    color: var(--text-light);
}

.hero-search-btn {
    padding: 1.25rem 2.5rem;
    font-size: 1.125rem;
    font-weight: 600;
    color: white;
    background: var(--primary);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    font-family: inherit;
}

.hero-search-btn:hover {
    background: var(--primary-dark);
}

.hero-search-btn:active {
    transform: scale(0.98);
}

.hero-search-hint {
    margin-top: 0.75rem;
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
}

/* ============================================
   RTL SUPPORT
   ============================================ */

[lang="fa"] .search-input,
[lang="ar"] .search-input,
.rtl .search-input {
    direction: rtl;
    text-align: right;
    padding: 1rem 3.5rem 1rem 3.5rem;
}

[lang="fa"] .search-icon,
[lang="ar"] .search-icon,
.rtl .search-icon {
    left: auto;
    right: 1.25rem;
}

[lang="fa"] .search-clear,
[lang="ar"] .search-clear,
.rtl .search-clear {
    right: auto;
    left: 1rem;
}

[lang="fa"] .hero-search-input,
[lang="ar"] .hero-search-input,
.rtl .hero-search-input {
    direction: rtl;
    text-align: right;
    padding: 1.25rem 4rem 1.25rem 1.5rem;
}

[lang="fa"] .hero-search-icon,
[lang="ar"] .hero-search-icon,
.rtl .hero-search-icon {
    left: auto;
    right: 1.5rem;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .search-form {
        flex-direction: column;
    }
    
    .search-btn {
        width: 100%;
        padding: 1rem;
    }
    
    .search-input {
        font-size: 1rem;
    }
    
    .hero-search {
        margin: 1.5rem 0;
    }
    
    .hero-search-wrapper {
        flex-direction: column;
    }
    
    .hero-search-input {
        padding: 1rem 1rem 1rem 3.5rem;
        font-size: 1rem;
    }
    
    .hero-search-icon {
        left: 1rem;
        font-size: 1.25rem;
    }
    
    .hero-search-btn {
        width: 100%;
        padding: 1rem;
        font-size: 1rem;
    }
    
    .search-results-info {
        font-size: 0.9rem;
    }
    
    .no-results {
        padding: 2rem 1rem;
    }
    
    .no-results-icon {
        font-size: 3rem;
    }
    
    .no-results h3 {
        font-size: 1.5rem;
    }
    
    .no-results p {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .search-input {
        padding: 0.875rem 3rem 0.875rem 3rem;
        font-size: 0.9rem;
    }
    
    .search-input::placeholder {
        font-size: 0.85rem;
    }
    
    .hero-search-input::placeholder {
        font-size: 0.9rem;
    }
    
    .hero-search-hint {
        font-size: 0.75rem;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

.search-input:focus,
.hero-search-input:focus {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

.search-btn:focus,
.hero-search-btn:focus {
    outline: 3px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .search-input,
    .hero-search-input {
        border: 3px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .search-input,
    .search-btn,
    .hero-search-wrapper,
    .hero-search-btn {
        transition: none;
    }
}

