/**
 * RIYLBooks Frontend Styles
 */

/* Search Widget Styles */
.riyl-search-widget {
    position: relative;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

.riyl-search-form {
    position: relative;
    margin-bottom: 15px;
}

.riyl-search-input {
    width: 100%;
    padding: 12px 45px 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 16px;
    line-height: 1.4;
    transition: all 0.3s ease;
    background: white;
    box-sizing: border-box;
}

.riyl-search-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.riyl-search-button {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.2s;
}

.riyl-search-button:hover {
    color: #374151;
}

/* Results Container */
.riyl-results-container {
    position: relative;
    z-index: 1000;
}

.riyl-results {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    max-height: 400px;
    overflow-y: auto;
}

/* Book Items */
.riyl-book-item {
    padding: 16px;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    transition: background-color 0.2s;
}

.riyl-book-item:hover {
    background-color: #f9fafb;
}

.riyl-book-item:last-child {
    border-bottom: none;
}

.riyl-book-image {
    width: 60px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.riyl-book-placeholder {
    width: 60px;
    height: 80px;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-size: 24px;
    flex-shrink: 0;
}

.riyl-book-details {
    flex: 1;
    min-width: 0;
}

.riyl-book-title {
    font-weight: 600;
    font-size: 15px;
    line-height: 1.4;
    margin-bottom: 6px;
    color: #111827;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.riyl-book-author {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 8px;
    font-style: italic;
}

.riyl-book-price {
    font-weight: 700;
    font-size: 16px;
    color: #059669;
}

/* Loading and No Results */
.riyl-loading {
    padding: 24px;
    text-align: center;
    color: #6b7280;
    font-style: italic;
}

.riyl-no-results {
    padding: 24px;
    text-align: center;
    color: #6b7280;
    font-size: 14px;
}

/* Similar Books Styles */
.riyl-similar-books {
    margin: 32px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

.riyl-similar-books h3 {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 20px;
    border-bottom: 2px solid #f3f4f6;
    padding-bottom: 8px;
}

.riyl-similar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.riyl-similar-item {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

.riyl-similar-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: #d1d5db;
}

.riyl-similar-image {
    width: 80px;
    height: 110px;
    object-fit: cover;
    border-radius: 8px;
    margin: 0 auto 12px;
    display: block;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.riyl-similar-placeholder {
    width: 80px;
    height: 110px;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-size: 32px;
    margin: 0 auto 12px;
}

.riyl-similar-details {
    text-align: center;
}

.riyl-similar-title {
    font-weight: 600;
    font-size: 14px;
    line-height: 1.3;
    color: #111827;
    margin-bottom: 6px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    min-height: 2.6em;
}

.riyl-similar-author {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 8px;
    font-style: italic;
}

.riyl-similar-price {
    font-weight: 700;
    font-size: 15px;
    color: #059669;
    margin: 0;
}

/* Responsive Design */
@media (max-width: 640px) {
    .riyl-similar-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    
    .riyl-book-image {
        width: 50px;
        height: 70px;
    }
    
    .riyl-book-placeholder {
        width: 50px;
        height: 70px;
        font-size: 20px;
    }
    
    .riyl-similar-image {
        width: 60px;
        height: 85px;
    }
    
    .riyl-similar-placeholder {
        width: 60px;
        height: 85px;
        font-size: 24px;
    }
    
    .riyl-similar-title {
        font-size: 13px;
    }
    
    .riyl-similar-author {
        font-size: 11px;
    }
    
    .riyl-similar-price {
        font-size: 14px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .riyl-search-input {
        background: #1f2937;
        border-color: #374151;
        color: #f9fafb;
    }
    
    .riyl-search-input:focus {
        border-color: #60a5fa;
        box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
    }
    
    .riyl-results {
        background: #1f2937;
        border-color: #374151;
    }
    
    .riyl-book-item {
        border-bottom-color: #374151;
    }
    
    .riyl-book-item:hover {
        background-color: #374151;
    }
    
    .riyl-book-title {
        color: #f9fafb;
    }
    
    .riyl-similar-item {
        background: #1f2937;
        border-color: #374151;
    }
    
    .riyl-similar-item:hover {
        border-color: #4b5563;
    }
    
    .riyl-similar-title {
        color: #f9fafb;
    }
}