/* ==========================================================================
   SkillBridge — Floating support chat widget
   --------------------------------------------------------------------------
   All selectors are prefixed `sb-chat-` so they never clash with the
   site's own styles. z-index 1050 sits above page content but below
   Bootstrap modals (1055). Pure CSS — no framework needed.
   ========================================================================== */

/* --- Floating button ---------------------------------------------------- */
.sb-chat-fab {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1050;
    width: 60px;
    height: 60px;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, #0f766e 0%, #0b3b36 100%);
    color: #ffffff;
    font-size: 24px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(11, 59, 54, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.sb-chat-fab:hover,
.sb-chat-fab:focus-visible {
    transform: scale(1.06);
    box-shadow: 0 10px 28px rgba(11, 59, 54, 0.45);
    outline: none;
}

.sb-chat-fab .sb-chat-fab-close {
    display: none;
}

.sb-chat-fab.sb-chat-open .sb-chat-fab-open {
    display: none;
}

.sb-chat-fab.sb-chat-open .sb-chat-fab-close {
    display: block;
}

/* Unread dot on the floating button. */
.sb-chat-fab-dot {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ef4444;
    border: 2px solid #ffffff;
    animation: sb-chat-dot-pulse 1.6s ease-in-out infinite;
}

.sb-chat-fab-dot.sb-chat-hidden {
    display: none;
}

@keyframes sb-chat-dot-pulse {
    0%,
    100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.25);
    }
}

/* --- Panel -------------------------------------------------------------- */
.sb-chat-panel {
    position: fixed;
    right: 20px;
    bottom: 92px;
    z-index: 1050;
    width: 360px;
    max-width: calc(100vw - 40px);
    height: 500px;
    max-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(11, 59, 54, 0.28);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px) scale(0.98);
    transform-origin: bottom right;
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
    pointer-events: none;
}

.sb-chat-panel.sb-chat-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* --- Panel header ------------------------------------------------------- */
.sb-chat-header {
    background: linear-gradient(135deg, #0f766e 0%, #0b3b36 100%);
    color: #ffffff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.sb-chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.sb-chat-header-text {
    flex: 1;
    min-width: 0;
}

.sb-chat-title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.25;
    margin: 0;
}

.sb-chat-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.85);
    margin-top: 2px;
}

.sb-chat-online-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.35);
    flex-shrink: 0;
}

.sb-chat-close {
    background: transparent;
    border: 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 18px;
    line-height: 1;
    padding: 6px;
    cursor: pointer;
    border-radius: 8px;
    flex-shrink: 0;
}

.sb-chat-close:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
}

/* --- Messages area ------------------------------------------------------ */
.sb-chat-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 16px;
    background: #f4f7f6;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

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

.sb-chat-msg-bot {
    align-self: flex-start;
    background: #ffffff;
    color: #1f2937;
    border: 1px solid #e4ebe4;
    border-bottom-left-radius: 4px;
}

.sb-chat-msg-user {
    align-self: flex-end;
    background: #0f766e;
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.sb-chat-msg a {
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.sb-chat-msg-bot a {
    color: #0f766e;
}

.sb-chat-msg-user a {
    color: #ffffff;
}

.sb-chat-time {
    display: block;
    font-size: 11px;
    margin-top: 4px;
    opacity: 0.65;
}

/* Typing indicator. */
.sb-chat-typing {
    align-self: flex-start;
    background: #ffffff;
    border: 1px solid #e4ebe4;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    padding: 12px 14px;
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.sb-chat-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #94a3b8;
    animation: sb-chat-typing 1.2s ease-in-out infinite;
}

.sb-chat-typing span:nth-child(2) {
    animation-delay: 0.15s;
}

.sb-chat-typing span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes sb-chat-typing {
    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

/* Quick-reply chips. */
.sb-chat-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px 0 2px;
}

.sb-chat-chip {
    border: 1px solid #0f766e;
    background: #ffffff;
    color: #0f766e;
    font-size: 13px;
    font-weight: 600;
    padding: 7px 12px;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.sb-chat-chip:hover,
.sb-chat-chip:focus-visible {
    background: #0f766e;
    color: #ffffff;
    outline: none;
}

/* --- Support / sign-in actions ------------------------------------------ */
.sb-chat-actions {
    flex-shrink: 0;
    padding: 10px 16px;
    border-top: 1px solid #e4ebe4;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sb-chat-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: background 0.15s ease;
}

.sb-chat-action-btn-primary {
    background: #0f766e;
    color: #ffffff;
    border: 1px solid #0f766e;
}

.sb-chat-action-btn-primary:hover {
    background: #0b5e57;
    color: #ffffff;
}

.sb-chat-action-link {
    text-align: center;
    font-size: 13px;
    color: #0f766e;
    font-weight: 600;
    text-decoration: none;
}

.sb-chat-action-link:hover {
    text-decoration: underline;
}

/* --- Input row ---------------------------------------------------------- */
.sb-chat-input-row {
    flex-shrink: 0;
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #e4ebe4;
    background: #ffffff;
}

.sb-chat-input {
    flex: 1;
    min-width: 0;
    border: 1px solid #d1d5db;
    border-radius: 999px;
    padding: 10px 14px;
    font-size: 14px;
    outline: none;
}

.sb-chat-input:focus {
    border-color: #0f766e;
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}

.sb-chat-send {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border: 0;
    border-radius: 50%;
    background: #0f766e;
    color: #ffffff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.sb-chat-send:hover {
    background: #0b5e57;
}

/* --- Phones: near-full-width bottom sheet ------------------------------- */
@media (max-width: 575.98px) {
    .sb-chat-fab {
        right: 16px;
        bottom: 16px;
    }

    .sb-chat-panel {
        left: 12px;
        right: 12px;
        bottom: 12px;
        width: auto;
        max-width: none;
        height: min(520px, 72vh);
        max-height: 72vh;
        transform-origin: bottom center;
    }
}
