/* ============================================================
   EDM LIVE SEARCH STYLES
   ============================================================ */

/* Search Container */
.edm-search-container {
    position: relative;
    max-width: 900px;
    margin: 0 auto 30px;
}

.edm-search-container.widget {
    max-width: 100%;
}

/* Search Box */
.edm-search-box {
    position: relative;
    margin-bottom: 15px;
}

.edm-search-input {
    width: 100%;
    padding: 16px 50px 16px 20px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 12px;
    transition: all 0.3s ease;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.edm-search-input:focus {
    outline: none;
    border-color: #28a745;
    box-shadow: 0 4px 12px rgba(40,167,69,0.15);
}

.edm-search-icon {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
}

.edm-clear-btn {
    position: absolute;
    right: 50px;
    top: 50%;
    transform: translateY(-50%);
    background: #e0e0e0;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    color: #666;
    transition: all 0.2s;
}

.edm-clear-btn:hover {
    background: #ccc;
    color: #333;
}

/* Autocomplete */
.edm-autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 12px 12px;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    z-index: 1001;
    margin-top: -12px;
    padding-top: 12px;
}

.autocomplete-category {
    padding: 8px 15px;
    background: #f5f5f5;
    font-weight: bold;
    font-size: 12px;
    text-transform: uppercase;
    color: #666;
    border-bottom: 1px solid #e0e0e0;
}

.autocomplete-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background-color 0.2s;
}

.autocomplete-item:hover {
    background-color: #f8f8f8;
}

.autocomplete-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.autocomplete-text {
    flex-grow: 1;
    color: #333;
}

.autocomplete-meta {
    font-size: 12px;
    color: #999;
    font-style: italic;
}

/* Filters */
.edm-search-filters {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.edm-filter-select {
    flex: 1;
    min-width: 150px;
    padding: 12px 16px;
    font-size: 14px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    transition: all 0.3s;
}

.edm-filter-select:focus {
    outline: none;
    border-color: #28a745;
}

/* Results Container */
.edm-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    margin-top: 10px;
    max-height: 600px;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    z-index: 1000;
    animation: slideDown 0.3s ease;
}

