/**
 * Google-like Search CSS
 * Giống Google hoàn toàn
 */

/* Input default: bo đủ 12px */
.ps-form--quick-search { 
    border-radius: 12px; 
    overflow: visible; 
}

/* Khi có dropdown → bỏ bo góc dưới của input để dính list */
.ps-form--quick-search.has-suggestions { 
    border-bottom-left-radius: 0; 
    border-bottom-right-radius: 0; 
}

/* List: chỉ bo góc DƯỚI, không bo góc trên */
.google-like-suggestions { 
    border-radius: 0 0 12px 12px; 
}

/* Icon "lịch sử" cho history items */
.google-like-suggestions .history-item{ 
    padding-left: 48px; 
    position: relative; 
}
.google-like-suggestions .history-item::before{
  content:"🕒"; 
  position: absolute; 
  left: 16px; 
  top: 50%; 
  transform: translateY(-50%);
  font-size: 16px; 
  color: #5f6368;
}

.google-like-suggestions.show {
    display: block !important;
    opacity: 1;
}

.google-like-suggestions .suggestion-item {
    padding: 0px 0px 0px 48px; /* Thêm padding-left cho icon */
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background-color 0.1s ease;
    border-bottom: none;
    position: relative;
    min-height: 48px;
}

.google-like-suggestions .suggestion-item:hover,
.google-like-suggestions .suggestion-item.active {
    background-color: #f8f9fa;
}

/* Search history styling - Google-like */
.google-like-suggestions .suggestion-item.history-item {
    padding-left: 50px;
    display: flex;
    align-items: center;
}

.google-like-suggestions .suggestion-item.history-item::before {
    content: "🕒";
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: #5f6368;
    font-weight: bold;
}

.google-like-suggestions .suggestion-item.history-item .suggestion-text {
    color: #202124;
    font-size: 16px;
    font-weight: 400;
    flex: 1;
}

/* Suggestion styling (not history) - Google-like */
.google-like-suggestions .suggestion-item:not(.history-item) {
    padding-left: 40px;
    display: flex;
    align-items: center;
}

.google-like-suggestions .suggestion-item:not(.history-item)::before {
    content: "🔍";
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: #5f6368;
    font-weight: bold;
}

.google-like-suggestions .suggestion-item:not(.history-item) .suggestion-text {
    color: #202124;
    font-size: 16px;
    font-weight: 500;
    flex: 1;
}

.google-like-suggestions .suggestion-item:last-child {
    border-bottom: none;
}

.google-like-suggestions .suggestion-content {
    flex: 1;
}

.google-like-suggestions .suggestion-text {
    font-size: 14px;
    color: #3c4043;
    font-weight: 400;
    line-height: 1.4;
}

.google-like-suggestions .suggestion-type {
    font-size: 12px;
    color: #5f6368;
    margin-top: 2px;
}

/* Google-like input styling */
.google-like-suggestions + input {
    border-radius: 8px 8px 0 0 !important;
}

.google-like-suggestions:not([style*="display: none"]) + input {
    border-radius: 8px 8px 0 0 !important;
    border-bottom: none !important;
}

/* Responsive design */
@media (max-width: 768px) {
    .google-like-suggestions {
        max-height: 300px;
        font-size: 13px;
    }
    
    .google-like-suggestions .suggestion-item {
        padding: 8px 12px;
    }
    
    .google-like-suggestions .suggestion-text {
        font-size: 13px;
    }
    
    .google-like-suggestions .suggestion-type {
        font-size: 11px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .google-like-suggestions {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .google-like-suggestions .suggestion-item {
        border-color: #4a5568;
    }
    
    .google-like-suggestions .suggestion-item:hover,
    .google-like-suggestions .suggestion-item.active {
        background-color: #1a202c;
    }
    
    .google-like-suggestions .suggestion-text {
        color: #e2e8f0;
    }
    
    .google-like-suggestions .suggestion-type {
        color: #a0aec0;
    }
}

/* Animation for smooth appearance */
.google-like-suggestions {
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.1s ease, transform 0.1s ease;
}

.google-like-suggestions.show {
    opacity: 1 !important;
    transform: translateY(0);
}

/* Force visibility when shown */
.google-like-suggestions[style*="display: block"] {
    opacity: 1 !important;
    transform: translateY(0);
}

/* Custom scrollbar */
.google-like-suggestions::-webkit-scrollbar {
    width: 6px;
}

.google-like-suggestions::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.google-like-suggestions::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.google-like-suggestions::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .google-like-suggestions {
        border: 2px solid #000;
    }
    
    .google-like-suggestions .suggestion-item {
        border-bottom: 1px solid #000;
    }
    
    .google-like-suggestions .suggestion-item:hover,
    .google-like-suggestions .suggestion-item.active {
        background-color: #000;
        color: #fff;
    }
}

/* Reduced motion */
/* Speller (Did-you-mean) - chỉ border vàng, nền trắng như autocomplete */
.google-like-suggestions .suggestion-item.speller-item{
  background:#fff; /* giống autocomplete */
  /* padding-left và position:relative đã được set ở .suggestion-item */
}
.google-like-suggestions .suggestion-item.speller-item::before{
  content:"🔍"; position:absolute; left:16px; top:50%; transform:translateY(-50%);
  font-size:16px; color:#6c757d; /* Màu xám như autocomplete */
}

/* Related keywords - chỉ border xanh, nền trắng như autocomplete */
.google-like-suggestions .suggestion-item.related-item{
  background:#fff; /* giống autocomplete */
  /* padding-left và position:relative đã được set ở .suggestion-item */
}
.google-like-suggestions .suggestion-item.related-item::before{
  content:"🔍"; position:absolute; left:16px; top:50%; transform:translateY(-50%);
  font-size:16px; color:#6c757d; /* Màu xám như autocomplete */
}

/* Icon mặc định cho tất cả suggestion items */
.google-like-suggestions .suggestion-item::before{
  content:"🔍"; position:absolute; left:16px; top:50%; transform:translateY(-50%);
  font-size:16px; color:#6c757d;
}

/* History item - override icon search bằng icon đồng hồ */
.google-like-suggestions .suggestion-item.history-item::before{ 
  content:"🕒"; 
  color:#6c757d;
}

@media (prefers-reduced-motion: reduce) {
    .google-like-suggestions {
        transition: none;
    }
    
    .google-like-suggestions .suggestion-item {
        transition: none;
    }
}

