/* ════════════════════════════════════════════════════════════════
   MMNS Global Chatbot – Frontend Widget CSS
   Palette: #000000 · #0d0d0d · #C9942A · #E8C56D · #ffffff
════════════════════════════════════════════════════════════════ */

:root {
    --cdc-primary:      #C9942A;
    --cdc-primary-dark: #8a6a1a;
    --cdc-bg:           #000000;
    --cdc-header:       #0d0d0d;
    --cdc-msg-bot:      #0d0d0d;
    --cdc-text:         #E8C56D;
    --cdc-bottom:       28px;
    --cdc-pos-right:    28px;
    --cdc-pos-left:     auto;
}

#cdc-root * {
    box-sizing: border-box;
    margin: 0; padding: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ── TOGGLE BUTTON ──────────────────────────────────────────── */
#cdc-toggle {
    position: fixed;
    bottom: var(--cdc-bottom);
    right: var(--cdc-pos-right);
    left:  var(--cdc-pos-left);
    width: 62px; height: 62px;
    border-radius: 50%;
    background: #000000;
    border: 1px solid rgba(201,148,42,0.6);
    cursor: pointer;
    box-shadow: 0 4px 24px rgba(201,148,42,0.25), 0 0 0 0 rgba(201,148,42,0);
    display: flex; align-items: center; justify-content: center;
    z-index: 2147483647;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    padding: 0;
}
#cdc-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 32px rgba(201,148,42,0.4), 0 0 0 6px rgba(201,148,42,0.08);
    border-color: var(--cdc-primary);
}
#cdc-toggle-logo-wrap {
    position: relative;
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
}
#cdc-toggle-icon {
    width: 28px; height: 28px;
    fill: var(--cdc-primary);
    display: block;
    transition: transform 0.2s;
}
#cdc-toggle.is-open {
    border-color: rgba(255,255,255,0.3);
    box-shadow: 0 4px 16px rgba(0,0,0,0.6);
}
#cdc-toggle.is-open #cdc-toggle-icon { transform: rotate(90deg); }

/* Chat icon via SVG – clearly visible, no pseudo overlay */
#cdc-toggle-logo-wrap::before { display: none; }
#cdc-toggle-icon {
    display: block;
    fill: var(--cdc-primary);
    transition: fill 0.2s;
}
#cdc-toggle:hover #cdc-toggle-icon { fill: #E8C56D; }
/* X icon when open */
#cdc-toggle.is-open #cdc-toggle-icon { fill: #ffffff; }

#cdc-dot {
    position: absolute;
    top: 0; right: 0;
    width: 12px; height: 12px;
    background: var(--cdc-primary);
    border-radius: 50%;
    border: 2px solid #000;
    display: none; z-index: 2;
    animation: mmns-dot-pulse 2s infinite;
}
@keyframes mmns-dot-pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.6;transform:scale(0.85)} }

/* ── CHAT WINDOW ────────────────────────────────────────────── */
#cdc-window {
    position: fixed;
    bottom: calc(var(--cdc-bottom) + 78px);
    right: var(--cdc-pos-right);
    left:  var(--cdc-pos-left);
    width: 370px;
    max-width: calc(100vw - 20px);
    height: 560px;
    max-height: calc(100vh - 120px);
    background: var(--cdc-bg);
    border: 1px solid rgba(201,148,42,0.3);
    border-radius: 0;
    display: flex; flex-direction: column;
    overflow: hidden;
    box-shadow: 0 16px 56px rgba(0,0,0,0.9), 0 0 0 1px rgba(201,148,42,0.1);
    z-index: 2147483646;
    transform: scale(0.92) translateY(16px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.22s cubic-bezier(.4,0,.2,1), opacity 0.22s;
}
#cdc-window.cdc-open {
    transform: scale(1) translateY(0);
    opacity: 1; pointer-events: all;
}

/* ── HEADER ─────────────────────────────────────────────────── */
#cdc-header {
    background: var(--cdc-header);
    padding: 14px 16px;
    display: flex; align-items: center; gap: 11px;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(201,148,42,0.2);
    position: relative;
    overflow: hidden;
}
#cdc-header::before {
    content: '';
    position: absolute;
    top: -20px; right: -20px;
    width: 100px; height: 100px;
    background: radial-gradient(circle, rgba(201,148,42,0.08) 0%, transparent 65%);
    pointer-events: none;
}
#cdc-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: #000;
    border: 1px solid rgba(201,148,42,0.5);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; flex-shrink: 0;
}
.cdc-avatar-logo { width: 32px; height: 32px; object-fit: contain; }
#cdc-header-info h3 {
    color: var(--cdc-primary);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
