/* ── Skrepysh AI Assistant ──────────────────────────────────────── */

.skrepysh {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 9999;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ── Toggle button ─────────────────────────────────────────────── */

.skrepysh__toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #c495ff;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 24px rgba(196, 149, 255, 0.35);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    z-index: 2;
}

.skrepysh__toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(196, 149, 255, 0.45);
}

.skrepysh__toggle:active {
    transform: scale(0.96);
}

.skrepysh__icon {
    width: 28px;
    height: 28px;
}

/* ── Speech bubble ─────────────────────────────────────────────── */

.skrepysh__bubble {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    width: 280px;
    background: #fff;
    border: 1px solid #e9d5ff;
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: 0 4px 24px rgba(196, 149, 255, 0.12);
    animation: skrepysh-slide-up 0.3s ease-out;
    z-index: 1;
}

.skrepysh__bubble[hidden] {
    display: none;
}

.skrepysh__bubble-close {
    position: absolute;
    top: 6px;
    right: 8px;
    background: none;
    border: none;
    font-size: 18px;
    color: #94a3b8;
    cursor: pointer;
    padding: 2px 6px;
    line-height: 1;
    transition: color 0.15s;
}

.skrepysh__bubble-close:hover {
    color: #475569;
}

.skrepysh__bubble-text {
    font-size: 14px;
    line-height: 1.5;
    color: #475569;
    margin-bottom: 10px;
    padding-right: 16px;
}

.skrepysh__bubble-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.skrepysh__bubble-action {
    display: inline-block;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    color: #c495ff;
    background: #f3e8ff;
    border: 1px solid #e9d5ff;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    font-family: inherit;
    line-height: 1.3;
}

.skrepysh__bubble-action:hover {
    background: #c495ff;
    color: #fff;
    border-color: #c495ff;
}

/* ── Chat panel ────────────────────────────────────────────────── */

.skrepysh__panel {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 360px;
    height: 520px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(196, 149, 255, 0.12);
    border: 1px solid #e9d5ff;
    display: flex;
    flex-direction: column;
    animation: skrepysh-scale-in 0.25s ease-out;
    z-index: 3;
}

.skrepysh__panel[hidden] {
    display: none;
}

/* Panel header */
.skrepysh__panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid #e9d5ff;
}

.skrepysh__panel-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.skrepysh__avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #c495ff;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.skrepysh__panel-title {
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
    display: block;
}

.skrepysh__panel-status {
    font-size: 11px;
    color: #22c55e;
    display: flex;
    align-items: center;
    gap: 4px;
}

.skrepysh__panel-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #22c55e;
    display: inline-block;
}

.skrepysh__panel-tg {
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    transition: color 0.15s, background 0.15s;
    text-decoration: none;
}

.skrepysh__panel-tg:hover {
    color: #229ED9;
    background: rgba(34, 158, 217, 0.08);
}

.skrepysh__panel-close {
    background: none;
    border: none;
    font-size: 20px;
    color: #94a3b8;
    cursor: pointer;
    padding: 2px 6px;
    line-height: 1;
    transition: color 0.15s;
}

.skrepysh__panel-close:hover {
    color: #475569;
}

/* Messages area */
.skrepysh__panel-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overscroll-behavior: contain;
}

.skrepysh__message {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.skrepysh__message--bot {
    align-self: flex-start;
    background: #f3e8ff;
    border: 1px solid #e9d5ff;
    color: #475569;
}

.skrepysh__message--bot strong {
    font-weight: 600;
    color: #1e293b;
}

.skrepysh__message--bot ul {
    margin: 6px 0 2px 0;
    padding-left: 18px;
    list-style: disc;
}

.skrepysh__message--bot li {
    margin-bottom: 2px;
}

.skrepysh__message--user {
    align-self: flex-end;
    background: #c495ff;
    color: #fff;
}

/* Typing indicator */
.skrepysh__typing {
    align-self: flex-start;
    padding: 10px 14px;
    background: #f3e8ff;
    border: 1px solid #e9d5ff;
    border-radius: 12px;
    display: flex;
    gap: 4px;
    align-items: center;
}

.skrepysh__typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #c495ff;
    animation: skrepysh-typing 1.2s infinite;
}

.skrepysh__typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.skrepysh__typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

/* Input area */
.skrepysh__panel-input {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #e9d5ff;
}

.skrepysh__panel-textarea {
    flex: 1;
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: #1e293b;
    resize: none;
    outline: none;
    line-height: 1.4;
    transition: border-color 0.15s;
}

.skrepysh__panel-textarea:focus {
    border-color: #c495ff;
}

