/**
 * SunTrack Search Bar Styles
 */

/* Wrapper */
.st-searchbar-wrapper {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Desktop search widget container */
#_desktop_search_widget {
    position: relative;
}

#_desktop_search_widget *,
#_desktop_search_widget a,
#_desktop_search_widget a:hover,
#_desktop_search_widget a:focus,
#_desktop_search_widget a:active {
    text-decoration: none !important;
    color: #1F2937;
}

/* Form */
.st-searchbar-form {
    position: relative;
    width: 100%;
}

/* Input wrapper */
.st-searchbar-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: all 0.2s ease;
    overflow: hidden;
}

.st-searchbar-input-wrapper:focus-within {
    border-color: #FF9516;
    box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.1);
}

.st-searchbar-input-wrapper:hover {
    border-color: #bbb;
}

/* Input - nadpisanie stylów motywu */
.st-searchbar-input,
.search-widget form input[type="text"],
#_desktop_search_widget input[type="text"] {
    flex: 1;
    height: 44px;
    padding: 0 14px;
    border: none !important;
    border-radius: 4px !important;
    background: transparent !important;
    font-size: 14px;
    color: #333;
    outline: none !important;
    box-shadow: none !important;
}

.st-searchbar-input:focus,
.search-widget form input[type="text"]:focus,
#_desktop_search_widget input[type="text"]:focus {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.st-searchbar-input::placeholder {
    color: #999;
}

/* Buttons */
.st-searchbar-btn,
.st-searchbar-clear {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: #64748b;
    transition: all 0.2s ease;
}

.st-searchbar-btn:hover {
    color: #FF9516;
}

.st-searchbar-btn {
    background: #FF9516;
    color: #ffffff;
    margin: 3px;
    border-radius: 4px;
    width: 38px;
    height: 38px;
}

.st-searchbar-btn:hover {
    background: #E08014;
    color: #ffffff;
    text-decoration: none !important;
}

.st-searchbar-clear {
    width: 32px;
    height: 32px;
}

.st-searchbar-clear:hover {
    color: #ef4444;
}

/* Results dropdown - must be above megamenu */
.st-searchbar-results {
    position: fixed;
    background: #ffffff;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    max-height: 450px;
    overflow-y: auto;
    z-index: 2147483647 !important;
}

.st-searchbar-results * {
    text-decoration: none !important;
}

.st-searchbar-results a:hover {
    text-decoration: none !important;
}

/* Loading state */
.st-searchbar-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    color: #64748b;
    font-size: 14px;
}

.st-searchbar-loading::before {
    content: '';
    width: 20px;
    height: 20px;
    margin-right: 10px;
    border: 2px solid #e2e8f0;
    border-top-color: #FF9516;
    border-radius: 50%;
    animation: st-spin 0.8s linear infinite;
}

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

/* No results */
.st-searchbar-no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
    color: #64748b;
    text-align: center;
}

.st-searchbar-no-results svg {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.st-searchbar-no-results span {
    font-size: 14px;
}

/* Product item */
.st-searchbar-item {
    display: flex;
    align-items: start;
    padding: 12px 16px;
    text-decoration: none !important;
    color: inherit;
    font-size: 12px;
    line-height: 1.3em;
    transition: all 0.15s ease;
    border-bottom: 1px solid #f1f5f9;
}

.st-searchbar-item:last-child {
    border-bottom: none;
}

.st-searchbar-item:hover,
.st-searchbar-item.active {
    background: #fff8f3;
    text-decoration: none !important;
}

.st-searchbar-item:hover .st-searchbar-item-name {
    color: #FF9516;
    text-decoration: none !important;
}

/* Product image */
.st-searchbar-item-img {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    margin-right: 14px;
    border-radius: 4px;
    overflow: hidden;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.st-searchbar-item-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 4px;
    background: #fff;
}

/* Product info */
.st-searchbar-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Product name */
.st-searchbar-item-name {
    font-size: 12px;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.3em;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    white-space: normal;
}

/* Product meta (reference, manufacturer) */
.st-searchbar-item-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #64748b;
}

.st-searchbar-item-sku {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    background: #f1f5f9;
    border-radius: 4px;
    font-family: monospace;
    font-size: 11px;
    color: #475569;
}

.st-searchbar-item-brand {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    background: #e0f2fe;
    border-radius: 4px;
    font-size: 11px;
    color: #0369a1;
}

/* Product price */
.st-searchbar-item-price {
    flex-shrink: 0;
    margin-left: 16px;
    text-align: right;
}

.st-searchbar-item-price-brutto {
    font-size: 14px;
    font-weight: 700;
    color: #FF9516;
    line-height: 1.3em;
}

.st-searchbar-item-price-netto {
    font-size: 12px;
    font-weight: 500;
    color: #64748b;
    line-height: 1.3em;
}

.st-searchbar-item-price-login {
    font-size: 11px;
    color: #94a3b8;
    white-space: nowrap;
    line-height: 1.3em;
}

/* View all link */
.st-searchbar-viewall {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: #f8f8f8;
    border-top: 1px solid #eee;
    color: #FF9516;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none !important;
    transition: all 0.15s ease;
    border-radius: 0 0 4px 4px;
}

.st-searchbar-viewall:hover {
    background: #fff3eb;
    color: #E08014;
    text-decoration: none !important;
}

.st-searchbar-viewall svg {
    width: 16px;
    height: 16px;
    margin-left: 6px;
}

/* Highlight matched text */
.st-searchbar-highlight {
    background: #fef3c7;
    border-radius: 2px;
    padding: 0 2px;
}

/* Mobile styles */
@media (max-width: 768px) {
    .st-searchbar-wrapper {
        max-width: 100%;
    }

    .st-searchbar-input {
        height: 44px;
        font-size: 16px; /* Prevent zoom on iOS */
    }

    .st-searchbar-results {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        max-height: 70vh;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2);
    }

    .st-searchbar-item {
        padding: 14px;
    }

    .st-searchbar-item-img {
        width: 48px;
        height: 48px;
    }
}

/* Scrollbar styling */
.st-searchbar-results::-webkit-scrollbar {
    width: 6px;
}

.st-searchbar-results::-webkit-scrollbar-track {
    background: transparent;
}

.st-searchbar-results::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.st-searchbar-results::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Results header */
.st-searchbar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #f8f8f8;
    border-bottom: 1px solid #eee;
    border-radius: 4px 4px 0 0;
    font-size: 12px;
    color: #666;
}

.st-searchbar-header strong {
    color: #1e293b;
}
