/**
 * Global Search, Quick View Modal, and Wishlist Styling
 */

/* ===========================
   GLOBAL SEARCH BAR
   =========================== */
.search-bar {
    position: relative;
    width: 100%;
    max-width: 400px;
}

.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--gray-100);
    border-radius: var(--radius-md);
    padding: 0 12px;
    border: 1px solid transparent;
    transition: var(--transition);
}

.search-wrapper:focus-within {
    background: var(--white);
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(0, 119, 182, 0.1);
}

:root[data-theme="dark"] .search-wrapper {
    background: #353535;
    border-color: #404040;
}

:root[data-theme="dark"] .search-wrapper:focus-within {
    background: #2A2A2A;
    border-color: #00D9FF;
}

.search-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 8px;
    font-size: 0.95rem;
    color: var(--gray-800);
}

:root[data-theme="dark"] .search-input {
    color: #F0F0F0;
}

.search-input::placeholder {
    color: var(--gray-400);
}

:root[data-theme="dark"] .search-input::placeholder {
    color: #808080;
}

.search-icon {
    color: var(--gray-400);
    cursor: pointer;
}

/* Search Dropdown */
.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-top: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    max-height: 0;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    z-index: 1001;
    transition: max-height 0.3s ease;
}

.search-dropdown.active {
    max-height: 500px;
    overflow-y: auto;
}

:root[data-theme="dark"] .search-dropdown {
    background: #2A2A2A;
    border-color: #404040;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.search-loading,
.search-no-results,
.search-error {
    padding: 20px;
    text-align: center;
    color: var(--gray-600);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 60px;
}

:root[data-theme="dark"] .search-loading,
:root[data-theme="dark"] .search-no-results,
:root[data-theme="dark"] .search-error {
    color: #B0B0B0;
}

.search-results {
    display: flex;
    flex-direction: column;
}

.search-result-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid var(--gray-100);
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

:root[data-theme="dark"] .search-result-item {
    border-bottom-color: #404040;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: var(--light-bg);
}

:root[data-theme="dark"] .search-result-item:hover {
    background: #353535;
}

.result-image {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    object-fit: cover;
    flex-shrink: 0;
}

.result-info {
    flex: 1;
    min-width: 0;
}

.result-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0 0 4px 0;
    color: var(--gray-900);
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

:root[data-theme="dark"] .result-title {
    color: #F0F0F0;
}

.result-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--gray-600);
}

:root[data-theme="dark"] .result-meta {
    color: #B0B0B0;
}

.result-price {
    font-weight: 600;
    color: var(--primary);
}

.search-view-all {
    padding: 8px 12px;
    text-align: center;
    border-top: 1px solid var(--gray-200);
    background: var(--light-bg);
}

:root[data-theme="dark"] .search-view-all {
    border-top-color: #404040;
    background: #1a1a1a;
}

.search-view-all a {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
}

/* ===========================
   QUICK VIEW MODAL
   =========================== */
.quick-view-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.quick-view-modal.active {
    opacity: 1;
    visibility: visible;
}

.quick-view-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.quick-view-content {
    position: relative;
    background: var(--white);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}

:root[data-theme="dark"] .quick-view-content {
    background: #2A2A2A;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.quick-view-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    z-index: 1;
}

.quick-view-close:hover {
    background: rgba(0, 0, 0, 0.2);
    transform: rotate(90deg);
}

:root[data-theme="dark"] .quick-view-close {
    background: rgba(255, 255, 255, 0.1);
}

:root[data-theme="dark"] .quick-view-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.quick-view-body {
    padding: 20px;
}

.quick-view-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 200px;
    color: var(--gray-600);
}

:root[data-theme="dark"] .quick-view-loading {
    color: #B0B0B0;
}

.quick-view-image {
    width: 100%;
    height: 250px;
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 16px;
}

.quick-view-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.quick-view-no-image {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--gray-500);
    background: linear-gradient(135deg, rgba(0, 119, 182, 0.08), rgba(6, 214, 160, 0.08));
    font-size: 0.9rem;
}

.quick-view-no-image i {
    font-size: 1.4rem;
}

