/**
 * CC Advanced Search - Frontend Styles
 * 
 * @package CC_Advanced_Search
 */

/* Search Widget Container */
.cc-search-widget,
.cc-search-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

/* Search Form */
.cc-search-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.cc-search-input-wrapper {
    position: relative;
    flex: 1;
}

.cc-search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    pointer-events: none;
}

.cc-search-input {
    width: 100%;
    padding: 12px 15px;
    padding-left: 45px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.cc-search-input:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.cc-search-button {
    padding: 12px 30px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.cc-search-button:hover {
    background-color: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.cc-search-button:active {
    transform: translateY(0);
}

/* Robot Container */
.cc-search-robot-container {
    position: absolute;
    pointer-events: none;
    z-index: 10;
}

.cc-search-widget[data-robot-position="right"] .cc-search-robot-container {
    right: -120px;
    top: 50%;
    transform: translateY(-50%);
}

.cc-search-widget[data-robot-position="left"] .cc-search-robot-container {
    left: -120px;
    top: 50%;
    transform: translateY(-50%);
}

.cc-search-widget[data-robot-position="top"] .cc-search-robot-container {
    top: -120px;
    left: 50%;
    transform: translateX(-50%);
}

.cc-search-widget[data-robot-position="bottom"] .cc-search-robot-container {
    bottom: -120px;
    left: 50%;
    transform: translateX(-50%);
}

.cc-search-robot {
    width: 100px;
    height: 100px;
}

/* Autocomplete */
.cc-search-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 5px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.cc-search-autocomplete-item {
    padding: 12px 15px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
}

.cc-search-autocomplete-item:last-child {
    border-bottom: none;
}

.cc-search-autocomplete-item:hover {
    background-color: #f5f5f5;
}

/* Popup Overlay */
.cc-search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 9998;
    backdrop-filter: blur(3px);
}

/* Popup */
.cc-search-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    max-height: 90vh;
    overflow: hidden;
    animation: popupFadeIn 0.3s ease;
}

@keyframes popupFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -48%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

/* Popup Header */
.cc-search-popup-header {
    padding: 20px;
    border-bottom: 2px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(to bottom, #f9f9f9, #ffffff);
}

.cc-search-tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.cc-search-tab {
    padding: 8px 16px;
    background-color: #f0f0f0;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #666;
}

.cc-search-tab:hover {
    background-color: #e0e0e0;
}

.cc-search-tab.active {
    background-color: #4CAF50;
    color: white;
}

.cc-search-close {
    background: none;
    border: none;
    font-size: 32px;
    cursor: pointer;
    color: #666;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.cc-search-close:hover {
    background-color: #f0f0f0;
    color: #333;
}

/* Popup Content */
.cc-search-popup-content {
    padding: 20px;
    max-height: calc(90vh - 100px);
    overflow-y: auto;
}

.cc-search-popup-content::-webkit-scrollbar {
    width: 8px;
}

.cc-search-popup-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.cc-search-popup-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.cc-search-popup-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Loading State */
.cc-search-loading {
    text-align: center;
    padding: 40px;
    font-size: 18px;
    color: #666;
}

.cc-search-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-left: 10px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #4CAF50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error State */
.cc-search-error {
    text-align: center;
    padding: 40px;
    color: #d32f2f;
    font-size: 16px;
}

/* No Results */
.cc-search-no-results {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 18px;
}

/* Suggestions */
.cc-search-suggestions {
    margin-bottom: 30px;
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 8px;
}

.cc-search-suggestions h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    color: #666;
}

.cc-search-suggestions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.cc-search-suggestion-btn {
    padding: 8px 16px;
    background-color: white;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cc-search-suggestion-btn:hover {
    background-color: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

/* Results */
.cc-search-results h3 {
    margin: 0 0 20px 0;
    font-size: 18px;
    color: #333;
}

.cc-search-result {
    display: flex;
    gap: 15px;
    padding: 15px;
    margin-bottom: 15px;
    background-color: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
}

.cc-search-result:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
    border-color: #4CAF50;
}

.cc-search-result-thumbnail {
    width: 120px;
    height: 120px;
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
    border-radius: 6px;
    background-color: #f0f0f0;
}

.cc-search-result-content {
    flex: 1;
    min-width: 0;
}

.cc-search-result-title {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    line-height: 1.4;
}

.cc-search-result:hover .cc-search-result-title {
    color: #4CAF50;
}

.cc-search-result-excerpt {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cc-search-result-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.cc-search-badge {
    display: inline-block;
    padding: 4px 12px;
    background-color: #e3f2fd;
    color: #1976d2;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

/* Pagination */
.cc-search-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.cc-search-page-btn {
    padding: 8px 16px;
    background-color: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 40px;
}

.cc-search-page-btn:hover:not(.disabled):not(.active) {
    background-color: #f5f5f5;
    border-color: #4CAF50;
}

.cc-search-page-btn.active {
    background-color: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

.cc-search-page-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsive Design */
@media (max-width: 768px) {
    .cc-search-popup {
        width: 95% !important;
        max-width: none !important;
    }
    
    .cc-search-tabs {
        font-size: 12px;
    }
    
    .cc-search-tab {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .cc-search-result {
        flex-direction: column;
    }
    
    .cc-search-result-thumbnail {
        width: 100%;
        height: 200px;
    }
    
    .cc-search-robot-container {
        display: none;
    }
}

@media (max-width: 480px) {
    .cc-search-form {
        flex-direction: column;
    }
    
    .cc-search-button {
        width: 100%;
    }
    
    .cc-search-pagination {
        flex-wrap: wrap;
    }
}