/* Modern Global Search - Brand Green #8BAD26 */

/* ===== CSS Variables ===== */
:root {
    --sg-primary:      #8BAD26;
    --sg-primary-dark: #6d8a1e;
    --sg-light-1:      #f5f8e8;
    --sg-light-2:      #eef3d5;
    --sg-light-3:      #e2edaa;
    --sg-light-4:      #c8da7a;
    --sg-shadow:       rgba(139, 173, 38, 0.22);
    --sg-border:       rgba(139, 173, 38, 0.28);
}

/* ===== Overlay ===== */
.search-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(28, 40, 5, 0.50);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 10vh;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.search-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ===== Container ===== */
.search-container {
    width: 90%;
    max-width: 700px;
    background: rgba(255, 255, 255, 0.97);
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px var(--sg-shadow);
    overflow: hidden;
    border: 1px solid var(--sg-border);
    transform: translateY(-20px);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.search-overlay.active .search-container {
    transform: translateY(0);
}

/* ===== Header ===== */
.search-header {
    padding: 20px 24px;
    border-bottom: 2px solid rgba(139, 173, 38, 0.15);
    display: flex;
    align-items: center;
    gap: 15px;
    background: linear-gradient(135deg, var(--sg-light-1) 0%, #fff 100%);
}

.search-header > i {
    font-size: 1.2rem;
    color: var(--sg-primary);
}

.search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 1.2rem;
    outline: none;
    color: #1f2937;
    font-family: inherit;
}

.search-input::placeholder { color: #b0b8a0; }

.search-close-btn {
    background: var(--sg-light-1);
    border: none;
    width: 32px; height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s;
}
.search-close-btn:hover {
    background: var(--sg-light-3);
    color: var(--sg-primary);
}

/* ===== Results area ===== */
.search-results {
    max-height: 60vh;
    overflow-y: auto;
    padding: 12px;
}

/* Custom scrollbar */
.search-results::-webkit-scrollbar { width: 5px; }
.search-results::-webkit-scrollbar-track  { background: var(--sg-light-1); }
.search-results::-webkit-scrollbar-thumb  { background: var(--sg-light-4); border-radius: 10px; }
.search-results::-webkit-scrollbar-thumb:hover { background: var(--sg-primary); }

/* ===== Category ===== */
.search-category { margin-bottom: 20px; }

.category-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--sg-primary);
    padding: 8px 12px;
    font-weight: 700;
}

/* ===== Search Item ===== */
.search-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
    gap: 12px;
}
.search-item:hover {
    background: rgba(139, 173, 38, 0.10);
    transform: translateX(4px);
}

.item-icon {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, var(--sg-light-2), var(--sg-light-3));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sg-primary);
    font-size: 1rem;
    flex-shrink: 0;
    box-shadow: 0 4px 6px -1px var(--sg-shadow);
}

.item-image {
    width: 40px; height: 40px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
}

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

.item-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-type {
    font-size: 0.75rem;
    color: #6b7280;
}

/* ===== Footer ===== */
.search-footer {
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--sg-light-1), #f9fafb);
    display: flex;
    gap: 15px;
    font-size: 0.7rem;
    color: #9ca3af;
    border-top: 1px solid rgba(139, 173, 38, 0.12);
}

.kbd-hint {
    background: white;
    border: 1px solid var(--sg-light-3);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--sg-primary);
    font-weight: 700;
}

/* ===== Skeleton Loader ===== */
.skeleton {
    background: linear-gradient(90deg, var(--sg-light-1) 25%, var(--sg-light-2) 50%, var(--sg-light-1) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}
@keyframes loading { to { background-position: -200% 0; } }

[x-cloak] { display: none !important; }

/* ===== Load More Button ===== */
.load-more-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 10px 12px;
    margin-top: 6px;
    background: transparent;
    border: 1.5px dashed var(--sg-light-4);
    border-radius: 10px;
    font-size: 0.85rem;
    color: var(--sg-primary);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    gap: 6px;
}
.load-more-btn:hover:not(:disabled) {
    background: rgba(139, 173, 38, 0.09);
    border-color: var(--sg-primary);
    transform: translateY(-1px);
}
.load-more-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ===== Loading State ===== */
.search-loading-state {
    padding: 40px 20px;
    text-align: center;
    color: #6b7280;
}

.search-loading-spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 15px;
    background: var(--sg-light-1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sg-primary);
    font-size: 1.5rem;
    position: relative;
    box-shadow: 0 4px 10px var(--sg-shadow);
}

.search-loading-spinner::after {
    content: '';
    position: absolute;
    top: -3px; left: -3px; right: -3px; bottom: -3px;
    border: 3px solid transparent;
    border-top-color: var(--sg-primary);
    border-radius: 50%;
    animation: sg-spin 1s linear infinite;
}

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

.search-loading-text {
    font-size: 0.95rem;
    margin-bottom: 10px;
}

.search-loading-query {
    font-weight: 700;
    color: var(--sg-primary);
}

.search-loading-dots {
    display: flex;
    justify-content: center;
    gap: 5px;
}

.search-loading-dots span {
    width: 6px;
    height: 6px;
    background: var(--sg-primary);
    border-radius: 50%;
    opacity: 0.4;
    animation: sg-bounce 1.4s infinite ease-in-out both;
}

.search-loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.search-loading-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes sg-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); opacity: 1; }
}