#cdc-header-info p {
    color: rgba(201,148,42,0.5);
    font-size: 11px;
    margin-top: 2px;
    display: flex; align-items: center; gap: 5px;
    letter-spacing: 0.06em;
}
#cdc-status-dot {
    display: inline-block;
    width: 6px; height: 6px;
    background: var(--cdc-primary);
    border-radius: 50%;
    animation: cdc-pulse 2s infinite;
}
@keyframes cdc-pulse { 0%,100%{opacity:1} 50%{opacity:.3} }

#cdc-close {
    margin-left: auto;
    background: none; border: none;
    color: rgba(201,148,42,0.5);
    cursor: pointer; font-size: 18px;
    padding: 5px 6px;
    transition: color .15s;
    flex-shrink: 0;
}
#cdc-close:hover { color: var(--cdc-primary); }

.cdc-header-btn {
    background: none; border: none; cursor: pointer;
    padding: 5px;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s;
}
.cdc-header-btn svg { width: 18px; height: 18px; fill: rgba(201,148,42,0.5); }
.cdc-header-btn:hover svg { fill: var(--cdc-primary); }

/* ── MESSAGES ───────────────────────────────────────────────── */
#cdc-messages {
    flex: 1; overflow-y: auto;
    padding: 14px;
    display: flex; flex-direction: column; gap: 9px;
    scroll-behavior: smooth;
}
#cdc-messages::-webkit-scrollbar { width: 3px; }
#cdc-messages::-webkit-scrollbar-thumb { background: rgba(201,148,42,0.25); }

.cdc-msg {
    max-width: 86%;
    padding: 10px 13px;
    font-size: 13.5px;
    line-height: 1.55;
    word-break: break-word;
}
.cdc-msg.cdc-bot {
    background: var(--cdc-msg-bot);
    color: rgba(232,197,109,0.9);
    border-bottom-left-radius: 0;
    align-self: flex-start;
    border: 1px solid rgba(201,148,42,0.18);
    border-left: 2px solid var(--cdc-primary);
}
.cdc-msg.cdc-user {
    background: var(--cdc-primary);
    color: #000;
    border-bottom-right-radius: 0;
    align-self: flex-end;
    font-weight: 600;
}
.cdc-msg a { color: var(--cdc-primary); text-decoration: underline; }

/* ── TYPING ─────────────────────────────────────────────────── */
#cdc-typing {
    background: var(--cdc-msg-bot);
    border: 1px solid rgba(201,148,42,0.18);
    border-left: 2px solid var(--cdc-primary);
    padding: 12px 15px;
    align-self: flex-start;
    display: none; gap: 5px; align-items: center;
}
#cdc-typing.cdc-visible { display: flex; }
#cdc-typing span {
    width: 6px; height: 6px;
    background: var(--cdc-primary);
    border-radius: 50%;
    animation: cdc-typing 1.2s infinite;
}
#cdc-typing span:nth-child(2){animation-delay:.2s}
#cdc-typing span:nth-child(3){animation-delay:.4s}
@keyframes cdc-typing{0%,60%,100%{transform:translateY(0);opacity:.3}30%{transform:translateY(-5px);opacity:1}}

/* ── MODE CHOOSER ───────────────────────────────────────────── */
#cdc-mode-chooser {
    display: none; position: absolute; inset: 0;
    background: rgba(0,0,0,0.95);
    z-index: 10; align-items: center; justify-content: center;
}
#cdc-mode-chooser.cdc-visible { display: flex; }
.cdc-mode-inner { text-align: center; padding: 24px; }
.cdc-mode-title { color: var(--cdc-text); font-size: 14px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 24px; }
.cdc-mode-btns { display: flex; gap: 16px; justify-content: center; }
.cdc-mode-btn {
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    background: var(--cdc-msg-bot);
    border: 1px solid rgba(201,148,42,0.3);
    padding: 22px 26px;
    cursor: pointer; color: var(--cdc-text);
    font-size: 13px; font-family: inherit;
    transition: border-color .18s, transform .15s;
    min-width: 110px;
}
.cdc-mode-btn:hover { border-color: var(--cdc-primary); transform: translateY(-2px); }
.cdc-mode-icon { font-size: 30px; line-height: 1; }

