/* ===========================================
   IVI Mobile Tabbar v2 — Glassmorphism UI
   =========================================== */

/* Скрыть на десктопе */
.ivi-tb { display: none; }

@media only screen and (max-width: 767px) {

/* --- CSS Variables --- */
:root {
    --ivi-bar-h: 60px;
    --ivi-glass-bg: rgba(255, 255, 255, 0.88);
    --ivi-glass-border: rgba(0, 0, 0, 0.06);
    --ivi-glass-blur: 20px;
    --ivi-modal-bg: rgba(255, 255, 255, 0.92);
    --ivi-text: #1a1a1a;
    --ivi-text-muted: #888;
    --ivi-accent: #e8344e;
    --ivi-shadow: 0 -1px 20px rgba(0, 0, 0, 0.06);
    --ivi-shadow-modal: 0 -4px 40px rgba(0, 0, 0, 0.15);
    --ivi-radius: 20px;
    --ivi-radius-sm: 14px;
    --ivi-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --ivi-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
}

.ivi-tb {
    display: block;
    position: relative;
    z-index: 99999;
    font-family: var(--ivi-font);
    -webkit-font-smoothing: antialiased;
}

/* Скрываем старый таб-бар */
.phone-tab-only,
.mobile-only:not(#ivi-tabbar) {
    display: none !important;
}

/* Отступ снизу для контента */
body {
    padding-bottom: calc(var(--ivi-bar-h) + 10px) !important;
}

/* ========== НИЖНЯЯ ПАНЕЛЬ ========== */

.ivi-tb__bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--ivi-bar-h);
    display: grid;
    grid-template-columns: 1fr 1fr 60px 1fr 1fr;
    align-items: center;
    background: var(--ivi-glass-bg);
    backdrop-filter: blur(var(--ivi-glass-blur)) saturate(1.8);
    -webkit-backdrop-filter: blur(var(--ivi-glass-blur)) saturate(1.8);
    border-top: 1px solid var(--ivi-glass-border);
    box-shadow: var(--ivi-shadow);
    padding: 0 2px;
    z-index: 100000;
}

/* --- Элемент --- */

.ivi-tb__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-decoration: none;
    color: var(--ivi-text-muted);
    -webkit-tap-highlight-color: transparent;
    transition: color 0.2s;
    padding: 8px 0 4px;
    position: relative;
}

.ivi-tb__item:active {
    color: var(--ivi-accent);
}

.ivi-tb__icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.ivi-tb__label {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.01em;
    line-height: 1;
    white-space: nowrap;
}

/* --- Бейдж --- */

.ivi-tb__badge-wrap {
    position: relative;
    display: inline-flex;
}

.ivi-tb__badge {
    position: absolute;
    top: -5px;
    right: -9px;
    min-width: 17px;
    height: 17px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--ivi-accent);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(232, 52, 78, 0.35);
    font-family: var(--ivi-font);
}

/* --- Центральная кнопка --- */

