/* =========================================================================
   Чат-бот skvazhinspb — виджет (v1)
   Префикс .skvcb — изолированный namespace, чтобы не конфликтовать с темой.
   ========================================================================= */

.skvcb, .skvcb * { box-sizing: border-box; }

.skvcb {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 2147483600;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    color: #1f2937;
}

/* ========== Кнопка ========== */
.skvcb__btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 6px 24px rgba(37, 99, 235, 0.35);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.skvcb__btn:hover { transform: scale(1.06); box-shadow: 0 8px 28px rgba(37, 99, 235, 0.5); }
.skvcb__btn:active { transform: scale(0.98); }
.skvcb__btn-icon { width: 28px; height: 28px; }
.skvcb__btn--hidden { opacity: 0; pointer-events: none; transform: scale(0.5); }

/* Пульсация при появлении (только для круглой кнопки) */
.skvcb--bubble .skvcb__btn::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.5);
    animation: skvcb-pulse 2s infinite;
}
@keyframes skvcb-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.45); }
    70%  { box-shadow: 0 0 0 18px rgba(37, 99, 235, 0); }
    100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

/* ========== Плашка (стиль «Jivo bar») ========== */
.skvcb__bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px 10px 10px;
    background: #fff;
    border: none;
    border-radius: 40px;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.18);
    cursor: pointer;
    font-family: inherit;
    color: #1f2937;
    max-width: 300px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    /* лёгкий «вдох» — привлекает внимание без раздражения */
    animation: skvcb-bar-in 0.35s ease both;
}
@keyframes skvcb-bar-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
.skvcb__bar:hover  { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(15, 23, 42, 0.22); }
.skvcb__bar:active { transform: translateY(0); }
.skvcb__bar--hidden { opacity: 0; pointer-events: none; transform: scale(0.9) translateY(10px); }

.skvcb__bar-avatar {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.skvcb__bar-avatar svg { width: 22px; height: 22px; }
/* Зелёная точка «онлайн» — как у Jivo */
.skvcb__bar-dot {
    position: absolute;
    right: 1px;
    bottom: 1px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #22c55e;
    border: 2px solid #fff;
    animation: skvcb-bar-dot 2s infinite;
}
@keyframes skvcb-bar-dot {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
    50%      { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0);   }
}

.skvcb__bar-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.2;
    text-align: left;
    min-width: 0;
}
.skvcb__bar-title {
    font-weight: 600;
    font-size: 14px;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 170px;
}
.skvcb__bar-sub {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 170px;
}
.skvcb__bar-arrow {
    display: flex;
    align-items: center;
    color: #9ca3af;
    flex-shrink: 0;
}
.skvcb__bar-arrow svg { width: 16px; height: 16px; }

