/* ===== CiCC AI Widget 5.0 — Clean & Professional ===== */
#cicc-ai-widget, #cicc-ai-widget * { box-sizing: border-box; }

/* ===== TRIGGER ===== */
.cicc-ai-trigger {
    position: fixed; bottom: 24px; right: 24px; z-index: 999999;
    width: 48px; height: 48px; border-radius: 50%;
    background: #2563eb; border: none;
    color: #fff; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 16px rgba(37,99,235,0.35);
    transition: all 0.25s ease;
}
.cicc-ai-trigger:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(37,99,235,0.45);
}
.cicc-ai-trigger.active {
    background: #1e40af;
    transform: rotate(45deg) scale(0.9);
    box-shadow: 0 2px 8px rgba(30,64,175,0.4);
}
.cicc-ai-trigger.active .cicc-ai-trigger-icon { display: none; }
.cicc-ai-trigger.active .cicc-ai-close-icon { display: block !important; }
.cicc-ai-badge {
    position: absolute; top: -3px; right: -3px;
    min-width: 18px; height: 18px; padding: 0 5px;
    background: #dc2626; color: #fff; font-size: 10px; font-weight: 700;
    border-radius: 9px; display: flex; align-items: center; justify-content: center;
    border: 2px solid #fff;
}

/* ===== TRIGGER LABEL ===== */
.cicc-ai-trigger-lbl {
    position: fixed; bottom: 35px; right: 80px; z-index: 999998;
    background: #fff; color: #1e293b;
    font-size: 13px; font-weight: 600; padding: 7px 14px;
    border-radius: 20px; white-space: nowrap;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    opacity: 0; pointer-events: none;
    transition: opacity 0.3s ease;
    border: 1px solid #e2e8f0;
}
.cicc-ai-trigger-lbl.show { opacity: 1; }