.skrepysh__panel-textarea::placeholder {
    color: #94a3b8;
}

.skrepysh__panel-send {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #c495ff;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    flex-shrink: 0;
}

.skrepysh__panel-send:hover {
    background: #b07ef5;
}

.skrepysh__panel-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Footer */
.skrepysh__panel-footer {
    padding: 8px 16px;
    text-align: center;
    font-size: 11px;
    color: #94a3b8;
    border-top: 1px solid #f1f5f9;
}

.skrepysh__panel-footer a {
    color: #c495ff;
    text-decoration: none;
}

.skrepysh__panel-footer a:hover {
    text-decoration: underline;
}

/* ── Animations ────────────────────────────────────────────────── */

@keyframes skrepysh-slide-up {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes skrepysh-scale-in {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes skrepysh-typing {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    30% {
        opacity: 1;
        transform: scale(1);
    }
}

/* ── State classes (for future character) ───────────────────────── */

.skrepysh--thinking .skrepysh__toggle {
    animation: skrepysh-pulse 1.5s infinite;
}

@keyframes skrepysh-pulse {
    0%, 100% { box-shadow: 0 4px 24px rgba(196, 149, 255, 0.35); }
    50% { box-shadow: 0 4px 32px rgba(196, 149, 255, 0.55); }
}

/* ── Mobile responsive ─────────────────────────────────────────── */

@media (max-width: 768px) {
    .skrepysh {
        bottom: 16px;
        left: 16px;
    }

    .skrepysh__toggle {
        width: 48px;
        height: 48px;
    }

    .skrepysh__icon {
        width: 24px;
        height: 24px;
    }

    .skrepysh__bubble {
        width: calc(100vw - 32px);
        left: 0;
        bottom: calc(100% + 8px);
    }

    .skrepysh__panel {
        width: calc(100vw - 32px);
        height: 480px;
    }

    /* iOS zoom fix: font-size >= 16px prevents auto-zoom on focus */
    .skrepysh__panel-textarea,
    .skrepysh__lead-input {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .skrepysh__panel {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        overscroll-behavior: contain;
    }
}

/* ── Quick reply suggestions ─────────────────────────────────── */

.skrepysh__suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
    align-self: flex-start;
    max-width: 85%;
}

.skrepysh__suggestion {
    display: inline-block;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    color: #c495ff;
    background: #f3e8ff;
    border: 1px solid #e9d5ff;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    font-family: inherit;
    line-height: 1.3;
}

.skrepysh__suggestion:hover {
    background: #c495ff;
    color: #fff;
    border-color: #c495ff;
}

/* ── Action CTA button (WebApp) ──────────────────────────────── */

.skrepysh__action-btn {
    display: block;
    width: 85%;
    margin-top: 8px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: #c495ff;
    border: 2px solid #c495ff;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    text-align: center;
}

.skrepysh__action-btn:hover {
    background: #fff;
    color: #c495ff;
}

/* ── Lead capture ────────────────────────────────────────────── */

.skrepysh__lead-buttons,
.skrepysh__lead-form {
    background: #f3e8ff;
    border: 1px solid #e9d5ff;
    border-radius: 12px;
    padding: 14px;
    align-self: flex-start;
    max-width: 85%;
}

.skrepysh__lead-title {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 10px;
}

.skrepysh__lead-option {
    display: block;
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 500;
    color: #475569;
    background: #fff;
    border: 1px solid #e9d5ff;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    font-family: inherit;
    text-align: left;
    margin-bottom: 6px;
}

.skrepysh__lead-option:last-child {
    margin-bottom: 0;
}

.skrepysh__lead-option:hover {
    background: #c495ff;
    color: #fff;
    border-color: #c495ff;
}

.skrepysh__lead-input {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: #1e293b;
    outline: none;
    transition: border-color 0.15s;
    margin-bottom: 8px;
    box-sizing: border-box;
}

.skrepysh__lead-input:focus {
    border-color: #c495ff;
}

.skrepysh__lead-input::placeholder {
    color: #94a3b8;
}

.skrepysh__lead-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.skrepysh__lead-submit {
    flex: 1;
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: #c495ff;
    border: 2px solid #c495ff;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, color 0.15s;
}

.skrepysh__lead-submit:hover {
    background: #fff;
    color: #c495ff;
}

.skrepysh__lead-back {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 13px;
    cursor: pointer;
    text-decoration: underline;
    font-family: inherit;
    padding: 0;
}

.skrepysh__lead-back:hover {
    color: #475569;
}

.skrepysh__lead-success {
    font-size: 14px;
    line-height: 1.5;
    color: #475569;
}
