/**
 * VTB Multi-AI Assistant - Frontend Chat Stylesheet
 */

:root {
    --vtb-primary: #1e40af;
    --vtb-primary-hover: #1d4ed8;
    --vtb-bg-light: #f8fafc;
    --vtb-border: #e2e8f0;
    --vtb-text-dark: #0f172a;
    --vtb-text-muted: #64748b;
    --vtb-bubble-bot: #f1f5f9;
    --vtb-bubble-user: #1e40af;
    --vtb-price: #dc2626;
    --vtb-radius: 12px;
}

.vtb-chat-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #ffffff;
    border: 1px solid var(--vtb-border);
    border-radius: var(--vtb-radius);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    box-sizing: border-box;
}

.vtb-chat-container * {
    box-sizing: border-box;
}

.vtb-chat-inline {
    max-width: 580px;
    height: 520px;
    margin: 20px auto;
}

.vtb-chat-floating-wrap {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999999;
}

.vtb-chat-launcher {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--vtb-primary);
    color: #ffffff;
    border: none;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(30, 64, 175, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.2s;
}

.vtb-chat-launcher:hover {
    transform: scale(1.06);
    background: var(--vtb-primary-hover);
}

.vtb-chat-popup {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 380px;
    height: 540px;
    max-height: calc(100vh - 120px);
    z-index: 1000000;
}

.vtb-chat-header {
    background: var(--vtb-primary);
    color: #ffffff;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.vtb-chat-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.vtb-chat-title-box {
    flex-grow: 1;
}

.vtb-chat-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
}

.vtb-chat-subtitle {
    font-size: 11px;
    opacity: 0.85;
    margin-top: 2px;
}

.vtb-chat-close-btn {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 24px;
    cursor: pointer;
    opacity: 0.8;
    line-height: 1;
    padding: 0 4px;
}

.vtb-chat-close-btn:hover {
    opacity: 1;
}

.vtb-chat-messages {
    flex: 1 1 0;
    min-height: 0;
    min-width: 0;
    padding: 16px;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--vtb-bg-light);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.vtb-msg {
    display: flex;
    flex-direction: column;
    max-width: 86%;
    min-width: 0;
    flex-shrink: 0;
}

.vtb-msg-bot {
    align-self: flex-start;
}

.vtb-msg-user {
    align-self: flex-end;
}

.vtb-msg-bubble {
    padding: 10px 14px;
    white-space: pre-line;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.5;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.vtb-msg-bot .vtb-msg-bubble {
    background: var(--vtb-bubble-bot);
    color: var(--vtb-text-dark);
    border-bottom-left-radius: 3px;
    border: 1px solid #e2e8f0;
}

.vtb-msg-user .vtb-msg-bubble {
    background: var(--vtb-bubble-user);
    color: #ffffff;
    border-bottom-right-radius: 3px;
}

.vtb-msg-typing .vtb-msg-bubble {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
}

.vtb-dot {
    width: 6px;
    height: 6px;
    background: var(--vtb-text-muted);
    border-radius: 50%;
    animation: vtbBounce 1.4s infinite ease-in-out both;
}

.vtb-dot:nth-child(1) { animation-delay: -0.32s; }
.vtb-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes vtbBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

.vtb-product-recommendations {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
    min-width: 0;
    width: 100%;
}

.vtb-product-card {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--vtb-border);
    border-radius: 8px;
    padding: 8px 10px;
    gap: 10px;
    text-decoration: none !important;
    color: inherit !important;
    transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.vtb-product-card:hover {
    transform: translateY(-2px);
    border-color: var(--vtb-primary);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
}

.vtb-card-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
    background: #f1f5f9;
    flex-shrink: 0;
}

.vtb-card-info {
    flex-grow: 1;
    min-width: 0;
}

.vtb-card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--vtb-text-dark);
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.4;
}

.vtb-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 3px;
    flex-wrap: wrap;
}

.vtb-card-price {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--vtb-price);
}

.vtb-card-badge {
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 4px;
    background: #e2e8f0;
    color: #475569;
    white-space: nowrap;
    display: inline-block;
    line-height: 1.2;
}

.vtb-card-price {
    font-size: 13px;
    font-weight: 700;
    color: var(--vtb-price);
    white-space: nowrap;
}

.vtb-card-badge.in-stock {
    background: #dcfce7;
    color: #15803d;
}

.vtb-card-action {
    grid-column: 2;
    justify-self: start;
    font-size: 11px;
    font-weight: 600;
    color: var(--vtb-primary);
    white-space: nowrap;
    padding: 4px 8px;
    background: #eff6ff;
    border-radius: 4px;
}

.vtb-chat-suggestions {
    display: flex;
    gap: 6px;
    padding: 8px 16px;
    background: #ffffff;
    border-top: 1px solid var(--vtb-border);
    flex-wrap: wrap;
    flex-shrink: 0;
}

.vtb-chip {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 4px 10px;
    font-size: 11.5px;
    color: #334155;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}

.vtb-chip:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.vtb-chat-input-form {
    flex-shrink: 0;
    min-width: 0;
    display: flex;
    align-items: center;
    padding: 10px 14px;
    background: #ffffff;
    border-top: 1px solid var(--vtb-border);
    gap: 8px;
}

.vtb-chat-input {
    flex: 1 1 0;
    min-width: 0;
    width: 0;
    border: 1px solid var(--vtb-border);
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 13.5px;
    outline: none;
    transition: border-color 0.2s;
}

.vtb-chat-input:focus {
    border-color: var(--vtb-primary);
}

.vtb-chat-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--vtb-primary);
    color: #ffffff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
}

.vtb-chat-header,
.vtb-chat-footer-brand {
    flex-shrink: 0;
}

.vtb-chat-title-box {
    min-width: 0;
    overflow-wrap: anywhere;
}

.vtb-chat-avatar,
.vtb-chat-close-btn {
    flex-shrink: 0;
}

.vtb-chat-send-btn:hover {
    background: var(--vtb-primary-hover);
}

.vtb-chat-send-btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
}

.vtb-chat-footer-brand {
    font-size: 10px;
    text-align: center;
    color: var(--vtb-text-muted);
    padding: 4px;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
}

.vtb-chat-footer-brand a {
    color: var(--vtb-primary);
    text-decoration: none;
}

@media (max-width: 480px) {
    .vtb-chat-popup {
        bottom: 0;
        right: 0;
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
    }
}