.ivi-tb__center {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(145deg, #06a5bb, #00ddff);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(6, 165, 187, 0.45);
    transform: translateY(-14px);
    transition: transform var(--ivi-transition), box-shadow var(--ivi-transition);
    -webkit-tap-highlight-color: transparent;
    position: relative;
    z-index: 2;
}

.ivi-tb__center:active {
    transform: translateY(-14px) scale(0.92);
    box-shadow: 0 2px 10px rgba(6, 165, 187, 0.35);
}

.ivi-tb__center.is-open .ivi-tb__plus {
    transform: rotate(45deg);
}

.ivi-tb__plus {
    width: 24px;
    height: 24px;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ========== OVERLAY ========== */

.ivi-tb__overlay {
    position: fixed;
    inset: 0;
    z-index: 99998;
    background: rgba(0, 0, 0, 0);
    pointer-events: none;
    transition: background 0.35s;
}

.ivi-tb__overlay.is-open {
    background: rgba(0, 0, 0, 0.35);
    pointer-events: auto;
}

/* ========== МОДАЛКА (glassmorphism) ========== */

.ivi-tb__modal {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 84vh;
    background: var(--ivi-modal-bg);
    backdrop-filter: blur(30px) saturate(1.6);
    -webkit-backdrop-filter: blur(30px) saturate(1.6);
    border-top: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: var(--ivi-radius) var(--ivi-radius) 0 0;
    box-shadow: var(--ivi-shadow-modal);
    padding: 0 16px 90px;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    transform: translateY(105%);
    transition: transform 0.42s cubic-bezier(0.32, 0.72, 0, 1);
    z-index: 99999;
}

.ivi-tb__modal::-webkit-scrollbar { width: 0; }

.ivi-tb__overlay.is-open .ivi-tb__modal {
    transform: translateY(0);
}

/* --- Header --- */

.ivi-tb__modal-header {
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0 14px;
    margin: 0 -16px;
    padding-left: 16px;
    padding-right: 16px;
    z-index: 2;
}

.ivi-tb__modal-header::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: rgba(0, 0, 0, 0.1);
}

.ivi-tb__modal-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--ivi-text);
    margin: 0;
    letter-spacing: -0.03em;
}

.ivi-tb__modal-close {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.2s;
}

.ivi-tb__modal-close svg {
    width: 22px;
    height: 22px;
    color: #1a1a1a;
    stroke-width: 2.4;
}

.ivi-tb__modal-close:active {
    background: rgba(0, 0, 0, 0.18);
}

/* --- Navigation (back / go) --- */

.ivi-tb__modal-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

.ivi-tb__btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--ivi-font);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.15s, opacity 0.15s;
}

.ivi-tb__btn:active { transform: scale(0.95); }

.ivi-tb__btn svg {
    width: 16px;
    height: 16px;
}

.ivi-tb__btn--back {
    background: rgba(0, 0, 0, 0.06);
    color: var(--ivi-text);
}

.ivi-tb__btn--go {
    background: var(--ivi-accent);
    color: #fff;
    margin-left: auto;
    box-shadow: 0 2px 8px rgba(232, 52, 78, 0.25);
}

/* --- Поиск --- */

.ivi-tb__search {
    margin-bottom: 14px;
}

.ivi-tb__search form {
    display: flex;
    border-radius: 14px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.ivi-tb__search .search-field {
    flex: 1;
    padding: 11px 16px;
    border: none;
    background: transparent;
    font-size: 15px;
    font-family: var(--ivi-font);
    color: var(--ivi-text);
    outline: none;
}

.ivi-tb__search .search-field::placeholder {
    color: #aaa;
}

.ivi-tb__search form button {
    padding: 11px 18px;
    border: none;
    background: var(--ivi-accent);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    font-family: var(--ivi-font);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: opacity 0.2s;
}

.ivi-tb__search form button:active {
    opacity: 0.8;
}

/* ========== СЕТКА КАТЕГОРИЙ ========== */

.ivi-tb__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding-bottom: 10px;
    animation: iviFadeUp 0.3s ease both;
}

@keyframes iviFadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.ivi-tb__cat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 14px 6px 12px;
    border-radius: var(--ivi-radius-sm);
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    text-decoration: none;
    color: var(--ivi-text);
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.15s, box-shadow 0.15s;
}

.ivi-tb__cat:active {
    transform: scale(0.96);
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.06);
}

.ivi-tb__cat-img {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    object-fit: cover;
    background: #f5f5f7;
}

.ivi-tb__cat-placeholder {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background: #f5f5f7;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ivi-tb__cat-placeholder svg {
    width: 24px;
    height: 24px;
    color: #bbb;
}

