/* =======================================================
   GUEST CHAT WIDGET — floating launcher + side panel
   (used on internship.html for unauthenticated visitors)
   ======================================================= */

.gc-widget {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 4500;
    font-family: "Poppins", "Open Sans", sans-serif;
}

.gc-panel[hidden] {
    display: none !important;
}

/* ---------- Launcher button ---------- */
.gc-launcher {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px 12px 16px;
    border: none;
    border-radius: 50px;
    background: #025add;
    color: #fff;
    font-weight: 600;
    font-size: 0.88rem;
    letter-spacing: 0.2px;
    cursor: pointer;
    box-shadow: 0 10px 28px rgba(2, 90, 221, 0.28);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    position: relative;
}

.gc-launcher:hover {
    background: #0148b0;
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(2, 90, 221, 0.35);
}

.gc-launcher:focus-visible {
    outline: 3px solid rgba(2, 90, 221, 0.35);
    outline-offset: 2px;
}

.gc-launcher i {
    font-size: 1rem;
    line-height: 1;
}

.gc-launcher .gc-icon-open { display: none; }

.gc-widget.is-open .gc-launcher .gc-icon-closed { display: none; }
.gc-widget.is-open .gc-launcher .gc-icon-open { display: inline-block; }
.gc-widget.is-open .gc-launcher .gc-launcher-label { display: none; }
.gc-widget.is-open .gc-launcher {
    padding: 14px;
    width: 46px;
    height: 46px;
    justify-content: center;
    gap: 0;
}

.gc-launcher-label { white-space: nowrap; }

.gc-unread {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 20px;
    background: #dc2626;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    line-height: 1;
}

/* ---------- Panel ---------- */
.gc-panel {
    position: absolute;
    right: 0;
    bottom: 64px;
    width: 360px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 100px);
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 28px 60px rgba(15, 23, 42, 0.22);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: gcPanelIn 0.22s ease-out;
    transform-origin: bottom right;
}

@keyframes gcPanelIn {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.gc-panel-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 18px;
    background: linear-gradient(135deg, #025add 0%, #0148b0 100%);
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.gc-panel-head-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.gc-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    flex-shrink: 0;
}

.gc-panel-head strong {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    line-height: 1.2;
}

.gc-panel-head small {
    display: block;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.82);
    margin-top: 2px;
}

.gc-head-action {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.gc-head-action:hover { background: rgba(255, 255, 255, 0.22); }

.gc-head-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.gc-widget.is-expanded .gc-panel {
    width: min(560px, calc(100vw - 40px));
    height: min(760px, calc(100vh - 84px));
    height: min(760px, calc(100dvh - 84px));
    max-height: none;
    bottom: 58px;
}

.gc-head-action:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ---------- Body ---------- */
.gc-panel-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: #f8fafc;
}

/* --- Start form --- */
.gc-start {
    padding: 18px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.gc-welcome {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 16px;
}

.gc-welcome h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #0f172a;
    margin: 0 0 4px;
}

.gc-welcome p {
    font-size: 0.82rem;
    color: #64748b;
    margin: 0;
    line-height: 1.5;
}

.gc-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.gc-field > span {
    font-size: 0.76rem;
    font-weight: 500;
    color: #334155;
}

.gc-field > span em {
    color: #dc2626;
    font-style: normal;
    margin-left: 2px;
}

.gc-field > span small {
    color: #94a3b8;
    font-weight: 400;
    margin-left: 4px;
}

.gc-field input,
.gc-field textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.85rem;
    font-family: inherit;
    color: #0f172a;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.gc-field input:focus,
.gc-field textarea:focus {
    outline: none;
    border-color: #025add;
    box-shadow: 0 0 0 3px rgba(2, 90, 221, 0.12);
}

.gc-field textarea {
    resize: vertical;
    min-height: 64px;
    line-height: 1.5;
}

.gc-submit {
    padding: 11px 14px;
    background: #025add;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s ease, transform 0.2s ease;
}

