/* Floating Woo Search — frontend styles */

:root {
    --fws-color: #7c3aed;
    --fws-icon-color: #ffffff;
}

/* --- Плавающая кнопка --- */
.fws-wrap {
    position: fixed;
    z-index: 99998;
}
.fws-pos-bottom-right { right: 24px; bottom: 24px; }
.fws-pos-bottom-left  { left: 24px;  bottom: 24px; }
.fws-pos-top-right    { right: 24px; top: 24px; }
.fws-pos-top-left     { left: 24px;  top: 24px; }

.fws-wrap .fws-toggle {
    box-sizing: border-box !important;
    width: 56px !important;
    height: 56px !important;
    min-width: 56px !important;
    min-height: 56px !important;
    max-width: 56px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 50% !important;
    background: var(--fws-color) !important;
    color: var(--fws-icon-color) !important;
    cursor: pointer;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    text-align: center;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    -webkit-appearance: none;
    appearance: none;
    overflow: hidden;
}
.fws-wrap .fws-toggle svg {
    display: block !important;
    width: 24px !important;
    height: 24px !important;
    margin: 0 !important;
    flex: 0 0 auto;
}
.fws-wrap .fws-toggle:hover {
    transform: scale(1.06);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
}
.fws-wrap .fws-toggle:active { transform: scale(0.98); }
.fws-wrap .fws-toggle:focus-visible { outline: 3px solid rgba(250, 80, 93, 0.5); outline-offset: 2px; }

/* --- Оверлей --- */
.fws-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 12vh 16px 16px;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.fws-overlay.fws-open {
    opacity: 1;
}
.fws-overlay[hidden] { display: none; }

.fws-modal {
    width: 100%;
    max-width: 560px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    transform: translateY(-10px);
    transition: transform 0.2s ease;
}
.fws-overlay.fws-open .fws-modal { transform: translateY(0); }

/* --- Поисковая строка --- */
.fws-search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid #eef0f4;
}
.fws-search-icon { color: #94a3b8; flex: 0 0 auto; }
.fws-input {
    flex: 1 1 auto;
    border: none;
    outline: none;
    font-size: 16px;
    background: transparent;
    color: #0f172a;
    padding: 6px 0;
}
.fws-close {
    border: none;
    background: transparent;
    font-size: 26px;
    line-height: 1;
    color: #94a3b8;
    cursor: pointer;
    padding: 0 4px;
}
.fws-close:hover { color: #0f172a; }

/* --- Результаты --- */
.fws-results {
    max-height: 60vh;
    overflow-y: auto;
}
.fws-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.12s ease;
}
.fws-item:last-child { border-bottom: none; }
.fws-item:hover,
.fws-item.fws-active {
    background: #f8fafc;
}
.fws-item-link {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1 1 auto;
    min-width: 0;
    text-decoration: none;
    color: #0f172a;
}
.fws-item-link.fws-noclick {
    cursor: default;
    -webkit-user-select: none;
    user-select: none;
}
.fws-item img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 8px;
    flex: 0 0 auto;
    background: #f1f5f9;
}
.fws-item-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.fws-item-title {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fws-item-price {
    display: block;
    font-size: 13px;
    color: var(--fws-color);
    font-weight: 600;
}

/* Кнопка «В корзину» / «Выбрать» */
.fws-add {
    flex: 0 0 auto;
    border: none;
    background: var(--fws-color);
    color: #fff;
    border-radius: 999px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    transition: opacity 0.15s ease, background 0.15s ease;
}
.fws-add:hover { opacity: 0.9; }
.fws-add[disabled] { opacity: 0.65; cursor: default; }
.fws-add.fws-added { background: #16a34a; opacity: 1; }

.fws-message {
    padding: 22px 16px;
    text-align: center;
    color: #64748b;
    font-size: 14px;
}

.fws-loader {
    padding: 22px 16px;
    text-align: center;
}
.fws-loader::after {
    content: "";
    display: inline-block;
    width: 22px;
    height: 22px;
    border: 3px solid #e2e8f0;
    border-top-color: var(--fws-color);
    border-radius: 50%;
    animation: fws-spin 0.7s linear infinite;
}
@keyframes fws-spin { to { transform: rotate(360deg); } }

@media (max-width: 480px) {
    .fws-overlay { padding-top: 8vh; }
    .fws-toggle { width: 52px; height: 52px; }
    .fws-add { padding: 7px 12px; font-size: 12px; }
    .fws-item { gap: 8px; padding: 10px 12px; }
}
