/**
 * ElasticSearch Enhanced Search Styles for ForTraders
 * Version: 1.0.0
 */

/* Search Form Enhancements */
.ep-search-form {
    position: relative;
}

.ep-search-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: #fff;
}

.ep-search-input:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.ep-search-form.ep-loading .ep-search-input {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M12 6v6l4 2"/></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 20px;
    padding-right: 40px;
}

/* Suggestions Container */
.ep-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e1e5e9;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
    display: none;
}

.ep-suggestions-list {
    padding: 8px 0;
}

/* Suggestion Items */
.ep-suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
}

.ep-suggestion-item:last-child {
    border-bottom: none;
}

.ep-suggestion-item:hover,
.ep-suggestion-item.active {
    background-color: #f8f9fa;
}

.ep-suggestion-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
    line-height: 1.3;
}

.ep-suggestion-excerpt {
    color: #666;
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 6px;
}

.ep-suggestion-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: #999;
}

.ep-suggestion-type {
    background: #e3f2fd;
    color: #1976d2;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 500;
}

/* Search Results */
.ep-search-results {
    margin-top: 20px;
}

.ep-search-result {
    padding: 20px;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    margin-bottom: 16px;
    background: #fff;
    transition: box-shadow 0.2s ease;
}

.ep-search-result:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ep-search-result h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    line-height: 1.3;
}

.ep-search-result h3 a {
    color: #333;
    text-decoration: none;
}

.ep-search-result h3 a:hover {
    color: #007cba;
}

.ep-result-excerpt {
    color: #666;
    line-height: 1.5;
    margin-bottom: 12px;
}

.ep-result-meta {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: #999;
    align-items: center;
}

.ep-result-type {
    background: #e8f5e8;
    color: #2e7d32;
    padding: 3px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 500;
}

.ep-result-score {
    background: #fff3e0;
    color: #f57c00;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 500;
}

/* Highlighting */
mark {
    background: #ffd700;
    color: #333;
    padding: 1px 2px;
    border-radius: 2px;
    font-weight: 600;
}

/* Loading States */
.ep-loading {
    text-align: center;
    padding: 20px;
    color: #666;
    font-style: italic;
}

.ep-loading::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #e1e5e9;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: ep-spin 1s linear infinite;
    margin-right: 8px;
}

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

/* Error States */
.ep-error {
    color: #d32f2f;
    padding: 12px 16px;
    background: #ffebee;
    border-left: 4px solid #d32f2f;
}

.ep-no-results {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 16px;
}

/* Messages */
.ep-message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 6px;
    color: #fff;
    font-weight: 500;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.ep-message-warning {
    background: #ff9800;
}

.ep-message-error {
    background: #f44336;
}

.ep-message-success {
    background: #4caf50;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .ep-search-input {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .ep-suggestions {
        max-height: 300px;
    }
    
    .ep-suggestion-item {
        padding: 10px 12px;
    }
    
    .ep-suggestion-meta {
        flex-direction: column;
        gap: 4px;
        align-items: flex-start;
    }
    
    .ep-search-result {
        padding: 16px;
    }
    
    .ep-result-meta {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }
    
    .ep-message {
        top: 10px;
        right: 10px;
        left: 10px;
        text-align: center;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .ep-search-input {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .ep-search-input:focus {
        border-color: #63b3ed;
        box-shadow: 0 0 0 3px rgba(99, 179, 237, 0.1);
    }
    
    .ep-suggestions {
        background: #2d3748;
        border-color: #4a5568;
    }
    
    .ep-suggestion-item {
        border-bottom-color: #4a5568;
    }
    
    .ep-suggestion-item:hover,
    .ep-suggestion-item.active {
        background-color: #4a5568;
    }
    
    .ep-suggestion-title {
        color: #e2e8f0;
    }
    
    .ep-suggestion-excerpt {
        color: #a0aec0;
    }
    
    .ep-suggestion-meta {
        color: #718096;
    }
    
    .ep-search-result {
        background: #2d3748;
        border-color: #4a5568;
    }
    
    .ep-search-result h3 a {
        color: #e2e8f0;
    }
    
    .ep-result-excerpt {
        color: #a0aec0;
    }
    
    .ep-result-meta {
        color: #718096;
    }
}

/* Accessibility */
.ep-suggestion-item:focus {
    outline: 2px solid #007cba;
    outline-offset: -2px;
}

.ep-search-input:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .ep-search-input {
        border-width: 3px;
    }
    
    .ep-suggestion-item {
        border-bottom-width: 2px;
    }
    
    mark {
        background: #ffff00;
        color: #000;
    }
}
