/* CiCC AI Platform — Chat Widget */
#cicc-pf-widget { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }

/* FAB */
.cicc-pf-fab {
    position: fixed; bottom: 24px; right: 24px; z-index: 999999;
    width: 56px; height: 56px; border-radius: 50%;
    background: linear-gradient(135deg, #1a237e 0%, #283593 100%);
    color: #fff; border: none; font-size: 26px; cursor: pointer;
    box-shadow: 0 4px 20px rgba(26,35,126,.4);
    transition: all .3s ease;
}
.cicc-pf-fab:hover { transform: scale(1.1); box-shadow: 0 6px 28px rgba(26,35,126,.5); }
.cicc-pf-fab.active { transform: rotate(45deg); }

/* Tooltip */
.cicc-pf-tooltip {
    position: fixed; bottom: 88px; right: 24px; z-index: 999998;
    background: #1e293b; color: #e2e8f0; padding: 8px 16px;
    border-radius: 8px; font-size: 13px; white-space: nowrap;
    animation: cicc-pf-bounce 2s ease-in-out infinite;
    cursor: pointer;
}
.cicc-pf-tooltip::after {
    content: ''; position: absolute; bottom: -6px; right: 24px;
    border-left: 6px solid transparent; border-right: 6px solid transparent;
    border-top: 6px solid #1e293b;
}
@keyframes cicc-pf-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

/* Modal */
.cicc-pf-modal {
    position: fixed; bottom: 90px; right: 24px; z-index: 999997;
    width: 380px; max-height: 560px;
    background: #fff; border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,.18);
    display: flex; flex-direction: column;
    overflow: hidden;
    animation: cicc-pf-slideUp .35s ease;
}
@keyframes cicc-pf-slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.cicc-pf-header {
    background: linear-gradient(135deg, #1a237e, #283593);
    color: #fff; padding: 14px 18px; font-weight: 600;
    display: flex; justify-content: space-between; align-items: center;
}
.cicc-pf-header-actions { display: flex; align-items: center; gap: 10px; }
.cicc-pf-header-actions button {
    background: none; border: none; color: #fff; font-size: 18px; cursor: pointer; padding: 0 4px;
}
.cicc-pf-status { font-size: 16px; }
.cicc-pf-status.online { color: #22c55e; }
.cicc-pf-status.offline { color: #ef4444; }
.cicc-pf-status.thinking { color: #f59e0b; animation: cicc-pf-pulse 1s infinite; }
@keyframes cicc-pf-pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

.cicc-pf-messages {
    flex: 1; overflow-y: auto; padding: 16px;
    background: #f8fafc; min-height: 300px; max-height: 420px;
}
.cicc-pf-msg { margin-bottom: 14px; display: flex; gap: 8px; }
.cicc-pf-msg-bot { align-items: flex-start; }
.cicc-pf-msg-user { flex-direction: row-reverse; }
.cicc-pf-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; flex-shrink: 0;
}
.cicc-pf-msg-bot .cicc-pf-avatar { background: #e8eaf6; }
.cicc-pf-msg-user .cicc-pf-avatar { background: #1a237e; }
.cicc-pf-bubble {
    max-width: 80%; padding: 10px 14px; border-radius: 12px;
    font-size: 14px; line-height: 1.5; word-wrap: break-word;
}
.cicc-pf-msg-bot .cicc-pf-bubble { background: #fff; color: #1e293b; border: 1px solid #e2e8f0; border-top-left-radius: 4px; }
.cicc-pf-msg-user .cicc-pf-bubble { background: #1a237e; color: #fff; border-top-right-radius: 4px; }
.cicc-pf-bubble p { margin: 0 0 8px; }
.cicc-pf-bubble p:last-child { margin-bottom: 0; }
.cicc-pf-bubble a { color: #3b82f6; text-decoration: underline; }
.cicc-pf-bubble code {
    background: #f1f5f9; padding: 1px 4px; border-radius: 3px; font-size: 12px;
}
.cicc-pf-msg-user .cicc-pf-bubble code { background: rgba(255,255,255,.15); color: #fff; }
.cicc-pf-bubble strong { font-weight: 600; }
.cicc-pf-bubble ul, .cicc-pf-bubble ol { margin: 4px 0 4px 16px; padding: 0; }

/* Typing indicator */
.cicc-pf-typing .cicc-pf-bubble { display: flex; gap: 4px; padding: 14px 16px; }
.cicc-pf-typing .cicc-pf-bubble span {
    width: 8px; height: 8px; border-radius: 50%; background: #94a3b8;
    animation: cicc-pf-typing 1.4s infinite;
}
.cicc-pf-typing .cicc-pf-bubble span:nth-child(2) { animation-delay: .2s; }
.cicc-pf-typing .cicc-pf-bubble span:nth-child(3) { animation-delay: .4s; }
@keyframes cicc-pf-typing { 0%,60%,100%{opacity:.3;transform:scale(.8)} 30%{opacity:1;transform:scale(1)} }

/* Input */
.cicc-pf-input-area {
    display: flex; padding: 10px 14px; border-top: 1px solid #e2e8f0;
    background: #fff; gap: 8px;
}
.cicc-pf-input {
    flex: 1; border: 1px solid #e2e8f0; border-radius: 8px;
    padding: 8px 12px; font-size: 14px; resize: none; outline: none;
    font-family: inherit; max-height: 80px;
}
.cicc-pf-input:focus { border-color: #3b82f6; }
.cicc-pf-send {
    width: 40px; height: 40px; border-radius: 8px;
    background: #1a237e; color: #fff; border: none; font-size: 18px;
    cursor: pointer; transition: all .15s; align-self: flex-end;
}
.cicc-pf-send:disabled { opacity: .3; cursor: default; }
.cicc-pf-send:hover:not(:disabled) { background: #283593; }

/* Rating */
.cicc-pf-rating { display: flex; gap: 4px; margin-top: 6px; }
.cicc-pf-rating button {
    background: none; border: none; font-size: 18px; cursor: pointer; padding: 0 2px;
    opacity: .3; transition: all .15s;
}
.cicc-pf-rating button:hover, .cicc-pf-rating button.active { opacity: 1; }

/* Markdown table */
.cicc-pf-bubble table { border-collapse: collapse; margin: 8px 0; font-size: 13px; width: 100%; }
.cicc-pf-bubble th, .cicc-pf-bubble td { border: 1px solid #e2e8f0; padding: 4px 8px; text-align: left; }
.cicc-pf-bubble th { background: #f1f5f9; font-weight: 600; }

/* Suggested questions chips */
.cicc-pf-suggestions {
    padding: 4px 0 12px 44px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.cicc-pf-chip {
    background: #e8eaf6;
    border: 1px solid #c5cae9;
    border-radius: 16px;
    padding: 6px 14px;
    font-size: 13px;
    color: #1a237e;
    cursor: pointer;
    transition: all .15s;
    font-family: inherit;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cicc-pf-chip:hover {
    background: #1a237e;
    color: #fff;
    border-color: #1a237e;
}

/* Mobile */
@media (max-width: 480px) {
    .cicc-pf-modal { width: 90vw; right: 5vw; bottom: 80px; max-height: 70vh; }
    .cicc-pf-fab { bottom: 16px; right: 16px; }
}