/* ── QUICK REPLIES ──────────────────────────────────────────── */
#cdc-quick { padding: 0 14px 10px; display: flex; flex-wrap: wrap; gap: 6px; flex-shrink: 0; }
#cdc-quick.cdc-hidden { display: none; }
.cdc-qbtn {
    background: #000;
    border: 1px solid rgba(201,148,42,0.35);
    color: rgba(201,148,42,0.8);
    padding: 5px 12px;
    font-size: 11.5px; cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
    font-family: inherit;
    letter-spacing: 0.04em;
}
.cdc-qbtn:hover { background: var(--cdc-primary); color: #000; border-color: var(--cdc-primary); }

/* ── INPUT ROW ──────────────────────────────────────────────── */
#cdc-input-row {
    padding: 11px 14px;
    border-top: 1px solid rgba(201,148,42,0.15);
    display: flex; gap: 8px; flex-shrink: 0;
    background: rgba(0,0,0,0.8);
}
#cdc-input {
    flex: 1;
    background: #0d0d0d;
    border: 1px solid rgba(201,148,42,0.2);
    padding: 9px 13px;
    color: rgba(232,197,109,0.9);
    font-size: 13px; outline: none; resize: none; font-family: inherit;
    line-height: 1.4; max-height: 96px;
    transition: border-color .15s;
    border-radius: 0;
}
#cdc-input:focus { border-color: var(--cdc-primary); }
#cdc-input::placeholder { color: rgba(201,148,42,0.25); }

#cdc-send {
    width: 40px; height: 40px;
    background: var(--cdc-primary);
    border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; align-self: flex-end;
    transition: opacity .15s, background .15s;
    border-radius: 0;
}
#cdc-send:hover { background: #E8C56D; }
#cdc-send:disabled { opacity: .3; cursor: not-allowed; }
#cdc-send svg { width: 18px; height: 18px; fill: #000; }

/* ── VOICE ROW ──────────────────────────────────────────────── */
#cdc-voice-row {
    padding: 10px 14px;
    border-top: 1px solid rgba(201,148,42,0.15);
    flex-direction: column; align-items: center; gap: 8px;
    flex-shrink: 0; background: rgba(0,0,0,0.8);
}
#cdc-voice-status { font-size: 11px; color: rgba(201,148,42,0.4); text-align: center; letter-spacing: 0.06em; }
#cdc-mic-btn {
    width: 56px; height: 56px; border-radius: 50%;
    background: #000; border: 1px solid rgba(201,148,42,0.5);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: box-shadow .2s, transform .15s, border-color .2s;
}
#cdc-mic-btn svg { width: 24px; height: 24px; fill: var(--cdc-primary); }
#cdc-mic-btn:hover { transform: scale(1.06); border-color: var(--cdc-primary); }
#cdc-mic-btn.cdc-recording {
    border-color: #f44336;
    animation: cdc-mic-pulse 1s infinite;
}
@keyframes cdc-mic-pulse{0%,100%{box-shadow:0 0 0 0 rgba(244,67,54,.4)}50%{box-shadow:0 0 0 12px rgba(244,67,54,0)}}
#cdc-mic-btn.cdc-speaking { box-shadow: 0 0 0 6px rgba(201,148,42,0.2); }
.cdc-link-btn {
    background: none; border: none; color: rgba(201,148,42,0.5);
    font-size: 11px; cursor: pointer; text-decoration: underline;
    font-family: inherit; padding: 0;
    transition: color .15s; letter-spacing: 0.06em;
}
.cdc-link-btn:hover { color: var(--cdc-primary); }

/* ── DISCLAIMER ─────────────────────────────────────────────── */
#cdc-disclaimer {
    text-align: center;
    font-size: 9.5px;
    color: rgba(201,148,42,0.2);
    padding: 5px 14px 8px;
    flex-shrink: 0;
    line-height: 1.4;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* ── MOBILE ─────────────────────────────────────────────────── */
@media (max-width: 480px) {
    #cdc-window {
        top: auto !important;
        bottom: calc(var(--cdc-bottom) + 62px) !important;
        right: 10px !important;
        left: 10px !important;
        width: auto !important;
        max-width: none !important;
        height: 65vh !important;
        max-height: 520px !important;
        border-radius: 0 !important;
    }
    #cdc-toggle {
        width: 44px !important;
        height: 44px !important;
        bottom: var(--cdc-bottom) !important;
        right: var(--cdc-pos-right) !important;
        left: var(--cdc-pos-left) !important;
    }
    #cdc-toggle-logo-wrap::before {
        font-size: 18px !important;
    }
    #cdc-toggle-icon {
        width: 20px !important;
        height: 20px !important;
    }
    #cdc-header { padding: 11px 13px; }
    #cdc-header-info h3 { font-size: 12px; }
    #cdc-header-info p  { font-size: 10px; }
    .cdc-msg { font-size: 12.5px; padding: 8px 11px; }
    #cdc-input { font-size: 13px; padding: 8px 11px; }
    .cdc-qbtn { font-size: 11px; padding: 4px 10px; }
}