.gc-submit:hover:not(:disabled) {
    background: #0148b0;
    transform: translateY(-1px);
}

.gc-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.gc-consent {
    font-size: 0.72rem;
    color: #94a3b8;
    margin: 0;
    text-align: center;
    line-height: 1.5;
}

.gc-consent a {
    color: #025add;
    text-decoration: none;
}

.gc-consent a:hover { text-decoration: underline; }

/* --- Conversation view --- */
.gc-conversation {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.gc-thread-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid #e2e8f0;
    background: #fff;
}

.gc-thread-status-text {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    color: #475569;
    font-size: 0.76rem;
    line-height: 1.4;
}

.gc-thread-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 8px;
    border-radius: 999px;
    background: #dcfce7;
    color: #166534;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}

.gc-thread-badge.is-closed {
    background: #fee2e2;
    color: #b91c1c;
}

.gc-thread-reset {
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #0f172a;
    border-radius: 999px;
    padding: 7px 10px;
    font-size: 0.74rem;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.gc-thread-reset:hover {
    border-color: #025add;
    color: #025add;
    background: #f8fbff;
}

.gc-conversation.is-closed .gc-reply-form {
    opacity: 0.8;
}

.gc-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}

.gc-msg {
    max-width: 82%;
    padding: 9px 13px;
    border-radius: 14px;
    font-size: 0.85rem;
    line-height: 1.5;
    color: #0f172a;
    word-wrap: break-word;
    position: relative;
}

.gc-msg time {
    display: block;
    font-size: 0.68rem;
    color: #94a3b8;
    margin-top: 4px;
    font-weight: 400;
}

.gc-msg.visitor {
    align-self: flex-end;
    background: #025add;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.gc-msg.visitor time { color: rgba(255, 255, 255, 0.75); }

.gc-msg.admin {
    align-self: flex-start;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
}

.gc-empty {
    text-align: center;
    color: #94a3b8;
    font-size: 0.82rem;
    padding: 20px;
}

.gc-system-note {
    align-self: center;
    background: #eef2f7;
    color: #475569;
    font-size: 0.75rem;
    padding: 6px 12px;
    border-radius: 20px;
    max-width: 90%;
    text-align: center;
}

/* --- Reply form --- */
.gc-reply-form {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #e2e8f0;
    background: #fff;
    align-items: flex-end;
}

.gc-reply-form textarea {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 9px 14px;
    font-size: 0.85rem;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    line-height: 1.45;
    color: #0f172a;
    background: #f8fafc;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.gc-reply-form textarea:focus {
    outline: none;
    border-color: #025add;
    background: #fff;
}

.gc-reply-send {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: #025add;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.88rem;
    transition: background 0.2s ease, transform 0.2s ease;
    flex-shrink: 0;
}

.gc-reply-send:hover:not(:disabled) {
    background: #0148b0;
    transform: translateY(-1px);
}

.gc-reply-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* --- Error banner --- */
.gc-error {
    margin: 0 16px 12px;
    padding: 10px 12px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #991b1b;
    font-size: 0.8rem;
    line-height: 1.4;
}

/* ---------- Mobile responsive ---------- */
@media (max-width: 576px) {
    .gc-widget { right: 14px; bottom: 14px; }

    .gc-panel {
        width: calc(100vw - 24px);
        bottom: 62px;
        max-height: calc(100vh - 88px);
    }

    .gc-launcher { padding: 10px 14px; font-size: 0.82rem; }
    .gc-launcher-label { display: none; }
    .gc-launcher {
        padding: 12px;
        width: 46px;
        height: 46px;
        justify-content: center;
        gap: 0;
    }

    .gc-widget.is-expanded .gc-panel {
        width: calc(100vw - 24px);
        height: calc(100vh - 96px);
        height: calc(100dvh - 96px);
        bottom: 62px;
    }

    .gc-thread-status {
        align-items: flex-start;
        flex-direction: column;
    }

    .gc-thread-reset {
        width: 100%;
    }
}
