/* Book Search Plugin Styles */

/* Main container */
.book-search-wrapper {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    direction: rtl;
}

.book-search-container {
    position: relative;
    z-index: 1000;
}

/* Search form */
.book-search-form {
    position: relative;
    width: 100%;
}

.book-search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.book-search-input-wrapper:focus-within {
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.book-search-input {
    flex: 1;
    padding: 12px 45px 12px 15px;
    border: none;
    background: transparent;
    font-size: 16px;
    outline: none;
}

.book-search-submit {
    position: absolute;
    left: 10px;
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
}

.book-search-submit:hover {
    color: #0073aa;
}

.book-search-submit svg {
    width: 20px;
    height: 20px;
}

.book-search-close {
    position: absolute;
    right: 10px;
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #666;
    display: none;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
}

.book-search-close:hover {
    color: #dc3232;
}

.book-search-close svg {
    width: 18px;
    height: 18px;
}

.book-search-wrapper.active .book-search-close {
    display: flex;
}

/* Results dropdown */
.book-search-results {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    max-height: 500px;
    overflow-y: auto;
    z-index: 999;
}

.book-search-results-inner {
    padding: 15px;
}

.book-search-results-title {
    margin: 0 0 10px 0;
    padding: 0;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Initial state (recent & popular searches) */
.book-search-initial {
    display: block;
}

.book-search-recent,
.book-search-popular {
    margin-bottom: 20px;
}

.book-search-recent:last-child,
.book-search-popular:last-child {
    margin-bottom: 0;
}

.book-search-recent-list,
.book-search-popular-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.book-search-recent-list li,
.book-search-popular-list li {
    margin: 0;
    padding: 0;
}

.book-search-recent-list a,
.book-search-popular-list a {
    display: flex;
    align-items: center;
    padding: 10px;
    color: #333;
    text-decoration: none;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.book-search-recent-list a:hover,
.book-search-popular-list a:hover {
    background: #f5f5f5;
}

.book-search-recent-list a::before {
    content: "🕒";
    margin-left: 8px;
    font-size: 16px;
}

.book-search-popular-list a::before {
    content: "🔥";
    margin-left: 8px;
    font-size: 16px;
}

/* Attributes section */
.book-search-attributes-section {
    margin-bottom: 20px;
}

.book-search-attribute-item {
    display: flex;
    align-items: center;
    padding: 12px;
    margin-bottom: 8px;
    background: #f9f9f9;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    text-decoration: none;
    color: #333;
    transition: all 0.2s ease;
}

.book-search-attribute-item:hover {
    background: #0073aa;
    border-color: #0073aa;
    color: #fff;
    transform: translateX(-3px);
}

.book-search-attribute-icon {
    width: 40px;
    height: 40px;
    margin-left: 12px;
    background: #0073aa;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 18px;
    flex-shrink: 0;
}

.book-search-attribute-item:hover .book-search-attribute-icon {
    background: #fff;
    color: #0073aa;
}

.book-search-attribute-info {
    flex: 1;
}

.book-search-attribute-name {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 3px;
}

.book-search-attribute-type {
    font-size: 12px;
    color: #666;
}

.book-search-attribute-item:hover .book-search-attribute-type {
    color: rgba(255, 255, 255, 0.8);
}

.book-search-attribute-count {
    font-size: 12px;
    padding: 4px 8px;
    background: #fff;
    border-radius: 12px;
    color: #666;
}

/* Products section */
.book-search-products-section {
    margin-bottom: 10px;
}

.book-search-products-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.book-search-product-item {
    display: flex;
    align-items: flex-start;
    padding: 12px;
    margin-bottom: 8px;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    text-decoration: none;
    color: #333;
    transition: all 0.2s ease;
}

.book-search-product-item:hover {
    border-color: #0073aa;
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.1);
}

.book-search-product-image {
    width: 60px;
    height: 80px;
    margin-left: 12px;
    overflow: hidden;
    border-radius: 4px;
    background: #f5f5f5;
    flex-shrink: 0;
}

.book-search-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.book-search-product-info {
    flex: 1;
    min-width: 0;
}

.book-search-product-title {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 5px;
    color: #333;
    line-height: 1.4;
}

.book-search-product-meta {
    font-size: 13px;
    color: #666;
    margin-bottom: 5px;
    line-height: 1.5;
}

.book-search-product-meta span {
    display: block;
}

.book-search-product-price {
    font-weight: 600;
    color: #0073aa;
}

/* View all link */
.book-search-view-all {
    text-align: center;
    padding: 10px 0 0 0;
    border-top: 1px solid #e5e5e5;
}

.book-search-view-all-link {
    display: inline-block;
    padding: 10px 20px;
    background: #0073aa;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 600;
    transition: background 0.3s ease;
}

.book-search-view-all-link:hover {
    background: #005a87;
}

/* Loading state */
.book-search-loading {
    text-align: center;
    padding: 30px;
}

.book-search-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 15px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* No results */
.book-search-no-results {
    text-align: center;
    padding: 30px;
    color: #666;
}

/* Overlay */
.book-search-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
}

.book-search-wrapper.active .book-search-overlay {
    display: block;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .book-search-wrapper.active {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        max-width: none;
        z-index: 9999;
        background: #fff;
        padding: 15px;
    }
    
    .book-search-wrapper.active .book-search-container {
        height: 100%;
        display: flex;
        flex-direction: column;
    }
    
    .book-search-wrapper.active .book-search-results {
        position: static;
        flex: 1;
        max-height: none;
        border: none;
        box-shadow: none;
        margin-top: 15px;
        overflow-y: auto;
    }
    
    .book-search-close {
        display: flex !important;
    }
}

/* RTL Support */
[dir="rtl"] .book-search-submit {
    left: auto;
    right: 10px;
}

[dir="rtl"] .book-search-close {
    right: auto;
    left: 10px;
}

[dir="rtl"] .book-search-input {
    padding: 12px 15px 12px 45px;
}

/* Empty state */
.book-search-recent-list:empty::after,
.book-search-popular-list:empty::after {
    content: "موردی یافت نشد";
    display: block;
    padding: 10px;
    color: #999;
    font-size: 14px;
    text-align: center;
}

/* Highlight search term */
.book-search-highlight {
    background: #fff3cd;
    padding: 0 2px;
    border-radius: 2px;
}

