/* Chat widget */
.chat-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #102641;
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, background 0.2s ease;
}

.chat-toggle:hover {
    transform: scale(1.08);
    background: #22538e;
}

.chat-toggle__icon {
    width: 28px;
    height: 28px;
}

.chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #e74c3c;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}

.chat-window {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 380px;
    height: 520px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.chat-header {
    background: #102641;
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.chat-header__left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-title {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.chat-mode-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.chat-mode-badge.mode-ai {
    background: #27ae60;
    color: #fff;
}

.chat-mode-badge.mode-agent {
    background: #f39c12;
    color: #fff;
}

.chat-minimize {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 4px;
    opacity: 0.8;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
}

.chat-minimize:hover {
    opacity: 1;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f5f7fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #c0c6ce;
    border-radius: 3px;
}

.chat-msg {
    max-width: 85%;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-msg__label {
    font-size: 11px;
    color: #7f8c8d;
    font-weight: 600;
    padding: 0 4px;
}

.chat-msg__bubble {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.45;
    word-wrap: break-word;
}

.chat-msg__time {
    font-size: 10px;
    color: #95a5a6;
    padding: 0 4px;
}

.chat-msg--customer {
    align-self: flex-end;
}

.chat-msg--customer .chat-msg__label,
.chat-msg--customer .chat-msg__time {
    text-align: right;
}

.chat-msg--customer .chat-msg__bubble {
    background: #22538e;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-msg--ai,
.chat-msg--agent {
    align-self: flex-start;
}

.chat-msg--ai .chat-msg__bubble {
    background: #e8ecf1;
    color: #2c3e50;
    border-bottom-left-radius: 4px;
}

.chat-msg--agent .chat-msg__bubble {
    background: #d4e3f5;
    color: #1a3a5c;
    border-bottom-left-radius: 4px;
    border-left: 3px solid #22538e;
}

.chat-typing {
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f5f7fa;
    flex-shrink: 0;
}

.chat-typing__dots {
    display: flex;
    gap: 4px;
}

.chat-typing__dots span {
    width: 7px;
    height: 7px;
    background: #95a5a6;
    border-radius: 50%;
    animation: chatTypingBounce 1.4s infinite ease-in-out both;
}

.chat-typing__dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.chat-typing__dots span:nth-child(2) {
    animation-delay: -0.16s;
}

.chat-typing__dots span:nth-child(3) {
    animation-delay: 0s;
}

@keyframes chatTypingBounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.4;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.chat-typing__label {
    font-size: 12px;
    color: #95a5a6;
    font-style: italic;
}

.chat-input-area {
    border-top: 1px solid #e0e4e8;
    background: #fff;
    flex-shrink: 0;
}

.chat-actions {
    padding: 6px 12px 0;
    display: flex;
    gap: 8px;
}

.chat-action-btn,
.chat-end-btn {
    border: 1px solid #d0d5dc;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: background 0.2s, border-color 0.2s;
}

.chat-action-btn {
    background: none;
    color: #22538e;
}

.chat-action-btn:hover {
    background: #eef2f7;
    border-color: #22538e;
}

.chat-end-btn {
    background: none;
    color: #e74c3c;
}

.chat-end-btn:hover {
    background: #fde8e8;
    border-color: #e74c3c;
}

.chat-input-row {
    display: flex;
    align-items: center;
    padding: 8px 12px 12px;
    gap: 8px;
}

.chat-input {
    flex: 1;
    border: 1px solid #d0d5dc;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

.chat-input:focus {
    border-color: #22538e;
}

.chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #22538e;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

.chat-send-btn:hover {
    background: #102641;
}

.chat-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.chat-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 24px 16px 12px;
}

.chat-welcome__icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #102641;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.chat-welcome__title {
    font-size: 15px;
    font-weight: 700;
    color: #102641;
    margin-bottom: 4px;
}

.chat-welcome__sub {
    font-size: 13px;
    color: #5a6c7d;
    line-height: 1.5;
    margin-bottom: 16px;
}

.chat-welcome__prompt {
    font-size: 12px;
    color: #95a5a6;
    margin-bottom: 8px;
}

.chat-suggestions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    padding: 0 8px;
}

.chat-suggestion {
    background: #fff;
    border: 1px solid #d0d5dc;
    border-radius: 8px;
    padding: 9px 14px;
    font-size: 13px;
    color: #22538e;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s, border-color 0.15s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-suggestion:hover {
    background: #eef2f7;
    border-color: #22538e;
}

.chat-suggestion__icon {
    flex-shrink: 0;
    color: #22538e;
    opacity: 0.5;
}

.chat-transcript-prompt {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.97);
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
}

.chat-transcript-prompt__title {
    font-size: 15px;
    font-weight: 700;
    color: #102641;
    margin-bottom: 6px;
}

.chat-transcript-prompt__sub {
    font-size: 13px;
    color: #5a6c7d;
    margin-bottom: 16px;
    line-height: 1.4;
}

.chat-transcript-prompt__email {
    width: 100%;
    border: 1px solid #d0d5dc;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 14px;
    outline: none;
    margin-bottom: 12px;
    text-align: center;
    font-family: inherit;
}

.chat-transcript-prompt__email:focus {
    border-color: #22538e;
}

.chat-transcript-prompt__actions {
    display: flex;
    gap: 8px;
    width: 100%;
}

.chat-transcript-prompt__btn {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
}

.chat-transcript-prompt__btn--send {
    background: #22538e;
    color: #fff;
}

.chat-transcript-prompt__btn--skip {
    background: #f0f2f5;
    color: #5a6c7d;
}

.chat-ended {
    padding: 16px;
    text-align: center;
    color: #95a5a6;
    font-size: 13px;
    border-top: 1px solid #e0e4e8;
    background: #fafbfc;
}

.chat-ended__msg {
    margin-bottom: 8px;
}

.chat-ended__restart {
    background: #22538e;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.chat-support-card {
    background: #f5f7fa;
    border-radius: 10px;
    padding: 16px;
    margin: 4px 0;
    text-align: center;
    align-self: stretch;
    max-width: 100%;
}

.chat-support-card__icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fef3e2;
    color: #e67e22;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
}

.chat-support-card__title {
    font-size: 14px;
    font-weight: 700;
    color: #102641;
    margin-bottom: 4px;
}

.chat-support-card__sub {
    font-size: 12px;
    color: #5a6c7d;
    line-height: 1.4;
    margin-bottom: 14px;
}

.chat-support-card__options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-support-option {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 1px solid #e0e4e8;
    border-radius: 8px;
    padding: 10px 14px;
    text-decoration: none;
    color: #2c3e50;
    font-size: 13px;
    transition: border-color 0.15s, background 0.15s;
    cursor: pointer;
}

.chat-support-option:hover {
    border-color: #22538e;
    background: #eef2f7;
}

.chat-support-option__icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}

.chat-support-option__icon--email {
    background: #e8f0fe;
    color: #22538e;
}

.chat-support-option__icon--phone {
    background: #e8f8ef;
    color: #27ae60;
}

.chat-support-option__text {
    text-align: left;
}

.chat-support-option__label {
    font-weight: 600;
    font-size: 13px;
    color: #102641;
}

.chat-support-option__value {
    font-size: 12px;
    color: #22538e;
}

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

    .chat-toggle {
        bottom: 16px;
        right: 16px;
        width: 52px;
        height: 52px;
    }
}
