/**
 * MO Search - Frontend Styles
 */

/* Search Container */
.mo-search-container {
    position: relative;
    width: 100%;
    max-width: 600px;
}

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

.mo-search-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 50px;
    padding: 8px 15px;
    transition: all 0.3s ease;
}

.mo-search-input-wrapper:focus-within {
    border-color: #2271b1;
    box-shadow: 0 4px 12px rgba(34, 113, 177, 0.15);
}

.mo-search-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 8px 10px;
    font-size: 16px;
    color: #333;
    background: transparent;
}

.mo-search-input::placeholder {
    color: #999;
}

.mo-search-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
}

.mo-search-button:hover {
    background: #135e96;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(34, 113, 177, 0.3);
}

.mo-search-button svg {
    width: 18px;
    height: 18px;
}

/* Dropdown Results */
.mo-search-dropdown-results {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    max-height: 70vh;
    overflow-y: auto;
    z-index: 1000;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mo-search-results-container {
    padding: 15px;
}

/* Fullscreen Overlay */
.mo-search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 999999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 20px;
    overflow-y: auto;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.mo-search-overlay-inner {
    width: 100%;
    max-width: 900px;
    position: relative;
}

.mo-search-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.mo-search-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.mo-search-overlay-content {
    margin-top: 60px;
}

.mo-search-overlay-form {
    margin-bottom: 30px;
}

.mo-search-overlay-input {
    width: 100%;
    padding: 20px 30px;
    font-size: 24px;
    border: none;
    border-bottom: 3px solid rgba(255, 255, 255, 0.3);
    background: transparent;
    color: #fff;
    outline: none;
    transition: border-color 0.3s ease;
}

.mo-search-overlay-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.mo-search-overlay-input:focus {
    border-bottom-color: #2271b1;
}

.mo-search-overlay-results {
    margin-top: 30px;
}

/* Loading State */
.mo-search-loading {
    text-align: center;
    padding: 40px 20px;
}

.mo-search-spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 4px solid rgba(34, 113, 177, 0.2);
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.mo-search-overlay .mo-search-spinner {
    border-color: rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.mo-search-loading p {
    color: #666;
    font-size: 16px;
}

.mo-search-overlay .mo-search-loading p {
    color: rgba(255, 255, 255, 0.7);
}

/* Result Items */
.mo-search-result-item {
    display: flex;
    gap: 20px;
    padding: 20px;
    margin-bottom: 15px;
    background: #f9f9f9;
    border-radius: 12px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.mo-search-overlay .mo-search-result-item {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.mo-search-result-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    border-color: #2271b1;
}

.mo-search-overlay .mo-search-result-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #2271b1;
}

.mo-search-result-thumbnail {
    flex-shrink: 0;
    width: 120px;
    height: 120px;
    overflow: hidden;
    border-radius: 8px;
}

.mo-search-result-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mo-search-result-content {
    flex: 1;
    min-width: 0;
}

.mo-search-result-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 10px;
}

.mo-search-result-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.4;
}

.mo-search-result-title a {
    color: #2271b1;
    text-decoration: none;
    transition: color 0.3s ease;
}

.mo-search-result-title a:hover {
    color: #135e96;
}

.mo-search-overlay .mo-search-result-title a {
    color: #fff;
}

.mo-search-overlay .mo-search-result-title a:hover {
    color: #2271b1;
}

.mo-search-result-type {
    display: inline-block;
    padding: 4px 12px;
    background: #2271b1;
    color: #fff;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    flex-shrink: 0;
}

.mo-search-result-excerpt {
    margin-bottom: 10px;
    color: #666;
    line-height: 1.6;
    font-size: 14px;
}

.mo-search-overlay .mo-search-result-excerpt {
    color: rgba(255, 255, 255, 0.7);
}

.mo-search-result-excerpt mark {
    background: #fff59d;
    padding: 2px 4px;
    border-radius: 2px;
    font-weight: 600;
}

.mo-search-overlay .mo-search-result-excerpt mark {
    background: #2271b1;
    color: #fff;
}

.mo-search-result-meta {
    display: flex;
    gap: 15px;
    font-size: 13px;
    color: #999;
}

.mo-search-overlay .mo-search-result-meta {
    color: rgba(255, 255, 255, 0.5);
}

/* No Results */
.mo-search-no-results {
    text-align: center;
    padding: 60px 20px;
}

.mo-search-no-results h3 {
    font-size: 24px;
    margin-bottom: 15px;
    color: #333;
}

.mo-search-overlay .mo-search-no-results h3 {
    color: #fff;
}

.mo-search-no-results p {
    color: #666;
    font-size: 16px;
}

.mo-search-overlay .mo-search-no-results p {
    color: rgba(255, 255, 255, 0.7);
}

/* Pagination */
.mo-search-pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 30px;
    padding: 20px;
}

.mo-search-pagination button {
    padding: 10px 20px;
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.mo-search-pagination button:hover:not(:disabled) {
    background: #135e96;
    transform: translateY(-1px);
}

.mo-search-pagination button:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.5;
}

.mo-search-overlay .mo-search-pagination button {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.mo-search-overlay .mo-search-pagination button:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
}

/* Menu Integration */
.menu-item-search {
    position: relative;
}

.menu-item-search .mo-search-container {
    margin: 0 15px;
}

/* Responsive */
@media (max-width: 768px) {
    .mo-search-input-wrapper {
        padding: 6px 12px;
    }

    .mo-search-button-text {
        display: none;
    }

    .mo-search-button {
        padding: 10px;
    }

    .mo-search-overlay-input {
        font-size: 18px;
        padding: 15px 20px;
    }

    .mo-search-result-item {
        flex-direction: column;
        gap: 15px;
    }

    .mo-search-result-thumbnail {
        width: 100%;
        height: 200px;
    }

    .mo-search-result-title {
        font-size: 18px;
    }
}

/* Widget Styles */
.widget_mo_search_widget .mo-search-container {
    max-width: 100%;
}
