/* Book Search Plugin Styles - Brutalist Design */

/* Main container */
.book-search-wrapper {
    position: relative !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    direction: rtl !important;
    font-family: inherit !important;
}

.book-search-container {
    position: relative !important;
    z-index: 1000 !important;
}

/* Search form */
.book-search-form {
    position: relative;
    width: 100%;
}

/* Stock filter */
.book-search-filter {
    padding: 12px 16px !important;
    margin: 0 !important;
    border-bottom: 2px solid #000 !important;
    background: #f5f5f5 !important;
}

.book-search-checkbox {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    cursor: pointer !important;
    user-select: none !important;
}

.book-search-checkbox input[type="checkbox"] {
    width: 18px !important;
    height: 18px !important;
    cursor: pointer !important;
    border: 2px solid #000 !important;
    border-radius: 0 !important;
    margin: 0 !important;
    background: #fff !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    position: relative !important;
}

.book-search-checkbox input[type="checkbox"]:checked {
    background: #000 !important;
}

.book-search-checkbox input[type="checkbox"]:checked::after {
    content: '✓' !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    color: #fff !important;
    font-size: 14px !important;
    font-weight: bold !important;
}

.book-search-checkbox-label {
    font-size: 14px !important;
    color: #333 !important;
    font-family: inherit !important;
}

/* Input wrapper - DISABLED TO USE THEME STYLES */
/*
.book-search-input-wrapper {
    position: relative !important;
    width: 100% !important;
    height: 50px !important;
    background: #fff !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    transition: none !important;
}

.book-search-input-wrapper:focus-within {
    box-shadow: none !important;
}
*/

/* Input field - DISABLED TO USE THEME STYLES */
/*
.book-search-input {
    width: 100% !important;
    height: 50px !important;
    padding: 0 65px 0 20px !important;
    border: 1px solid #000 !important;
    border-radius: 0 !important;
    font-size: 16px !important;
    line-height: 50px !important;
    outline: none !important;
    transition: none !important;
    background: #fff !important;
    color: #333 !important;
    font-family: inherit !important;
}

.book-search-input:focus {
    border-color: #000 !important;
    box-shadow: none !important;
}

.book-search-input::placeholder {
    color: #666 !important;
    font-family: inherit !important;
    font-size: 16px !important;
}
*/

/* Submit button */
.book-search-submit {
    position: absolute !important;
    left: 8px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    background: #000 !important;
    border: none !important;
    border-radius: 0 !important;
    width: 38px !important;
    height: 38px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    color: #fff !important;
    padding: 0 !important;
}

.book-search-submit:hover {
    background: #333 !important;
    transform: translateY(-50%) !important;
}

.book-search-submit svg {
    width: 18px !important;
    height: 18px !important;
}

/* Close button */
.book-search-close {
    position: absolute !important;
    right: 8px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    background: #000 !important;
    border: none !important;
    padding: 0 !important;
    cursor: pointer !important;
    color: #fff !important;
    display: none !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
    border-radius: 0 !important;
    width: 38px !important;
    height: 38px !important;
    z-index: 10 !important;
}

.book-search-close:hover {
    background: #d32f2f !important;
}

.book-search-close svg {
    width: 20px !important;
    height: 20px !important;
}

/* Hide close button on desktop */
@media (min-width: 769px) {
    .book-search-close {
        display: none !important;
    }
}

/* Results dropdown */
.book-search-results {
    position: absolute !important;
    top: calc(100% + 8px) !important;
    left: 0 !important;
    right: 0 !important;
    background: #fff !important;
    border: 2px solid #000 !important; /* Made thicker to match theme */
    border-radius: 0 !important;
    box-shadow: 4px 4px 0 0 #000 !important; /* Brutalist shadow */
    max-height: 500px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    z-index: 99999 !important;
    visibility: hidden !important;
    opacity: 0 !important;
    transition: opacity 0.2s ease, visibility 0.2s ease !important;
    -webkit-overflow-scrolling: touch !important;
}

.book-search-results.show {
    visibility: visible !important;
    opacity: 1 !important;
    display: block !important;
}

/* Custom scrollbar */
.book-search-results::-webkit-scrollbar {
    width: 6px !important;
}

.book-search-results::-webkit-scrollbar-track {
    background: #f1f1f1 !important;
}

.book-search-results::-webkit-scrollbar-thumb {
    background: #000 !important;
    border-radius: 0 !important;
}

.book-search-results::-webkit-scrollbar-thumb:hover {
    background: #333 !important;
}

/* Results inner container */
.book-search-results-inner {
    padding: 0 !important;
}

/* Results title */
.book-search-results-title {
    font-size: 16px !important;
    font-weight: 700 !important;
    color: #000 !important;
    margin: 12px 0 12px 0 !important;
    padding: 0 0 8px 0 !important;
    border-bottom: 2px solid #000 !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
}

