/**
 * chat-widget-styles.css
 * ─────────────────────────────────────────────────────────────
 * Add this file as: public/css/chat-widget-styles.css
 * Then link it on every page that uses the chat widget:
 *   <link rel="stylesheet" href="css/chat-widget-styles.css">
 * ─────────────────────────────────────────────────────────────
 */

/* ── Toggle Button (the floating circle) ───────────────────── */
.chat-toggle-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--brand-gradient);
    border: none;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(var(--primary-rgb), 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.chat-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(var(--primary-rgb), 0.6);
}

.chat-toggle-btn .material-icons-sharp {
    font-size: 1.8rem;
}

/* Unread badge on the toggle button */
.chat-unread-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #f44336;
    color: white;
    font-size: 0.72rem;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid white;
    font-family: 'Poppins', sans-serif;
}

/* ── Widget Window ──────────────────────────────────────────── */
.chat-widget {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 360px;
    max-height: 520px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: 'Poppins', sans-serif;
    animation: chatSlideIn 0.3s ease;
}

@keyframes chatSlideIn {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Header ─────────────────────────────────────────────────── */
.chat-header {
    background: var(--brand-gradient);
    padding: 1rem 1.2rem;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chat-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #4CAF50;
    border: 2px solid rgba(255,255,255,0.5);
    flex-shrink: 0;
}

.chat-title {
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.2;
}

.chat-subtitle {
    font-size: 0.78rem;
    opacity: 0.85;
}

.chat-header-actions {
    display: flex;
    gap: 0.4rem;
}

.chat-minimize-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chat-minimize-btn:hover {
    background: rgba(255,255,255,0.35);
}

.chat-minimize-btn .material-icons-sharp {
    font-size: 1.1rem;
}

/* ── Messages Area ───────────────────────────────────────────── */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    background: #f8f9fc;
    min-height: 0;
}

.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: #d0d0e0; border-radius: 2px; }

/* Individual message bubbles */
.chat-msg {
    max-width: 80%;
    padding: 0.55rem 0.9rem;
    border-radius: 16px;
    font-size: 0.88rem;
    line-height: 1.45;
    word-break: break-word;
    position: relative;
}

.chat-msg.admin {
    align-self: flex-start;
    background: white;
    color: #333;
    border-radius: 4px 16px 16px 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.chat-msg.user {
    align-self: flex-end;
    background: var(--brand-gradient);
    color: white;
    border-radius: 16px 4px 16px 16px;
}

.chat-msg-time {
    font-size: 0.68rem;
    opacity: 0.6;
    margin-top: 3px;
    text-align: right;
}

.chat-msg.admin .chat-msg-time {
    text-align: left;
}

/* Typing indicator */
.typing-indicator {
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: #888;
    background: #f8f9fc;
    flex-shrink: 0;
}

.typing-dots {
    display: flex;
    gap: 3px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: #aaa;
    border-radius: 50%;
    animation: typingBounce 1.2s infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* ── Input Area ──────────────────────────────────────────────── */
.chat-input-area {
    flex-shrink: 0;
    background: white;
    border-top: 1px solid #eee;
}

.chat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
}

.chat-input {
    flex: 1;
    border: 2px solid #e8e8f0;
    border-radius: 20px;
    padding: 0.55rem 1rem;
    font-size: 0.88rem;
    font-family: 'Poppins', sans-serif;
    outline: none;
    transition: border-color 0.2s;
    background: #f8f9fc;
    color: #333;
}

.chat-input:focus {
    border-color: var(--primary);
    background: white;
}

.chat-input::placeholder {
    color: #aaa;
}

.chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--brand-gradient);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}

.chat-send-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 3px 10px rgba(var(--primary-rgb), 0.4);
}

.chat-send-btn .material-icons-sharp {
    font-size: 1.2rem;
}

/* Resolved banner */
.resolved-banner {
    padding: 0.6rem 1rem;
    background: #e8f5e9;
    color: #2e7d32;
    font-size: 0.82rem;
    text-align: center;
    border-top: 1px solid #c8e6c9;
}

