/* Chat Widget Styles */

.chat-widget-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    font-family: 'Outfit', sans-serif;
}

.chat-widget-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--accent, #4ade80);
    color: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: none;
    font-size: 24px;
}

.chat-widget-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.chat-widget-panel {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 370px;
    height: 520px;
    max-height: calc(100vh - 100px);
    background: rgba(20, 20, 24, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 16px 64px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px) scale(0.96);
    transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.chat-widget-panel.open {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0) scale(1);
}

.chat-widget-panel.open + .chat-widget-button {
    opacity: 0;
    pointer-events: none;
    transform: scale(0);
}

.chat-widget-header {
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-widget-title {
    font-weight: 600;
    color: #fff;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
}

.chat-widget-title span {
    color: var(--accent, #4ade80);
}

.chat-widget-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    font-size: 22px;
    padding: 4px;
    transition: color 0.2s;
    line-height: 1;
}

.chat-widget-close:hover {
    color: #fff;
}

/* ── Tabs ────────────────────────────────────────── */
.chat-widget-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding: 0;
}

.chat-tab-btn {
    flex: 1;
    padding: 10px 12px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.45);
    font-size: 12.5px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: color 0.2s, background 0.2s;
    position: relative;
    letter-spacing: 0.01em;
}

.chat-tab-btn:hover {
    color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.03);
}

.chat-tab-btn.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.chat-tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    width: 60%;
    height: 2px;
    background: var(--accent, #4ade80);
    border-radius: 2px 2px 0 0;
}

/* ── Tab Content ─────────────────────────────────── */
.chat-widget-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-tab-content {
    display: none;
    flex: 1;
    flex-direction: column;
    overflow: hidden;
}

.chat-tab-content.active {
    display: flex;
}

/* ── Messages (Coach Ted) ────────────────────────── */
.chat-widget-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-message {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 16px;
    line-height: 1.45;
    font-size: 13.5px;
    word-wrap: break-word;
    animation: msgAppear 0.25s ease-out;
}

@keyframes msgAppear {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-message.bot {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.08);
    color: #e0e0e0;
    border-bottom-left-radius: 4px;
}

