/**
 * Global Search CSS Stylesheet
 * Premium, Glassmorphic UI with micro-animations
 */

.global-search-form {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.global-search-wrapper {
    position: relative;
    width: 100%;
}

.global-search-input-container {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    background: rgba(252, 253, 244, 0.85);
    border: 2px solid rgba(30, 55, 105, 0.15);
    border-radius: 50px;
    padding: 2px 8px 2px 18px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.global-search-input-container:focus-within {
    border-color: #1E3769;
    background: #FCFDF4;
    box-shadow: 0 8px 24px rgba(30, 55, 105, 0.08), 0 0 0 4px rgba(30, 55, 105, 0.05);
    transform: translateY(-1px);
}

.global-search-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    margin-right: 12px;
    transition: color 0.3s ease;
}

.global-search-input-container:focus-within .global-search-icon {
    color: #1E3769;
}

.global-search-field {
    flex: 1;
    border: none !important;
    background: transparent !important;
    padding: 12px 0 !important;
    font-size: 16px !important;
    color: #1B1C16 !important;
    outline: none !important;
    width: 100%;
    font-weight: 500;
}

.global-search-field::placeholder {
    color: #94a3b8;
    opacity: 1;
}

.global-search-clear {
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.global-search-clear:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #475569;
}

/* Spinner Animation */
.global-search-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(30, 55, 105, 0.1);
    border-radius: 50%;
    border-left-color: #1E3769;
    animation: global-search-spin 0.8s linear infinite;
    margin-right: 8px;
}

@keyframes global-search-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Glassmorphic Dropdown */
.global-search-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    left: 0;
    right: 0;
    background: rgba(252, 253, 244, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 20px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
    z-index: 99999;
    overflow: hidden;
    max-height: 480px;
    overflow-y: auto;
    animation: global-search-fade-in 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes global-search-fade-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Dropdown styling */
.global-search-results-container {
    padding: 8px;
}

.global-search-group {
    margin-bottom: 12px;
}

.global-search-group:last-child {
    margin-bottom: 0;
}

.global-search-group-header {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #64748b;
    padding: 8px 12px 4px 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    margin-bottom: 4px;
}

/* Search Items */
.global-search-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 12px;
    text-decoration: none !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.global-search-item:hover,
.global-search-item.global-search-active {
    background: rgba(30, 55, 105, 0.06);
    outline: none;
}

/* Active Highlight with Left Accent Line */
.global-search-item.global-search-active {
    position: relative;
    padding-left: 18px;
}

.global-search-item.global-search-active::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 12px;
    bottom: 12px;
    width: 3px;
    background: #1E3769;
    border-radius: 2px;
    animation: scale-up-y 0.2s ease;
}

@keyframes scale-up-y {
    from { transform: scaleY(0); }
    to { transform: scaleY(1); }
}

/* Item image or fallback icon */
.global-search-item-image-container {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    overflow: hidden;
    margin-right: 12px;
    background: rgba(30, 55, 105, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.global-search-item-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.global-search-item:hover .global-search-item-image {
    transform: scale(1.08);
}

.global-search-item-icon {
    width: 20px;
    height: 20px;
    color: #1E3769;
}

.global-search-item-content {
    flex: 1;
    min-width: 0;
}

.global-search-item-title {
    font-size: 14px;
    font-weight: 600;
    color: #1B1C16 !important;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* No Results and Errors */
.global-search-no-results,
.global-search-error {
    padding: 24px;
    text-align: center;
    color: #64748b;
    font-size: 14px;
    font-weight: 500;
}

.global-search-no-results svg,
.global-search-error svg {
    color: #94a3b8;
    margin-bottom: 8px;
}
