@import url('https://fonts.googleapis.com/css2?family=Lora:wght@400;600;700&family=Poppins:wght@400;500;600&family=Roboto:wght@400;500&display=swap');

.tf-support-widget {
    --tf-shadow: 0 18px 48px rgba(0, 37, 84, 0.18);
    position: fixed;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    right: 1rem;
    bottom: 0.5rem;
    z-index: 9999;
    font-family: 'Poppins', sans-serif;
    color: #111a26;
}

@media (min-width: 641px) {
    .tf-support-widget {
        right: 1rem;
        bottom: 0.5rem;
    }
}

.tf-support-launcher {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    border: 1px solid #002554;
    border-radius: 999px;
    padding: 0.85rem 1.05rem;
    background: linear-gradient(135deg, #002554 0%, #1a365d 100%);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 0 0 2px #ffffff, var(--tf-shadow);
    cursor: pointer;
}

.tf-support-launcher:hover {
    transform: translateY(-1px);
}

.tf-support-launcher:focus-visible,
.tf-support-close:focus-visible,
.tf-support-send:focus-visible,
.tf-support-chip:focus-visible,
.tf-support-contact button:focus-visible,
.tf-support-contact input:focus-visible,
.tf-support-contact textarea:focus-visible {
    outline: 3px solid rgba(167, 222, 245, 0.85);
    outline-offset: 2px;
}

.tf-support-panel {
    width: min(420px, calc(100vw - 2rem));
    max-height: min(82vh, 760px);
    display: none;
    flex-direction: column;
    overflow: hidden;
    margin-bottom: 0.75rem;
    border: 1px solid rgba(0, 37, 84, 0.14);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: var(--tf-shadow);
    backdrop-filter: blur(10px);
}

.tf-support-panel.open {
    display: flex;
}

.tf-support-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1rem 0.85rem;
    background: linear-gradient(135deg, #f6f9fd 0%, #eaf2fb 100%);
    border-bottom: 1px solid rgba(0, 37, 84, 0.08);
}

.tf-support-title {
    margin: 0;
    font-family: 'Lora', serif;
    font-size: 1.2rem;
    color: #002554;
}

.tf-support-subtitle {
    margin: 0.3rem 0 0;
    font-size: 0.92rem;
    line-height: 1.5;
    color: #33465c;
}

.tf-support-close {
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #1a365d;
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    padding: 0.15rem 0.35rem;
}

.tf-support-body {
    display: grid;
    gap: 0.9rem;
    padding: 1rem;
    overflow-y: auto;
}

.tf-support-context {
    border: 1px solid rgba(0, 37, 84, 0.12);
    border-radius: 16px;
    padding: 0.9rem;
    background: #f8fbff;
}

.tf-support-context h3,
.tf-support-contact h3 {
    margin: 0 0 0.45rem;
    font-size: 1rem;
    color: #002554;
}

.tf-support-context p,
.tf-support-contact p {
    margin: 0;
    color: #33465c;
    line-height: 1.5;
}

.tf-support-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tf-support-chip {
    border: 1px solid #c8d7e9;
    border-radius: 999px;
    background: #ffffff;
    color: #002554;
    padding: 0.45rem 0.7rem;
    font-size: 0.85rem;
    cursor: pointer;
}

.tf-support-chat {
    display: grid;
    gap: 0.7rem;
}

.tf-support-messages {
    display: grid;
    gap: 0.65rem;
    max-height: 240px;
    overflow: auto;
    padding-right: 0.2rem;
}

.tf-message {
    max-width: 92%;
    border-radius: 16px;
    padding: 0.75rem 0.85rem;
    line-height: 1.45;
    font-size: 0.93rem;
}

.tf-message.user {
    margin-left: auto;
    background: #002554;
    color: #ffffff;
}

.tf-message.assistant {
    background: #edf5ff;
    color: #102235;
    border: 1px solid rgba(0, 37, 84, 0.08);
}

.tf-support-input-row {
    display: flex;
    gap: 0.55rem;
}

.tf-support-input-row input {
    flex: 1;
    border: 1px solid #c8d7e9;
    border-radius: 12px;
    padding: 0.82rem 0.9rem;
    font: inherit;
}

.tf-support-send,
.tf-support-contact button {
    border: 1px solid #002554;
    border-radius: 12px;
    background: #a7def5;
    color: #002554;
    padding: 0.82rem 1rem;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.tf-support-toggle-link {
    border: 0;
    background: transparent;
    color: #1a365d;
    font: inherit;
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
}

.tf-support-contact {
    display: none;
    gap: 0.7rem;
    border: 1px solid rgba(0, 37, 84, 0.12);
    border-radius: 16px;
    padding: 0.9rem;
    background: #fbfdff;
}

.tf-support-contact.open {
    display: grid;
}

.tf-support-contact label {
    display: grid;
    gap: 0.35rem;
    font-size: 0.9rem;
    color: #102235;
}

.tf-support-contact input,
.tf-support-contact textarea {
    border: 1px solid #c8d7e9;
    border-radius: 12px;
    padding: 0.72rem 0.8rem;
    font: inherit;
    color: #111a26;
    background: #ffffff;
}

.tf-support-contact textarea {
    min-height: 112px;
    resize: vertical;
}

.tf-support-footnote {
    margin: 0;
    font-size: 0.82rem;
    color: #51657a;
}

@media (max-width: 640px) {
    .tf-support-widget {
        right: 0.75rem;
        left: auto;
        bottom: 0.75rem;
    }

    .tf-support-panel {
        width: min(420px, calc(100vw - 1.5rem));
        max-height: 74vh;
    }

    .tf-support-input-row {
        flex-direction: column;
    }

    .tf-support-send,
    .tf-support-contact button,
    .tf-support-input-row input {
        width: 100%;
    }
}