.resolved-banner a {
    color: #1b5e20;
    font-weight: 600;
    text-decoration: underline;
}

/* ── Mobile ──────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .chat-widget {
        width: calc(100vw - 24px);
        right: 12px;
        bottom: 88px;
        max-height: 75vh;
        border-radius: 16px;
    }

    .chat-toggle-btn {
        right: 16px;
        bottom: 16px;
        width: 54px;
        height: 54px;
    }
}

/* ── Dark mode support ───────────────────────────────────────── */
.dark-theme .chat-widget {
    background: #1a1a2e;
}

.dark-theme .chat-messages {
    background: #12122a;
}

.dark-theme .chat-msg.admin {
    background: #252545;
    color: #e8e8f0;
}

.dark-theme .chat-input-area {
    background: #1a1a2e;
    border-color: #333355;
}

.dark-theme .chat-input {
    background: #252545;
    border-color: #333355;
    color: #e8e8f0;
}

.dark-theme .chat-input:focus {
    border-color: var(--primary);
    background: #2a2a55;
}

@keyframes fabPulse {
    0%, 100% { 
        box-shadow: 0 4px 20px rgba(var(--primary-rgb), 0.55); 
    }
    50%       { 
        box-shadow: 0 4px 32px rgba(var(--primary-rgb), 0.9), 
                    0 0 0 8px rgba(var(--primary-rgb), 0.18); 
    }
}
.chat-toggle-btn:not(:hover) {
    animation: fabPulse 2.5s ease-in-out infinite;
}





/**
 * chat-widget-styles.css
 * Cleaned version – no HTML comments, duplicates merged.
 * Use on any page that needs the floating chat widget.
 */

/* ===== Floating Action Button (FAB) ===== */
.chat-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--brand-gradient);
    border: none;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.chat-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 28px rgba(var(--primary-rgb), 0.65);
}

.chat-fab .material-icons-sharp {
    font-size: 1.75rem;
}

/* Unread badge on FAB */
.chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #f44336;
    color: white;
    font-size: 0.72rem;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid white;
    font-family: 'Poppins', sans-serif;
    line-height: 1;
}

.chat-badge.hidden {
    display: none !important;
}

/* ===== Chat Window – with animation ===== */
.chat-window {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 360px;
    max-height: 80vh;
    height: auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 12px 44px rgba(0, 0, 0, 0.22);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: 'Poppins', sans-serif;
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.chat-window.hidden {
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;  /* prevent accidental clicks while hidden */
}

/* ===== Header ===== */
.chat-widget-header {
    background: var(--brand-gradient);
    padding: 0.9rem 1.1rem;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.chat-widget-header-left {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.5);
    flex-shrink: 0;
}

.status-dot.online {
    background: #4CAF50;
}

.status-dot.offline {
    background: #ccc;
}

.chat-widget-title {
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1.2;
}

.chat-widget-subtitle {
    font-size: 0.75rem;
    opacity: 0.85;
}

.chat-widget-header-right {
    display: flex;
    gap: 0.3rem;
}

.chat-icon-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chat-icon-btn:hover {
    background: rgba(255, 255, 255, 0.35);
}

.chat-end-btn {
    background: rgba(244, 67, 54, 0.4);
}

.chat-end-btn:hover {
    background: rgba(244, 67, 54, 0.7);
}

/* ===== Pre‑chat form ===== */
.chat-prechat-body {
    padding: 1.4rem 1.3rem;
    overflow-y: auto;
}

.chat-prechat-title {
    margin: 0 0 0.35rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: #333;
}

.chat-prechat-sub {
    margin: 0 0 1.2rem;
    font-size: 0.84rem;
    color: #777;
}

.chat-form-group {
    margin-bottom: 1rem;
}

.chat-form-label {
    display: block;
    font-weight: 600;
    font-size: 0.84rem;
    color: #555;
    margin-bottom: 0.35rem;
}

.chat-form-input {
    width: 100%;
    padding: 0.6rem 0.9rem;
    border: 2px solid #e8e8f0;
    border-radius: 10px;
    font-size: 0.9rem;
    font-family: 'Poppins', sans-serif;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.chat-form-input:focus {
    border-color: var(--primary);
}

.chat-start-btn {
    width: 100%;
    padding: 0.75rem;
    background: var(--brand-gradient);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: 'Poppins', sans-serif;
    transition: opacity 0.2s, transform 0.2s;
    margin-top: 0.5rem;
}

.chat-start-btn:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

.chat-start-btn .material-icons-sharp {
    font-size: 1.1rem;
}

/* ===== Main chat area ===== */
.main-chat {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.main-chat.hidden {
    display: none !important;
}

/* ===== Messages (if used) ===== */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    background: #f8f9fc;
}

/* ===== Typing indicator ===== */
.chat-typing {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.9rem;
    font-size: 0.78rem;
    color: #888;
    flex-shrink: 0;
}

.chat-typing.hidden {
    display: none !important;
}

.chat-typing-dots {
    display: flex;
    gap: 3px;
}

.chat-typing-dots span {
    width: 6px;
    height: 6px;
    background: #bbb;
    border-radius: 50%;
    animation: cwBounce 1.2s infinite;
}

.chat-typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.chat-typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes cwBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-5px); }
}