:root[data-theme="dark"] .quick-view-no-image {
    color: #C8C8C8;
    background: linear-gradient(135deg, rgba(0, 119, 182, 0.22), rgba(6, 214, 160, 0.18));
}

.quick-view-title {
    font-size: 1.3rem;
    margin-bottom: 12px;
}

.quick-view-excerpt {
    color: var(--gray-600);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 16px;
}

:root[data-theme="dark"] .quick-view-excerpt {
    color: #B0B0B0;
}

.quick-view-meta {
    display: flex;
    gap: 1.5rem;
    margin: 12px 0;
    font-size: 0.95rem;
    color: var(--gray-700);
}

:root[data-theme="dark"] .quick-view-meta {
    color: #D0D0D0;
}

.quick-view-meta span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quick-view-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.quick-view-actions .btn {
    flex: 1;
    padding: 10px;
    font-size: 0.9rem;
}

/* ===========================
   WISHLIST / FAVORITES
   =========================== */
.wishlist-btn {
    position: relative;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--gray-200);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    font-size: 1.1rem;
    color: var(--gray-600);
}

.tour-media-actions .wishlist-btn,
.tour-media-actions .quick-view-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.45);
    background: rgba(255, 255, 255, 0.86);
    color: #1f2937;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
}

.tour-media-actions .wishlist-btn:hover,
.tour-media-actions .quick-view-btn:hover {
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(0, 119, 182, 0.35);
    color: var(--primary);
    transform: translateY(-1px);
}

.wishlist-btn:hover {
    background: white;
    border-color: var(--primary);
    color: var(--primary);
    transform: scale(1.1);
}

.wishlist-btn.in-wishlist {
    background: white;
    border-color: #FF6B9D;
    color: #FF6B9D;
}

.wishlist-btn.in-wishlist:hover {
    background: #FFF0F7;
}

:root[data-theme="dark"] .wishlist-btn {
    background: #353535;
    border-color: #505050;
    color: #B0B0B0;
}

:root[data-theme="dark"] .wishlist-btn:hover {
    background: #404040;
    border-color: #00D9FF;
    color: #00D9FF;
}

:root[data-theme="dark"] .wishlist-btn.in-wishlist {
    background: #404040;
    border-color: #FF6B9D;
    color: #FF6B9D;
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--dark);
    color: white;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transform: translateY(20px);
    transition: var(--transition);
    z-index: 3000;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-success {
    background: var(--success);
}

.toast-error {
    background: var(--danger);
}

.toast-info {
    background: var(--primary);
}

/* Quick View Button */
.quick-view-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 8px 14px;
    background: var(--light-bg);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--transition);
}

.tour-media-actions .quick-view-btn {
    font-size: 0.95rem;
}

.tour-media-actions .quick-view-btn i,
.tour-media-actions .wishlist-btn i {
    pointer-events: none;
}

.quick-view-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

:root[data-theme="dark"] .quick-view-btn {
    background: #353535;
    border-color: #505050;
    color: #F0F0F0;
}

:root[data-theme="dark"] .quick-view-btn:hover {
    background: #00D9FF;
    border-color: #00D9FF;
    color: #1A1A1A;
}

:root[data-theme="dark"] .tour-media-actions .wishlist-btn,
:root[data-theme="dark"] .tour-media-actions .quick-view-btn {
    background: rgba(26, 26, 26, 0.78);
    border-color: rgba(255, 255, 255, 0.24);
    color: #f3f4f6;
}

:root[data-theme="dark"] .tour-media-actions .wishlist-btn:hover,
:root[data-theme="dark"] .tour-media-actions .quick-view-btn:hover {
    background: rgba(0, 217, 255, 0.18);
    border-color: rgba(0, 217, 255, 0.75);
    color: #E8FCFF;
}

/* Responsive */
@media (max-width: 768px) {
    .search-bar {
        max-width: 100%;
    }

    .quick-view-content {
        width: 95%;
        max-height: 90vh;
    }

    .quick-view-body {
        padding: 16px;
    }

    .quick-view-actions {
        flex-direction: column;
    }

    .toast {
        bottom: 20px;
        right: 20px;
    }
}