/* ===== PANEL ===== */
.cicc-ai-panel {
    position: fixed; bottom: 84px; right: 24px; z-index: 999997;
    width: 360px; height: 520px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.04);
    display: flex; flex-direction: column; overflow: hidden;
    animation: cicc-panelIn 0.25s ease;
}
@keyframes cicc-panelIn {
    from { opacity: 0; transform: translateY(12px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ===== HEADER ===== */
.cicc-ai-hdr {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; flex-shrink: 0;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border-bottom: none;
}
.cicc-ai-hdr-left { display: flex; align-items: center; gap: 10px; }
.cicc-ai-hdr-avt {
    width: 30px; height: 30px; border-radius: 8px;
    background: rgba(255,255,255,0.2); color: #fff;
    display: flex; align-items: center; justify-content: center;
}
.cicc-ai-hdr-title { font-size: 14px; font-weight: 600; color: #fff; }
.cicc-ai-hdr-stt { display: flex; align-items: center; gap: 4px; font-size: 10px; color: rgba(255,255,255,0.7); }
.cicc-ai-dot {
    width: 5px; height: 5px; border-radius: 50%; display: inline-block;
    background: #4ade80; animation: cicc-dotPulse 2s infinite;
}
@keyframes cicc-dotPulse { 0%,100%{opacity:1} 50%{opacity:0.3} }
.cicc-ai-btn-icon {
    width: 28px; height: 28px; border-radius: 6px; border: none;
    background: rgba(255,255,255,0.12); color: rgba(255,255,255,0.8); font-size: 13px;
    cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
    transition: all 0.15s; padding: 0; margin-left: 4px;
}
.cicc-ai-btn-icon:hover { background: rgba(255,255,255,0.25); color: #fff; }

/* ===== BODY ===== */
.cicc-ai-body {
    flex: 1; overflow-y: auto; padding: 16px;
    background: #f8fafc;
    scroll-behavior: smooth;
}
.cicc-ai-body::-webkit-scrollbar { width: 4px; }
.cicc-ai-body::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }

/* Welcome */
.cicc-ai-welcome {
    text-align: center; padding: 24px 12px 12px;
}
.cicc-ai-welcome-icon {
    width: 48px; height: 48px; border-radius: 12px;
    background: linear-gradient(135deg, #2563eb, #6366f1);
    color: #fff; display: flex; align-items: center; justify-content: center;
    margin: 0 auto 12px;
}
.cicc-ai-welcome-t { font-size: 16px; font-weight: 600; color: #1e293b; margin-bottom: 4px; }
.cicc-ai-welcome-d { font-size: 12.5px; color: #64748b; line-height: 1.5; margin-bottom: 14px; }

/* Chips */
.cicc-ai-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.cicc-ai-chip {
    background: #eff6ff; border: 1px solid #bfdbfe;
    border-radius: 16px; padding: 5px 12px; font-size: 11.5px; color: #2563eb;
    cursor: pointer; transition: all 0.15s; font-family: inherit;
    white-space: nowrap;
}
.cicc-ai-chip:hover {
    background: #dbeafe; border-color: #93c5fd;
}

/* ===== MESSAGES ===== */
.cicc-ai-msg {
    margin-bottom: 10px; display: flex; gap: 8px;
    animation: cicc-msgIn 0.2s ease;
}
@keyframes cicc-msgIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}
.cicc-ai-msg.bot { align-items: flex-start; }
.cicc-ai-msg.user { flex-direction: row-reverse; }

.cicc-ai-msg-avt {
    width: 26px; height: 26px; border-radius: 6px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px;
}
.cicc-ai-msg.bot .cicc-ai-msg-avt { background: #eef2ff; color: #6366f1; }
.cicc-ai-msg.user .cicc-ai-msg-avt { background: linear-gradient(135deg, #2563eb, #6366f1); color: #fff; }

.cicc-ai-msg-bubble {
    max-width: 82%; padding: 8px 12px; border-radius: 10px;
    font-size: 13px; line-height: 1.5; word-wrap: break-word;
}
.cicc-ai-msg.bot .cicc-ai-msg-bubble {
    background: #fff; border: 1px solid #e2e8f0;
    color: #334155; border-top-left-radius: 2px;
}
.cicc-ai-msg.user .cicc-ai-msg-bubble {
    background: #2563eb; color: #fff; border-top-right-radius: 2px;
}
.cicc-ai-msg-time { font-size: 9px; color: #94a3b8; margin-top: 2px; padding: 0 2px; }
.cicc-ai-msg.user .cicc-ai-msg-time { text-align: right; color: rgba(255,255,255,0.5); }

/* Bubble content */
.cicc-ai-msg-bubble p { margin: 0 0 4px; }
.cicc-ai-msg-bubble p:last-child { margin-bottom: 0; }
.cicc-ai-msg-bubble a { color: #2563eb; text-decoration: underline; text-underline-offset: 2px; }
.cicc-ai-msg.user .cicc-ai-msg-bubble a { color: #93c5fd; }
.cicc-ai-msg-bubble strong, .cicc-ai-msg-bubble h1, .cicc-ai-msg-bubble h2, .cicc-ai-msg-bubble h3, .cicc-ai-msg-bubble h4 {
    font-weight: 600; color: #1e293b; margin: 6px 0 3px; font-size: 13px;
}
.cicc-ai-msg.user .cicc-ai-msg-bubble strong,
.cicc-ai-msg.user .cicc-ai-msg-bubble h1,
.cicc-ai-msg.user .cicc-ai-msg-bubble h2,
.cicc-ai-msg.user .cicc-ai-msg-bubble h3,
.cicc-ai-msg.user .cicc-ai-msg-bubble h4 { color: #fff; }
.cicc-ai-msg-bubble code {
    background: #f1f5f9; padding: 1px 4px; border-radius: 3px;
    font-size: 12px; font-family: 'SF Mono','Fira Code',monospace; color: #e11d48;
}
.cicc-ai-msg.user .cicc-ai-msg-bubble code { background: rgba(255,255,255,0.15); color: #fda4af; }
.cicc-ai-msg-bubble pre {
    background: #f1f5f9; padding: 8px 10px; border-radius: 6px;
    font-size: 11.5px; line-height: 1.4; overflow-x: auto; margin: 4px 0;
    border: 1px solid #e2e8f0;
}
.cicc-ai-msg.user .cicc-ai-msg-bubble pre { background: rgba(0,0,0,0.15); border-color: rgba(255,255,255,0.1); }
.cicc-ai-msg-bubble pre code { background: none; padding: 0; color: #334155; }
.cicc-ai-msg.user .cicc-ai-msg-bubble pre code { color: #e2e8f0; }
.cicc-ai-msg-bubble ul, .cicc-ai-msg-bubble ol { margin: 3px 0 4px 14px; padding: 0; }
.cicc-ai-msg-bubble li { margin-bottom: 1px; }
.cicc-ai-msg-bubble blockquote {
    margin: 4px 0; padding: 4px 8px; border-left: 3px solid #2563eb;
    background: #f8fafc; border-radius: 0 4px 4px 0;
    color: #475569;
}
.cicc-ai-msg.user .cicc-ai-msg-bubble blockquote { background: rgba(255,255,255,0.08); color: #cbd5e1; }
.cicc-ai-msg-bubble table { border-collapse: collapse; margin: 4px 0; font-size: 11px; width: 100%; }
.cicc-ai-msg-bubble th, .cicc-ai-msg-bubble td {
    border: 1px solid #e2e8f0; padding: 3px 6px; text-align: left;
}
.cicc-ai-msg-bubble th { background: #f8fafc; font-weight: 600; }
.cicc-ai-msg.user .cicc-ai-msg-bubble th, .cicc-ai-msg.user .cicc-ai-msg-bubble td { border-color: rgba(255,255,255,0.15); }
.cicc-ai-msg.user .cicc-ai-msg-bubble th { background: rgba(255,255,255,0.1); }
.cicc-ai-msg-bubble hr { border: none; border-top: 1px solid #e2e8f0; margin: 6px 0; }

/* ===== TYPING ===== */
.cicc-ai-typing .cicc-ai-msg-bubble {
    display: flex; gap: 3px; padding: 10px 12px; align-items: center;
}
.cicc-ai-typing .cicc-ai-msg-bubble span {
    width: 5px; height: 5px; border-radius: 50%;
    background: #cbd5e1; display: inline-block;
    animation: cicc-wave 1.4s infinite;
}
.cicc-ai-typing .cicc-ai-msg-bubble span:nth-child(2) { animation-delay: 0.2s; }
.cicc-ai-typing .cicc-ai-msg-bubble span:nth-child(3) { animation-delay: 0.4s; }
@keyframes cicc-wave { 0%,60%,100%{opacity:0.3;transform:scale(0.7)} 30%{opacity:1;transform:scale(1)} }

/* ===== INPUT ===== */
.cicc-ai-input-wrap {
    padding: 10px 14px 12px; flex-shrink: 0;
    background: #fff;
    border-top: 1px solid #e2e8f0;
}
.cicc-ai-input-inner {
    display: flex; align-items: flex-end; gap: 8px;
    background: #f1f5f9; border: 1px solid #e2e8f0;
    border-radius: 10px; padding: 3px 3px 3px 12px;
    transition: all 0.2s;
}
.cicc-ai-input-inner:focus-within {
    border-color: #93c5fd; background: #fff;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.08);
}
.cicc-ai-input {
    flex: 1; border: none; background: transparent;
    padding: 7px 0; font-size: 13px; line-height: 1.4;
    resize: none; outline: none; font-family: inherit;
    max-height: 72px; min-height: 20px; color: #1e293b;
}
.cicc-ai-input::placeholder { color: #94a3b8; }
.cicc-ai-send {
    width: 32px; height: 32px; border-radius: 8px; border: none;
    background: #2563eb; color: #fff;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: all 0.15s; flex-shrink: 0;
}
.cicc-ai-send:hover:not(:disabled) { background: #1d4ed8; transform: scale(1.05); }
.cicc-ai-send:disabled { opacity: 0.25; cursor: default; }

/* ===== SUGG CHIPS ===== */
.cicc-ai-sugg {
    padding: 0 0 8px 34px; display: flex; flex-wrap: wrap; gap: 4px;
}

/* ===== NOTICE ===== */
.cicc-ai-notice {
    text-align: center; padding: 6px 10px; font-size: 11px;
    color: #dc2626; background: #fef2f2; border-radius: 6px;
    margin: 4px 0; border: 1px solid #fecaca;
}

/* ===== MOBILE ===== */
@media (max-width: 480px) {
    .cicc-ai-panel { width: 100vw; height: 100dvh; right: 0; bottom: 0; border-radius: 0; }
    .cicc-ai-trigger { bottom: 16px; right: 16px; }
    .cicc-ai-body { padding: 12px; }
    .cicc-ai-input-wrap { padding: 8px 10px 10px; }
}