/* ========== Всплывающая подсказка ========== */
.skvcb__tip {
    position: absolute;
    right: 76px;
    bottom: 8px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 10px 32px 10px 14px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    font-size: 13px;
    color: #1f2937;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(10px);
    pointer-events: none;
    transition: all 0.3s ease;
}
.skvcb__tip--show { opacity: 1; transform: translateX(0); pointer-events: auto; }
.skvcb__tip::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid #fff;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
}
.skvcb__tip-close {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    color: #9ca3af;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 0;
}
.skvcb__tip-close:hover { color: #1f2937; }

/* ========== Панель (окно чата) ========== */
.skvcb__panel {
    position: absolute;
    right: 0;
    bottom: 76px;
    width: 360px;
    max-width: calc(100vw - 48px);
    max-height: calc(100vh - 100px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transform-origin: bottom right;
    transition: all 0.25s ease;
}
/* У плашки высота ~64px, даём чуть больше зазор */
.skvcb--bar .skvcb__panel { bottom: 84px; }
.skvcb__panel[hidden] { display: none; }
.skvcb__panel--open { opacity: 1; transform: translateY(0) scale(1); }

/* Шапка */
.skvcb__head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #fff;
}
.skvcb__head-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.skvcb__head-avatar svg { width: 22px; height: 22px; color: #fff; }
.skvcb__head-info { flex: 1; min-width: 0; }
.skvcb__head-title { font-weight: 600; font-size: 15px; }
.skvcb__head-status { font-size: 12px; opacity: 0.9; display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.skvcb__dot {
    width: 8px; height: 8px; border-radius: 50%; background: #4ade80;
    box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.3);
    display: inline-block;
}
.skvcb__close {
    background: transparent; border: none; color: #fff;
    font-size: 26px; line-height: 1; cursor: pointer; padding: 0;
    width: 30px; height: 30px; opacity: 0.8;
}
.skvcb__close:hover { opacity: 1; }

/* Тело */
.skvcb__body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f9fafb;
    min-height: 280px;
    max-height: 420px;
}

/* Сообщения */
.skvcb__msg { margin-bottom: 12px; display: flex; }
.skvcb__msg--bot { justify-content: flex-start; }
.skvcb__msg--user { justify-content: flex-end; }
.skvcb__bubble {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}
.skvcb__msg--bot .skvcb__bubble {
    background: #fff;
    border: 1px solid #e5e7eb;
    color: #1f2937;
    border-top-left-radius: 4px;
}
.skvcb__msg--user .skvcb__bubble {
    background: #2563eb;
    color: #fff;
    border-top-right-radius: 4px;
}

/* Меню кнопок */
.skvcb__menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}
.skvcb__menu-btn {
    padding: 12px 14px;
    background: #fff;
    border: 1px solid #dbeafe;
    border-radius: 10px;
    color: #1e40af;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s;
}
.skvcb__menu-btn:hover {
    background: #eff6ff;
    border-color: #2563eb;
    transform: translateX(2px);
}

/* Форма */
.skvcb__form {
    padding: 4px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.skvcb__form-title {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 4px;
}
.skvcb__input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    color: #1f2937;
    outline: none;
    font-family: inherit;
}
.skvcb__input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.skvcb__textarea { resize: vertical; min-height: 60px; }
.skvcb__hp { position: absolute !important; left: -9999px; top: -9999px; opacity: 0; height: 0; width: 0; }
.skvcb__submit {
    padding: 12px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.skvcb__submit:hover { background: #1d4ed8; }
.skvcb__submit:disabled { background: #9ca3af; cursor: not-allowed; }
.skvcb__form-agree {
    font-size: 11px;
    color: #9ca3af;
    text-align: center;
    line-height: 1.4;
}
.skvcb__form-agree a { color: #6b7280; text-decoration: underline; }

/* Экран "успех" */
.skvcb__success {
    text-align: center;
    padding: 30px 20px;
}
.skvcb__success-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 12px;
}
.skvcb__success-msg {
    font-size: 15px;
    color: #1f2937;
    margin-bottom: 16px;
    font-weight: 500;
}
.skvcb__success-btn {
    padding: 10px 24px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #1f2937;
}
.skvcb__success-btn:hover { background: #e5e7eb; }

/* Ошибка */
.skvcb__error {
    padding: 10px 12px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    border-radius: 8px;
    font-size: 13px;
    margin-top: 6px;
}

/* Мобилка */
@media (max-width: 480px) {
    .skvcb { right: 16px; bottom: 16px; }
    .skvcb__panel {
        right: -10px;
        width: calc(100vw - 12px);
        max-height: calc(100vh - 90px);
        border-radius: 16px 16px 0 0;
    }
    .skvcb__body { max-height: calc(100vh - 220px); }
    .skvcb__tip { right: 72px; font-size: 12px; }

    /* Плашка на мобилке: без подзаголовка, чтобы не занимать место */
    .skvcb__bar { padding: 8px 14px 8px 8px; max-width: none; gap: 10px; }
    .skvcb__bar-avatar { width: 38px; height: 38px; }
    .skvcb__bar-avatar svg { width: 19px; height: 19px; }
    .skvcb__bar-title { font-size: 13px; max-width: 140px; }
    .skvcb__bar-sub   { display: none; }
    .skvcb--bar .skvcb__panel { bottom: 72px; }
}