/* First title should have no top margin */
.book-search-results-title:first-child {
    margin-top: 0 !important;
}

/* Margin for title when it's not the first child */
.book-search-results-title {
    margin-top: 25px !important;
}

.book-search-title-icon {
    width: 18px !important;
    height: 18px !important;
    flex-shrink: 0 !important;
}

/* Product section */
.book-search-products-section {
    margin-bottom: 20px !important;
    padding: 16px !important;
}

.book-search-products-list {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Product item */
.book-search-product-item {
    display: flex !important;
    gap: 12px !important;
    padding: 12px !important;
    text-decoration: none !important;
    color: #333 !important;
    border-bottom: 1px solid #e0e0e0 !important;
    transition: all 0.2s ease !important;
    border-left: 3px solid transparent !important;
}

.book-search-product-item:hover {
    background: #f9f9f9 !important;
    border-left: 3px solid #000 !important;
    padding-left: 13px !important;
}

.book-search-product-item:last-child {
    border-bottom: none !important;
}

.book-search-product-image {
    width: 70px !important;
    height: 90px !important;
    flex-shrink: 0 !important;
    overflow: hidden !important;
    background: #f5f5f5 !important;
    border-radius: 0 !important;
    border: 1px solid #000 !important;
}

.book-search-product-image img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

.book-search-product-info {
    flex: 1 !important;
    min-width: 0 !important;
}

.book-search-product-title {
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #000 !important;
    margin: 0 0 6px 0 !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
}

.book-search-product-meta {
    font-size: 12px !important;
    color: #666 !important;
    margin-bottom: 6px !important;
}

.book-search-product-meta span {
    display: block !important;
    margin-bottom: 2px !important;
}

.book-search-product-price {
    font-weight: 600 !important;
    color: #000 !important;
    font-size: 14px !important;
}

/* Attribute section */
.book-search-attributes-section {
    margin-bottom: 20px !important;
    padding: 0 16px 16px 16px !important;
}

/* Attribute item */
.book-search-attribute-item {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 12px !important;
    text-decoration: none !important;
    color: #333 !important;
    border-bottom: 1px solid #f0f0f0 !important;
    transition: background 0.2s ease !important;
}

.book-search-attribute-item:hover {
    background: #f9f9f9 !important;
    border-left: 3px solid #000 !important;
    padding-left: 9px !important;
}

.book-search-attribute-icon {
    width: 40px !important;
    height: 40px !important;
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #f0f0f0 !important;
    border-radius: 0 !important;
    border: 1px solid #000 !important;
    font-size: 18px !important;
}

.book-search-attribute-info {
    flex: 1 !important;
}

.book-search-attribute-name {
    font-weight: 600 !important;
    color: #000 !important;
    margin-bottom: 4px !important;
}

.book-search-attribute-type {
    font-size: 12px !important;
    color: #666 !important;
}

.book-search-attribute-count {
    font-size: 12px !important;
    color: #666 !important;
    white-space: nowrap !important;
}

/* Exact match highlight */
.book-search-attribute-item.is-exact-match {
    background: #ffeb3b !important;
    border: 2px solid #000 !important;
    font-weight: 600 !important;
}

/* Recent & Popular searches */
.book-search-initial {
    padding: 16px !important;
}

.book-search-recent,
.book-search-popular {
    margin-bottom: 20px !important;
}

.book-search-recent:empty,
.book-search-popular:empty {
    display: none !important;
}

.book-search-recent-list,
.book-search-popular-list {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
}

.book-search-recent-list:empty,
.book-search-popular-list:empty {
    display: none !important;
}

.book-search-recent:has(.book-search-recent-list:empty),
.book-search-popular:has(.book-search-popular-list:empty) {
    display: none !important;
}

.book-search-recent-item,
.book-search-popular-item {
    display: inline-block !important;
    padding: 8px 16px !important;
    background: #fff !important;
    color: #000 !important;
    text-decoration: none !important;
    border-radius: 0 !important;
    font-size: 13px !important;
    transition: all 0.2s ease !important;
    white-space: nowrap !important;
    border: 2px solid #000 !important;
    cursor: pointer !important;
}

.book-search-recent-item:hover,
.book-search-popular-item:hover {
    background: #000 !important;
    color: #fff !important;
    box-shadow: 4px 4px 0px rgba(0, 0, 0, 1) !important;
}

/* View all link - Hidden */
.book-search-view-all {
    display: none !important;
}

/* Load more button */
.book-search-load-more {
    text-align: center !important;
    padding: 15px 0 10px 0 !important;
    margin-top: 10px !important;
    border-top: 1px solid #e5e5e5 !important;
}

.book-search-load-more-btn {
    display: inline-block !important;
    padding: 10px 24px !important;
    background: #000 !important;
    color: #fff !important;
    border: none !important;
    border-radius: 0 !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: background 0.2s ease !important;
    font-family: inherit !important;
}

.book-search-load-more-btn:hover {
    background: #333 !important;
}

.book-search-load-more-btn:disabled {
    background: #ccc !important;
    cursor: not-allowed !important;
}

/* Loading state */
.book-search-loading {
    text-align: center !important;
    padding: 40px 20px !important;
    margin: 0 16px !important;
    color: #666 !important;
}

.book-search-spinner {
    width: 40px !important;
    height: 40px !important;
    margin: 0 auto 16px !important;
    border: 3px solid #f3f3f3 !important;
    border-top: 3px solid #000 !important;
    border-radius: 0 !important;
    animation: spin 1s linear infinite !important;
}

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

/* No results */
.book-search-no-results {
    text-align: center !important;
    padding: 40px 20px !important;
    margin: 0 16px !important;
    color: #666 !important;
    font-size: 14px !important;
}

/* Overlay */
.book-search-overlay {
    display: none !important;
}

/* Mobile responsive */
@media (max-width: 768px) {
    /* ... keep mobile styles mostly intact but remove input overrides ... */
    
    .book-search-wrapper {
        max-width: 100% !important;
        width: 100% !important;
    }
    
    /* Input wrapper overrides for mobile full screen mode */
    /* Only apply when active */
    .book-search-wrapper.active .book-search-input-wrapper {
        height: 50px !important;
        border-radius: 0 !important;
        background: #fff !important; /* Restore bg for mobile fullscreen */
        border: 2px solid #000 !important; /* Restore border for mobile fullscreen */
    }
    
    .book-search-wrapper.active .book-search-input {
        padding: 0 55px 0 15px !important;
        font-size: 16px !important;
        height: 100% !important;
        line-height: normal !important;
    }
    
    .book-search-wrapper.active {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        max-width: 100vw !important;
        width: 100vw !important;
        height: 100vh !important;
        z-index: 999999 !important;
        background: #fff !important;
        padding: 10px !important;
        overflow: hidden !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        display: flex !important;
        flex-direction: column !important;
    }
    
    /* ... rest of mobile styles ... */
    .book-search-wrapper.active .book-search-container {
        height: 100% !important;
        max-height: 100% !important;
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        box-sizing: border-box !important;
        flex: 1 !important;
        overflow: hidden !important;
    }
    
    .book-search-wrapper.active .book-search-input-wrapper {
        flex-shrink: 0 !important;
        margin-bottom: 10px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    .book-search-wrapper.active .book-search-results {
        position: static !important;
        flex: 1 1 auto !important;
        max-height: none !important;
        min-height: 0 !important;
        height: 100% !important;
        width: 100% !important;
        border: 1px solid #000 !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        background: #f9f9f9 !important;
        overflow-y: scroll !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        box-sizing: border-box !important;
        touch-action: pan-y !important;
        overscroll-behavior: contain !important;
    }
    
    .book-search-wrapper.active .book-search-results.show {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
    }
    
    /* Fix scrolling to bottom */
    .book-search-wrapper.active .book-search-results-inner {
        padding-bottom: 30px !important;
        min-height: 100% !important;
        touch-action: inherit !important;
        pointer-events: auto !important;
    }
    
    /* Prevent body scroll on mobile */
    body.book-search-active {
        overflow: hidden !important;
        position: fixed !important;
        width: 100% !important;
        height: 100vh !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
    }
    
    /* Allow touch in search results */
    .book-search-wrapper.active .book-search-results {
        touch-action: pan-y !important;
    }
    
    /* Padding adjustments */
    .book-search-results-inner {
        padding: 0 !important;
    }
    
    .book-search-products-section {
        padding: 12px !important;
    }
    
    .book-search-attributes-section {
        padding: 0 12px 12px 12px !important;
    }
    
    .book-search-initial {
        padding: 12px !important;
    }
    
    .book-search-filter {
        padding: 10px 12px !important;
    }
    
    .book-search-product-item {
        padding: 10px !important;
        margin-bottom: 8px !important;
        touch-action: manipulation !important;
        -webkit-tap-highlight-color: rgba(0,0,0,0.1) !important;
    }
    
    .book-search-attribute-item {
        padding: 10px 12px !important;
        margin-bottom: 8px !important;
    }
    
    .book-search-recent-list a,
    .book-search-popular-list a {
        padding: 8px 14px !important;
        font-size: 12px !important;
    }
    
    .book-search-results-title {
        font-size: 15px !important;
        margin-bottom: 10px !important;
    }
    
    .book-search-product-image {
        width: 60px !important;
        height: 80px !important;
    }
    
    .book-search-product-title {
        font-size: 13px !important;
    }
    
    .book-search-product-meta {
        font-size: 11px !important;
    }
    
    .book-search-product-price {
        font-size: 13px !important;
    }
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1024px) {
    .book-search-wrapper {
        padding: 0 20px !important;
    }
    
    .book-search-results {
        max-height: 450px !important;
    }
}
