/* public/widget.css */
:root {
    --tc-primary: #0078d4;
    --tc-primary-dark: #005a9e;
    --tc-gradient: linear-gradient(135deg, #0078d4 0%, #00bcf2 100%);
    --tc-bg: #ffffff;
    --tc-msg-user: #0078d4;
    --tc-msg-agent: #f3f2f1;
    --tc-text: #323130;
    --tc-text-secondary: #605e5c;
    --tc-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    --tc-radius: 16px;
}

#tc-chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 380px;
    height: 520px;
    background: rgba(255, 255, 255, 0.98);
    border-radius: var(--tc-radius);
    box-shadow: var(--tc-shadow);
    display: none;
    flex-direction: column;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    overflow: hidden;
    z-index: 999999;
    border: 1px solid #edebe9;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    opacity: 0;
    transform: translateY(20px) scale(0.95);
}

#tc-chat-widget.active {
    display: flex;
    opacity: 1;
    transform: translateY(0) scale(1);
}

.hidden {
    display: none !important;
}

#tc-chat-header {
    background: var(--tc-gradient);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

#tc-chat-header-info {
    display: flex;
    flex-direction: column;
}

#tc-chat-header-title {
    font-size: 16px;
}

#tc-chat-status {
    font-size: 11px;
    opacity: 0.8;
    font-weight: 400;
    display: flex;
    align-items: center;
    gap: 4px;
}

#tc-chat-status::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4ade80;
}

#tc-chat-status.offline::before {
    background: #ff4d4d;
}

#tc-chat-close {
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    transition: background 0.2s;
    font-size: 20px;
}

#tc-chat-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

#tc-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #faf9f8;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

.tc-message {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tc-message.user {
    align-self: flex-end;
    background: var(--tc-msg-user);
    color: white;
    border-bottom-right-radius: 2px;
}

.tc-message.agent {
    align-self: flex-start;
    background: var(--tc-msg-agent);
    color: var(--tc-text);
    border-bottom-left-radius: 2px;
}

.tc-message-sender {
    font-size: 11px;
    font-weight: 700;
    color: var(--tc-primary);
    margin-bottom: 4px;
    text-transform: capitalize;
}

.tc-message-text {
    word-break: break-word;
}

.tc-message-time {
    font-size: 10px;
    margin-top: 4px;
    opacity: 0.6;
    display: block;
    text-align: right;
}

.tc-message.agent .tc-message-time {
    text-align: left;
}

.tc-message.system {
    align-self: center;
    background: transparent;
    color: var(--tc-text-secondary);
    font-size: 11px;
    font-style: italic;
    opacity: 0.7;
    text-align: center;
    max-width: 100%;
}

/* Form Styles */
#tc-chat-form-container {
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1;
    justify-content: center;
}

.tc-form-instruction {
    font-size: 14px;
    color: var(--tc-text-secondary);
    margin-bottom: 8px;
    text-align: center;
}

#tc-chat-form-container input {
    border: 1px solid #edebe9;
    border-radius: 8px;
    padding: 12px 16px;
    outline: none;
    font-size: 14px;
    transition: border-color 0.2s;
}

#tc-chat-form-container input:focus {
    border-color: var(--tc-primary);
}

#tc-chat-form-submit {
    background: var(--tc-gradient);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    margin-top: 10px;
}

#tc-chat-form-submit:hover {
    opacity: 0.9;
}

#tc-chat-input-area {
    padding: 16px;
    border-top: 1px solid #edebe9;
    background: white;
    display: flex;
    gap: 12px;
    align-items: center;
}

#tc-chat-input {
    flex: 1;
    border: 1px solid #edebe9;
    border-radius: 24px;
    padding: 10px 16px;
    outline: none;
    font-size: 14px;
    transition: border-color 0.2s;
}

#tc-chat-input:focus {
    border-color: var(--tc-primary);
}

#tc-chat-send {
    background: var(--tc-primary);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
}

#tc-chat-send:hover {
    background: var(--tc-primary-dark);
    transform: scale(1.05);
}

#tc-chat-send:disabled {
    background: #c8c6c4;
    cursor: not-allowed;
}

/* Floating bubble */
#tc-chat-bubble {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    background: var(--tc-gradient);
    border-radius: 30px;
    box-shadow: 0 4px 20px rgba(0, 120, 212, 0.4);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    z-index: 999998;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-size: 24px;
}

#tc-chat-bubble:hover {
    transform: scale(1.1) rotate(5deg);
}

#tc-chat-bubble.hidden {
    transform: scale(0) rotate(-45deg);
    opacity: 0;
    pointer-events: none;
}