#c2s-chat-container {
    --c2s-primary: #F97316;
    --c2s-primary-light: rgba(249, 115, 22, 0.1);
    --c2s-primary-dark: #ea580c;
    --c2s-bg: #ffffff;
    --c2s-bg-secondary: #f9fafb;
    --c2s-text: #1f2937;
    --c2s-text-secondary: #6b7280;
    --c2s-border: #e5e7eb;
    --c2s-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    --c2s-radius: 16px;
    --c2s-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    position: fixed;
    z-index: 999999;
    bottom: 20px;
    right: 20px;
}

@media (prefers-color-scheme: dark) {
    #c2s-chat-container.c2s-dark-mode {
        --c2s-bg: #1f2937;
        --c2s-bg-secondary: #374151;
        --c2s-text: #f9fafb;
        --c2s-text-secondary: #9ca3af;
        --c2s-border: #4b5563;
        --c2s-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    }
}

.c2s-chat-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--c2s-primary);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(249, 115, 22, 0.4);
    transition: var(--c2s-transition);
    position: relative;
}

.c2s-chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(249, 115, 22, 0.5);
}

.c2s-chat-button:active {
    transform: scale(0.95);
}

.c2s-chat-button--open {
    transform: rotate(90deg) scale(0.9);
}

.c2s-chat-button svg {
    width: 28px;
    height: 28px;
    transition: var(--c2s-transition);
}

.c2s-chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    animation: c2s-badge-pulse 2s infinite;
}

@keyframes c2s-badge-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.c2s-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 400px;
    height: 600px;
    max-height: calc(100vh - 120px);
    background: var(--c2s-bg);
    border-radius: var(--c2s-radius);
    box-shadow: var(--c2s-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: var(--c2s-transition);
}

.c2s-chat-window--open {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.c2s-chat-header {
    background: var(--c2s-primary);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.c2s-chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.c2s-chat-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.c2s-chat-avatar svg {
    width: 24px;
    height: 24px;
}

.c2s-chat-header-text {
    display: flex;
    flex-direction: column;
}

.c2s-chat-title {
    font-weight: 600;
    font-size: 16px;
}

.c2s-chat-status {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 4px;
}

.c2s-chat-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    display: inline-block;
}

.c2s-chat-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--c2s-transition);
}

.c2s-chat-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.c2s-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--c2s-bg-secondary);
}

.c2s-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.c2s-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.c2s-chat-messages::-webkit-scrollbar-thumb {
    background: var(--c2s-border);
    border-radius: 3px;
}

.c2s-message {
    display: flex;
    flex-direction: column;
    max-width: 80%;
    animation: c2s-message-appear 0.3s ease-out;
}

@keyframes c2s-message-appear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.c2s-message--bot {
    align-self: flex-start;
}

.c2s-message--customer {
    align-self: flex-end;
}

.c2s-message-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    word-wrap: break-word;
}

.c2s-message--bot .c2s-message-bubble {
    background: var(--c2s-bg);
    color: var(--c2s-text);
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.c2s-message--customer .c2s-message-bubble {
    background: var(--c2s-primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.c2s-message-text {
    display: block;
}

.c2s-message-time {
    font-size: 11px;
    color: var(--c2s-text-secondary);
    margin-top: 4px;
    opacity: 0.7;
}

.c2s-message--customer .c2s-message-time {
    text-align: right;
}

.c2s-chat-typing {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--c2s-text-secondary);
    font-size: 13px;
    background: var(--c2s-bg-secondary);
}

.c2s-typing-indicator {
    display: flex;
    gap: 4px;
}

.c2s-typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--c2s-primary);
    border-radius: 50%;
    animation: c2s-typing-bounce 1.4s infinite ease-in-out;
}

.c2s-typing-indicator span:nth-child(1) {
    animation-delay: 0s;
}

.c2s-typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.c2s-typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes c2s-typing-bounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.c2s-chat-input {
    padding: 16px 20px;
    background: var(--c2s-bg);
    border-top: 1px solid var(--c2s-border);
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}

.c2s-chat-input input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--c2s-border);
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: var(--c2s-transition);
    background: var(--c2s-bg);
    color: var(--c2s-text);
}

.c2s-chat-input input:focus {
    border-color: var(--c2s-primary);
    box-shadow: 0 0 0 3px var(--c2s-primary-light);
}

.c2s-chat-input input::placeholder {
    color: var(--c2s-text-secondary);
}

.c2s-chat-input button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--c2s-primary);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--c2s-transition);
    flex-shrink: 0;
}

.c2s-chat-input button:hover {
    background: var(--c2s-primary-dark);
    transform: scale(1.05);
}

.c2s-chat-input button:active {
    transform: scale(0.95);
}

.c2s-chat-input button svg {
    width: 20px;
    height: 20px;
}

.c2s-chat-footer {
    padding: 10px 20px;
    text-align: center;
    font-size: 11px;
    color: var(--c2s-text-secondary);
    background: var(--c2s-bg);
    border-top: 1px solid var(--c2s-border);
    flex-shrink: 0;
}

.c2s-chat-footer strong {
    color: var(--c2s-primary);
    font-weight: 600;
}

@media (max-width: 480px) {
    #c2s-chat-container {
        bottom: 0;
        right: 0;
        left: 0;
    }

    .c2s-chat-button {
        position: fixed;
        bottom: 20px;
        right: 20px;
    }

    .c2s-chat-window {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .c2s-chat-window--open {
        transform: translateY(0) scale(1);
    }

    .c2s-chat-header {
        padding: 16px;
        border-radius: 0;
    }

    .c2s-message {
        max-width: 85%;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .c2s-chat-window {
        width: 360px;
        height: 550px;
    }
}

#c2s-chat-container * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

#c2s-chat-container *:focus-visible {
    outline: 2px solid var(--c2s-primary);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    #c2s-chat-container *,
    #c2s-chat-container *::before,
    #c2s-chat-container *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