.chat-message.user {
    align-self: flex-end;
    background: var(--accent, #4ade80);
    color: #111;
    border-bottom-right-radius: 4px;
    font-weight: 500;
}

/* Chat Message HTML Element Styling */
.chat-message p,
.support-msg-text p {
    margin: 0 0 10px 0;
    line-height: 1.5;
}

.chat-message p:last-child,
.support-msg-text p:last-child {
    margin-bottom: 0;
}

.chat-message a,
.support-msg-text a {
    color: var(--accent, #4ade80);
    text-decoration: underline;
    font-weight: 500;
    transition: opacity 0.2s;
}

.chat-message a:hover,
.support-msg-text a:hover {
    opacity: 0.85;
}

.chat-message ul,
.support-msg-text ul,
.chat-message ol,
.support-msg-text ol {
    margin: 8px 0;
    padding-left: 20px;
}

.chat-message ul,
.support-msg-text ul {
    list-style-type: disc;
}

.chat-message ol,
.support-msg-text ol {
    list-style-type: decimal;
}

.chat-message li,
.support-msg-text li {
    margin-bottom: 5px;
    line-height: 1.45;
}

.chat-message li:last-child,
.support-msg-text li:last-child {
    margin-bottom: 0;
}

/* ── Input Area ──────────────────────────────────── */
.chat-widget-input-area {
    padding: 12px 14px;
    background: rgba(0, 0, 0, 0.25);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    gap: 8px;
    align-items: center;
}

.chat-widget-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #fff;
    padding: 10px 16px;
    border-radius: 22px;
    outline: none;
    font-family: inherit;
    font-size: 13.5px;
    transition: border-color 0.2s, background 0.2s;
}

.chat-widget-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.chat-widget-input:focus {
    border-color: var(--accent, #4ade80);
    background: rgba(255, 255, 255, 0.08);
}

.chat-widget-send {
    background: var(--accent, #4ade80);
    color: #111;
    border: none;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s, opacity 0.2s;
    flex-shrink: 0;
}

.chat-widget-send:hover {
    transform: scale(1.08);
}

.chat-widget-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

/* ── Typing Indicator ────────────────────────────── */
.chat-typing-indicator {
    display: flex;
    gap: 5px;
    padding: 4px;
}

.chat-typing-dot {
    width: 7px;
    height: 7px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

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

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

/* ═══════════════════════════════════════════════════
   Support Tab — Conversational Chat
   ═══════════════════════════════════════════════════ */

/* ── Logged-Out Gate ─────────────────────────────── */
.support-login-gate {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 28px;
    text-align: center;
    flex: 1;
}

.support-gate-icon {
    color: var(--accent, #4ade80);
    opacity: 0.6;
    margin-bottom: 16px;
}

.support-gate-title {
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 8px;
}

.support-gate-text {
    color: rgba(255, 255, 255, 0.5);
    font-size: 13px;
    line-height: 1.5;
    margin: 0 0 24px;
}

.support-login-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: var(--accent, #4ade80);
    color: #111;
    border-radius: 22px;
    font-size: 13.5px;
    font-weight: 600;
    font-family: inherit;
    text-decoration: none;
    transition: transform 0.15s, box-shadow 0.2s;
}

.support-login-btn:hover {
    transform: scale(1.04);
    box-shadow: 0 4px 16px rgba(74, 222, 128, 0.25);
}

/* ── Chat Wrapper ────────────────────────────────── */
.support-chat-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

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

/* ── Welcome Message ─────────────────────────────── */
.support-welcome-msg {
    display: flex;
    gap: 10px;
    padding: 8px 0;
    animation: msgAppear 0.3s ease-out;
}

.support-ted-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent, #4ade80) 0%, #22c55e 100%);
    color: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(74, 222, 128, 0.2);
}

.support-welcome-text {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    border-top-left-radius: 4px;
    padding: 10px 14px;
    flex: 1;
}

.support-welcome-text strong {
    color: #fff;
    font-size: 13px;
}

.support-welcome-text p {
    color: rgba(255, 255, 255, 0.6);
    font-size: 12.5px;
    line-height: 1.5;
    margin: 6px 0 0;
}

/* ── Badge ───────────────────────────────────────── */
.support-badge {
    display: inline-block;
    background: rgba(74, 222, 128, 0.15);
    color: var(--accent, #4ade80);
    font-size: 9.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 6px;
    border-radius: 6px;
    margin-left: 4px;
    vertical-align: middle;
}

/* ── Message Bubbles ─────────────────────────────── */
.support-msg {
    display: flex;
    gap: 8px;
    animation: msgAppear 0.25s ease-out;
}

.support-msg.outgoing {
    justify-content: flex-end;
}

.support-msg.incoming {
    justify-content: flex-start;
}

.support-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent, #4ade80) 0%, #22c55e 100%);
    color: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 12px;
    flex-shrink: 0;
    margin-top: 2px;
}

.support-msg-body {
    max-width: 80%;
}

.support-msg-sender {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 3px;
    font-weight: 600;
}

.support-msg-text {
    padding: 9px 14px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.45;
    word-wrap: break-word;
}

.support-msg.incoming .support-msg-text {
    background: rgba(255, 255, 255, 0.08);
    color: #e0e0e0;
    border-top-left-radius: 4px;
}

.support-msg.outgoing .support-msg-text {
    background: var(--accent, #4ade80);
    color: #111;
    border-top-right-radius: 4px;
    font-weight: 500;
}

/* ── Support Input ───────────────────────────────── */
.support-chat-input-area {
    padding: 12px 14px;
    background: rgba(0, 0, 0, 0.25);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    gap: 8px;
    align-items: center;
}

.support-chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #fff;
    padding: 10px 16px;
    border-radius: 22px;
    outline: none;
    font-family: inherit;
    font-size: 13px;
    transition: border-color 0.2s, background 0.2s;
}

.support-chat-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.support-chat-input:focus {
    border-color: var(--accent, #4ade80);
    background: rgba(255, 255, 255, 0.08);
}

.support-chat-input:disabled {
    opacity: 0.4;
    cursor: wait;
}

.support-chat-send {
    background: var(--accent, #4ade80);
    color: #111;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s, opacity 0.2s;
    flex-shrink: 0;
}

.support-chat-send:hover {
    transform: scale(1.08);
}

.support-chat-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

/* ── Loading state ───────────────────────────────── */
.support-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    flex: 1;
}

/* ── Mobile ──────────────────────────────────────── */
@media (max-width: 480px) {
    .chat-widget-panel {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
    }
}