.edm-search-container.widget .edm-search-results {
    position: relative;
    margin-top: 15px;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Search Count */
.edm-search-count {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #f8f9fa;
}

/* Loading State */
.edm-search-loading, .edm-modal-loading {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.edm-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #28a745;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* No Results */
.edm-no-results svg {
    display: block;
    margin: 0 auto 15px;
}

/* Result Items */
.edm-results-list {
    padding: 0;
}

.edm-result-item {
    padding: 20px;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.2s;
    background: #fff;
}

.edm-result-item:hover {
    background: #f8f9fa;
}

.edm-result-item.viewed {
    opacity: 0.85;
    background: #fafafa;
}

.edm-result-item:last-child {
    border-bottom: none;
}

/* Result Header */
.edm-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.edm-result-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.category-badge {
    background: #28a745;
    color: #fff;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
}

.file-badge {
    background: #6c757d;
    color: #fff;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
}

.downloads-badge {
    background: #e8f4f8;
    color: #28a745;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

/* Result Badges */
.edm-result-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.edm-badge {
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.edm-badge.viewed {
    background: #e3f2fd;
    color: #1976d2;
}

.edm-badge.popular {
    background: #ffebee;
    color: #c62828;
}

.edm-badge.top-rated {
    background: #fff3e0;
    color: #e65100;
}

.edm-badge.new {
    background: #e8f5e9;
    color: #2e7d32;
}

.edm-badge.locked {
    background: #fff3cd;
    color: #856404;
}

/* Title */
.edm-result-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 10px 0;
    line-height: 1.4;
}

/* Rating */
.edm-result-rating {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 0;
}

.edm-star {
    font-size: 16px;
    color: #ddd;
}

.edm-star.filled {
    color: #ffa500;
}

.rating-text {
    font-size: 13px;
    color: #666;
}

/* Excerpt */
.edm-result-excerpt {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 12px;
}

/* File Info */
.edm-result-file-info {
    font-size: 12px;
    color: #999;
    margin-bottom: 15px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

/* Action Buttons */
.edm-result-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.edm-btn-preview,
.edm-btn-scroll,
.edm-btn-download-modal,
.edm-btn-scroll-modal {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    border: none;
}

.edm-btn-preview {
    background: #f0f0f0;
    color: #333;
}

.edm-btn-preview:hover {
    background: #e0e0e0;
    transform: translateY(-1px);
}

.edm-btn-scroll,
.edm-btn-scroll-modal {
    background: #28a745;
    color: #fff;
}

.edm-btn-scroll:hover,
.edm-btn-scroll-modal:hover {
    background: #218838;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(40,167,69,0.3);
}

.edm-btn-download-modal {
    background: #007bff;
    color: #fff;
    width: 100%;
    justify-content: center;
    padding: 14px 20px;
    font-size: 16px;
}

.edm-btn-download-modal:hover {
    background: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,123,255,0.3);
}

/* Preview Modal */
.edm-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.edm-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
}

.edm-modal-content {
    position: relative;
    background: #fff;
    border-radius: 16px;
    max-width: 900px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.edm-modal-close {
    position: sticky;
    top: 20px;
    right: 20px;
    float: right;
    background: #fff;
    border: 2px solid #ddd;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.3s;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.edm-modal-close:hover {
    background: #dc3545;
    color: #fff;
    border-color: #dc3545;
    transform: rotate(90deg);
}

.edm-preview-body {
    padding: 40px;
}

/* Preview Header */
.edm-preview-header h2 {
    color: #333;
    margin: 0 0 15px 0;
    font-size: 24px;
}

.edm-preview-meta {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
}

.edm-preview-meta .meta-item {
    font-size: 14px;
    color: #666;
}

.edm-preview-meta .meta-item strong {
    color: #28a745;
}

.edm-preview-rating {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}

/* Preview Content */
.edm-preview-content {
    margin: 30px 0;
}

.edm-preview-content h3 {
    color: #28a745;
    margin-top: 0;
    margin-bottom: 15px;
}

/* Preview File Box */
.edm-preview-file-box {
    background: #f8f9fa;
    border-left: 4px solid #28a745;
    padding: 20px;
    border-radius: 8px;
    margin: 25px 0;
}

.edm-preview-file-box h3 {
    margin-top: 0;
    color: #28a745;
}

.edm-preview-file-box ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.edm-preview-file-box li {
    padding: 8px 0;
    font-size: 14px;
    border-bottom: 1px solid #e0e0e0;
}

.edm-preview-file-box li:last-child {
    border-bottom: none;
}

/* Preview Download */
.edm-preview-download {
    margin: 30px 0;
}

/* Preview Locked */
.edm-preview-locked {
    margin: 30px 0;
}

/* Preview Reviews */
.edm-preview-reviews {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #e0e0e0;
}

.edm-preview-reviews h3 {
    color: #28a745;
    margin-bottom: 20px;
}

.review-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.review-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.review-rating {
    display: flex;
    gap: 2px;
}

.review-date {
    font-size: 12px;
    color: #999;
    margin-left: auto;
}

.review-text {
    margin: 10px 0 0 0;
    color: #666;
    line-height: 1.6;
}

/* Preview Footer */
.edm-preview-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
    text-align: center;
}

/* Error State */
.edm-error {
    text-align: center;
    padding: 40px 20px;
    color: #dc3545;
    font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
    .edm-search-input {
        font-size: 16px;
    }
    
    .edm-result-actions {
        flex-direction: column;
    }
    
    .edm-btn-preview,
    .edm-btn-scroll {
        width: 100%;
        justify-content: center;
    }
    
    .edm-modal-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .edm-preview-body {
        padding: 20px;
    }
    
    .edm-search-filters {
        flex-direction: column;
    }
    
    .edm-filter-select {
        width: 100%;
    }
    
    .edm-result-meta,
    .edm-preview-meta,
    .review-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .review-date {
        margin-left: 0;
    }
}

/* Scrollbar Styling */
.edm-search-results::-webkit-scrollbar,
.edm-modal-content::-webkit-scrollbar,
.edm-autocomplete-results::-webkit-scrollbar {
    width: 8px;
}

.edm-search-results::-webkit-scrollbar-track,
.edm-modal-content::-webkit-scrollbar-track,
.edm-autocomplete-results::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.edm-search-results::-webkit-scrollbar-thumb,
.edm-modal-content::-webkit-scrollbar-thumb,
.edm-autocomplete-results::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.edm-search-results::-webkit-scrollbar-thumb:hover,
.edm-modal-content::-webkit-scrollbar-thumb:hover,
.edm-autocomplete-results::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Accessibility */
.edm-btn-preview:focus,
.edm-btn-scroll:focus,
.edm-btn-download-modal:focus,
.edm-modal-close:focus {
    outline: 3px solid #28a745;
    outline-offset: 2px;
}