/* 右下角在线客服浮窗 */
.csw-root {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 10050;
    font-family: var(--font-sans, 'Noto Sans SC', sans-serif);
}

.csw-fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, #c9a227 0%, #8b6914 100%);
    color: #0f0a1a;
    box-shadow: 0 8px 24px rgba(201, 162, 39, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.csw-fab:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 28px rgba(201, 162, 39, 0.45);
}

.csw-fab-icon {
    width: 26px;
    height: 26px;
}

.csw-fab-icon-close {
    display: none;
}

.csw-root.is-open .csw-fab-icon-chat {
    display: none;
}

.csw-root.is-open .csw-fab-icon-close {
    display: block;
}

.csw-fab-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #e74c3c;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
}

.csw-panel {
    position: absolute;
    right: 0;
    bottom: 68px;
    width: min(360px, calc(100vw - 32px));
    height: min(520px, calc(100vh - 120px));
    background: #12101c;
    border: 1px solid rgba(201, 162, 39, 0.25);
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.csw-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(201, 162, 39, 0.15), rgba(15, 10, 26, 0.9));
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.csw-title {
    display: block;
    font-size: 15px;
    color: #f5f0e6;
}

.csw-subtitle {
    display: block;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 2px;
}

.csw-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}

.csw-guest {
    padding: 32px 24px;
    text-align: center;
    color: rgba(255, 255, 255, 0.75);
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 16px;
}

.csw-guest-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.csw-btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

.csw-btn-primary {
    background: #c9a227;
    color: #0f0a1a;
}

.csw-btn-ghost {
    border: 1px solid rgba(201, 162, 39, 0.5);
    color: #c9a227;
}

.csw-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.csw-agent-bar {
    padding: 8px 12px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.65);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.csw-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(201, 162, 39, 0.15);
    color: #c9a227;
    font-size: 11px;
}

.csw-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.csw-empty {
    text-align: center;
    color: rgba(255, 255, 255, 0.45);
    font-size: 13px;
    margin: auto;
    padding: 24px 12px;
}

.csw-msg {
    max-width: 88%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
}

.csw-msg-user {
    align-self: flex-end;
    background: rgba(201, 162, 39, 0.2);
    border: 1px solid rgba(201, 162, 39, 0.3);
    color: #f5f0e6;
}

.csw-msg-agent {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #e8e4dc;
}

.csw-msg-meta {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.45);
    margin-bottom: 4px;
}

.csw-compose {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.2);
}

.csw-compose.is-closed {
    opacity: 0.55;
}

.csw-compose textarea {
    flex: 1;
    resize: none;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    color: #f5f0e6;
    padding: 8px 10px;
    font-family: inherit;
    font-size: 13px;
}

.csw-compose textarea:focus {
    outline: none;
    border-color: rgba(201, 162, 39, 0.5);
}

.csw-send {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 10px;
    background: #c9a227;
    color: #0f0a1a;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.csw-send svg {
    width: 18px;
    height: 18px;
}

@media (max-width: 768px) {
    .csw-root {
        right: 16px;
        bottom: 76px;
    }
}