/* ===== Input row ===== */
.chat-input-row {
    display: flex;
    align-items: flex-end;
    gap: 0.4rem;
    padding: 0.65rem 0.75rem;
    border-top: 1px solid #eee;
    flex-shrink: 0;
    background: white;
}

.chat-textarea {
    flex: 1;
    border: 2px solid #e8e8f0;
    border-radius: 18px;
    padding: 0.5rem 0.85rem;
    font-size: 0.88rem;
    font-family: 'Poppins', sans-serif;
    outline: none;
    resize: none;
    max-height: 120px;
    transition: border-color 0.2s;
    background: #f8f9fc;
    color: #333;
    line-height: 1.4;
}

.chat-textarea:focus {
    border-color: var(--primary);
    background: white;
}

.chat-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--brand-gradient);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}

.chat-send-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 3px 10px rgba(var(--primary-rgb), 0.4);
}

.chat-send-btn .material-icons-sharp {
    font-size: 1.2rem;
}

.chat-input-row .chat-icon-btn {
    background: transparent;
    color: #aaa;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.chat-input-row .chat-icon-btn:hover {
    background: #f0f0f0;
    color: var(--primary);
}

/* ===== Dark mode support ===== */
.dark-theme .chat-window {
    background: #1a1a2e;
}

.dark-theme .chat-prechat-body {
    background: #1a1a2e;
}

.dark-theme .chat-prechat-title {
    color: #e8e8f0;
}

.dark-theme .chat-prechat-sub {
    color: #aaa;
}

.dark-theme .chat-form-label {
    color: #bbb;
}

.dark-theme .chat-form-input {
    background: #252545;
    border-color: #333355;
    color: #e8e8f0;
}

.dark-theme .chat-form-input:focus {
    border-color: var(--primary);
}

.dark-theme .chat-input-row {
    background: #1a1a2e;
    border-color: #333355;
}

.dark-theme .chat-textarea {
    background: #252545;
    border-color: #333355;
    color: #e8e8f0;
}

.dark-theme .chat-textarea:focus {
    border-color: var(--primary);
}

.dark-theme .chat-icon-btn {
    color: #888;
}

/* ===== Mobile adjustments ===== */
@media (max-width: 480px) {
    .chat-window {
        width: calc(100vw - 20px);
        right: 10px;
        bottom: 86px;
        max-height: 78vh;
        border-radius: 16px;
    }

    .chat-fab {
        right: 16px;
        bottom: 16px;
        width: 54px;
        height: 54px;
    }

    .chat-fab .material-icons-sharp {
        font-size: 1.55rem;
    }
}