.ivi-tb__cat-name {
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    line-height: 1.3;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* --- Loader --- */

.ivi-tb__loader {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.ivi-tb__spinner {
    width: 28px;
    height: 28px;
    border: 2.5px solid rgba(0, 0, 0, 0.08);
    border-top-color: var(--ivi-accent);
    border-radius: 50%;
    animation: iviSpin 0.65s linear infinite;
}

@keyframes iviSpin {
    to { transform: rotate(360deg); }
}

/* ========== КОНТАКТЫ ========== */

.ivi-tb__modal--contact {
    max-height: 55vh;
    padding-bottom: 30px;
}

.ivi-tb__contacts {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ivi-tb__contact-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: var(--ivi-radius-sm);
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
    text-decoration: none;
    color: var(--ivi-text);
    font-size: 15px;
    font-weight: 500;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.15s, background 0.15s;
}

.ivi-tb__contact-item:active {
    transform: scale(0.98);
    background: #f8f8f8;
}

.ivi-tb__contact-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ivi-tb__contact-icon svg {
    width: 20px;
    height: 20px;
}

.ivi-tb__contact-icon--phone {
    background: rgba(52, 199, 89, 0.1);
    color: #34c759;
}

.ivi-tb__contact-icon--callback {
    background: rgba(0, 122, 255, 0.1);
    color: #007aff;
}

.ivi-tb__contact-icon--wa {
    background: rgba(37, 211, 102, 0.1);
    color: #25d366;
}

.ivi-tb__contact-icon--ig {
    background: linear-gradient(135deg, rgba(131, 58, 180, 0.1), rgba(253, 29, 29, 0.1));
    color: #e1306c;
}

} /* end @media */

/* ========== Скрываем старую плавающую кнопку ========== */
.btn-pluss-wrapper {
    display: none !important;
}

/* ========== ПЛАВАЮЩАЯ КНОПКА (только десктоп) ========== */

.ivi-float {
    position: fixed;
    right: 24px;
    bottom: 32px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
}

@media only screen and (max-width: 767px) {
    .ivi-float { display: none !important; }
}

.ivi-float__tooltip {
    position: relative;
    padding: 6px 14px;
    border-radius: 8px;
    width: max-content;
    margin: 0 auto 12px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    background: #fff;
    color: #e8344e;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    pointer-events: none;
    animation: iviFloatBounce 2.5s ease-in-out infinite;
}

.ivi-float__tooltip::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 10px;
    height: 10px;
    background: #fff;
}

@keyframes iviFloatBounce {
    0%, 100% { transform: translateY(2px); }
    50% { transform: translateY(-10px); }
}

.ivi-float__btn {
    position: relative;
    width: 52px;
    height: 52px;
    margin: 0 auto;
    border-radius: 26px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(16px) saturate(1.6);
    -webkit-backdrop-filter: blur(16px) saturate(1.6);
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    cursor: pointer;
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                border-radius 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.ivi-float__trigger {
    position: absolute;
    top: 0;
    left: 0;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(145deg, #06a5bb, #00ddff);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    cursor: pointer;
    box-shadow: 0 3px 14px rgba(232, 52, 78, 0.35);
}

.ivi-float__trigger svg {
    width: 22px;
    height: 22px;
    stroke: #fff;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ivi-float__list {
    list-style: none;
    margin: 0;
    padding: 60px 0 8px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s 0.1s;
}

.ivi-float__list li {
    overflow: hidden;
    height: 0;
    transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ivi-float__list li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: #1a1a1a;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    border-radius: 8px;
    transition: background 0.2s;
}

.ivi-float__list li a:hover {
    background: rgba(232, 52, 78, 0.06);
    color: #e8344e;
}

.ivi-float__list li a svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: #888;
}

.ivi-float__list li a:hover svg {
    color: #e8344e;
}

/* Открытое состояние */

.ivi-float.is-open .ivi-float__tooltip {
    animation: none;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.ivi-float.is-open .ivi-float__btn {
    width: 240px;
    height: auto;
    border-radius: 16px;
}

.ivi-float.is-open .ivi-float__trigger svg {
    transform: rotate(45deg);
}

.ivi-float.is-open .ivi-float__list {
    opacity: 1;
    pointer-events: auto;
}

.ivi-float.is-open .ivi-float__list li {
    height: 42px;
}