/* ── Mobile chat fix ─────────────────────────────── */
@media (max-width: 480px) {
    .chat-window {
        position: fixed !important;
        bottom: 0 !important;
        right: 0 !important;
        left: 0 !important;
        width: 100% !important;
        max-height: 85vh !important;
        border-radius: 20px 20px 0 0 !important;  /* sheet slides up from bottom */
    }

    .chat-fab {
        right: 16px;
        bottom: 16px;
        width: 54px;
        height: 54px;
    }


    /* ===== Glowing pulse effect on FAB ===== */
@keyframes fabPulse {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(var(--primary-rgb), 0.55);
    }
    50% {
        box-shadow: 0 4px 32px rgba(27, 122, 123, 0.9),
                    0 0 0 8px rgba(27, 122, 123, 0.18);
    }
}

.chat-fab:not(:hover) {
    animation: fabPulse 2.5s ease-in-out infinite;
}

    /* Prevent iOS auto-zoom on input focus */
    .chat-form-input,
    .chat-textarea,
    .chat-input,
    #chatUserName,
    #chatUserEmail,
    #chatInput {
        font-size: 16px !important;  /* ← This is the zoom fix */
        -webkit-text-size-adjust: 100%;
        touch-action: manipulation;
    }
}


/* OBSIDIAN THEME */
/* ============================================================
   Obsidian Theme — Chat Widget Overrides
   Append to: public/css/chat-widget-styles.css
   Extracted from forgot-password.html (applies to all
   Obsidian standalone pages that use the chat widget)
   ============================================================ */

.obs-theme .chat-window,
body.obs-page .chat-window {
    background: var(--obs-card) !important;
    border: 1px solid var(--obs-border) !important;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6) !important;
}
.obs-theme .chat-widget-header,
body.obs-page .chat-widget-header {
    background: var(--obs-card-2) !important;
    border-bottom: 1px solid var(--obs-border) !important;
}
.obs-theme .chat-widget-title  { color: var(--obs-text) !important; }
.obs-theme .chat-widget-subtitle { color: var(--obs-text-2) !important; }
.obs-theme .chat-prechat-body  { background: var(--obs-card) !important; }
.obs-theme .chat-prechat-title { color: var(--obs-text) !important; }
.obs-theme .chat-prechat-sub   { color: var(--obs-text-2) !important; }
.obs-theme .chat-form-label    { color: var(--obs-text-2) !important; }
.obs-theme .chat-form-input {
    background: var(--obs-card-2) !important;
    border: 1px solid var(--obs-border) !important;
    color: var(--obs-text) !important;
}
.obs-theme .chat-form-input::placeholder { color: var(--obs-text-3) !important; }
.obs-theme .chat-form-input:focus { border-color: var(--primary) !important; }
.obs-theme .chat-start-btn { background: var(--brand-gradient) !important; color: #fff !important; }
.obs-theme .chat-input-row {
    background: var(--obs-card-2) !important;
    border-top: 1px solid var(--obs-border) !important;
}
.obs-theme .chat-textarea {
    background: transparent !important;
    color: var(--obs-text) !important;
}
.obs-theme .chat-textarea::placeholder { color: var(--obs-text-3) !important; }
.obs-theme .chat-send-btn { background: var(--brand-gradient) !important; color: #fff !important; }
.obs-theme .chat-icon-btn { color: var(--obs-text-2) !important; }
.obs-theme .chat-icon-btn:hover { color: var(--obs-text) !important; }
.obs-theme .chat-fab {
    background: var(--brand-gradient) !important;
    box-shadow: 0 4px 20px rgba(var(--primary-rgb), 0.4) !important;
}
.obs-theme .status-dot.offline { background: var(--obs-text-3) !important; }
.obs-theme .status-dot.online  { background: var(--obs-green) !important; }

/* VERDANT THEME */




/* -------------------- */

#chatMessages {
    flex: 1;
    overflow-y: auto;
    padding: .75rem;
    display: flex;
    flex-direction: column;
    gap: .1rem;
}