/* === TRIGGER BUTTON === */
.touc-trigger {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    background: #1b5e4b;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: background 0.2s;
}
.touc-trigger:hover { background: #14503d; }
.touc-trigger svg { width: 24px; height: 24px; color: #fff; }
.touc-trigger .touc-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    background: #e74c3c;
    border-radius: 50%;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    padding: 0 4px;
}

/* === WIDGET WINDOW === */
.touc-widget {
    position: fixed;
    bottom: 90px;
    right: 24px;
    width: 400px;
    height: 600px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    z-index: 9998;
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.touc-widget.active { display: flex; }

/* === HEADER / TABS === */
.touc-header {
    border-bottom: 1px solid #e5e5e5;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 52px;
    flex-shrink: 0;
}
.touc-tabs {
    display: flex;
    gap: 20px;
}
.touc-tab {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #666;
    padding: 16px 0;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    background: none;
    border: none;
    transition: all 0.2s;
}
.touc-tab.active {
    color: #1b5e4b;
    border-bottom-color: #1b5e4b;
}
.touc-tab.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.touc-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.touc-close:hover { color: #242429; }

/* === CONTENT AREA === */
.touc-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #fff;
    display: flex;
    flex-direction: column;
}

/* === MESSAGES === */
.touc-messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.touc-message {
    max-width: 85%;
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}
.touc-message.user {
    margin-left: auto;
    background: #1b5e4b;
    color: #fff;
    border-radius: 8px 8px 2px 8px;
}
.touc-message.assistant,
.touc-message.incoming {
    margin-right: auto;
    background: #f4f4f4;
    color: #242429;
    border-radius: 8px 8px 8px 2px;
}
.touc-message-time {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    display: block;
}
.touc-message.user .touc-message-time { color: rgba(255,255,255,0.7); }

/* === INPUT === */
.touc-input-area {
    border-top: 1px solid #e5e5e5;
    padding: 12px 16px;
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex-shrink: 0;
    background: #fff;
}
.touc-input {
    flex: 1;
    border: none;
    resize: none;
    font-size: 14px;
    font-family: inherit;
    max-height: 100px;
    outline: none;
    padding: 4px 0;
    line-height: 1.4;
}
.touc-send {
    background: none;
    border: none;
    cursor: pointer;
    color: #1b5e4b;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.touc-send:disabled { color: #ccc; cursor: not-allowed; }

/* === QUICK ACTIONS === */
.touc-quick-action {
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    padding: 10px 14px;
    background: #fff;
    color: #1b5e4b;
    font-size: 13px;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s;
    width: 100%;
}
.touc-quick-action:hover {
    background: #f8f9fa;
    border-color: #1b5e4b;
}

/* === DM LIST === */
.touc-dm-list {
    display: flex;
    flex-direction: column;
}
.touc-dm-item {
    padding: 12px;
    border-bottom: 1px solid #f4f4f4;
    cursor: pointer;
    transition: background 0.15s;
}
.touc-dm-item:hover { background: #f8f9fa; }
.touc-dm-item.active { background: #f0f7f5; }
.touc-dm-item.unread {
    border-left: 3px solid #f4a261;
    padding-left: 9px;
}
.touc-dm-item.unread .touc-dm-name { font-weight: 600; color: #242429; }
.touc-dm-name { font-size: 14px; color: #242429; }
.touc-dm-company { font-size: 12px; color: #666; margin-top: 2px; }
.touc-dm-preview { font-size: 13px; color: #666; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.touc-dm-meta { display: flex; justify-content: space-between; margin-top: 6px; font-size: 11px; color: #999; }
.touc-unread-badge {
    background: #f4a261;
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    margin-left: 8px;
}

/* === LOCKED STATE === */
.touc-locked {
    text-align: center;
    padding: 40px 24px;
}
.touc-locked-title {
    font-size: 14px;
    font-weight: 600;
    color: #242429;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}
.touc-locked-text {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 24px;
}
.touc-locked-btn {
    display: inline-block;
    background: #1b5e4b;
    color: #fff;
    padding: 12px 24px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: background 0.2s;
}
.touc-locked-btn:hover { background: #14503d; }

/* === FULL PAGE === */
.touc-fullpage {
    display: flex;
    height: 600px;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.touc-sidebar {
    width: 35%;
    border-right: 1px solid #e5e5e5;
    background: #fff;
    display: flex;
    flex-direction: column;
}
.touc-sidebar-header {
    padding: 16px;
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.touc-sidebar-title {
    font-size: 16px;
    font-weight: 600;
    color: #242429;
}
.touc-new-msg-btn {
    background: #1b5e4b;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
}
.touc-new-msg-btn:hover { background: #14503d; }
.touc-main {
    width: 65%;
    background: #fff;
    display: flex;
    flex-direction: column;
    position: relative;
}
.touc-main-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    flex-direction: column;
}
.touc-search-box {
    padding: 12px 16px;
    border-bottom: 1px solid #e5e5e5;
}
.touc-search-box input {
    width: 100%;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 13px;
    outline: none;
}
.touc-search-box input:focus { border-color: #1b5e4b; }

/* === CHAT HEADER === */
.touc-chat-header {
    padding: 12px 16px;
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.touc-chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f4f4f4;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    color: #1b5e4b;
    overflow: hidden;
    flex-shrink: 0;
}
.touc-chat-avatar img { width: 100%; height: 100%; object-fit: cover; }
.touc-chat-info { flex: 1; }
.touc-chat-name { font-size: 14px; font-weight: 600; color: #242429; }
.touc-chat-company { font-size: 12px; color: #666; }

/* === CHAT MESSAGES === */
.touc-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #fafafa;
}

/* === ATTACHMENTS === */
.touc-attachment {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    padding: 8px 12px;
    margin-top: 8px;
    text-decoration: none;
    color: #242429;
    font-size: 13px;
    max-width: 100%;
}
.touc-attachment:hover { border-color: #1b5e4b; background: #f8f9fa; }
.touc-attachment-icon { width: 24px; height: 24px; flex-shrink: 0; font-size: 18px; }
.touc-attachment-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* === INPUT AREA === */
.touc-chat-input-area {
    border-top: 1px solid #e5e5e5;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
    background: #fff;
}
.touc-chat-input-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}
.touc-chat-input {
    flex: 1;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    resize: none;
    font-size: 14px;
    font-family: inherit;
    max-height: 100px;
    outline: none;
    padding: 8px 12px;
    line-height: 1.4;
}
.touc-chat-input:focus { border-color: #1b5e4b; }
.touc-chat-send {
    background: #1b5e4b;
    color: #fff;
    border: none;
    border-radius: 6px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s;
}
.touc-chat-send:hover { background: #14503d; }
.touc-chat-send:disabled { background: #ccc; cursor: not-allowed; }

/* === ATTACHMENT INPUT === */
.touc-attach-row { display: flex; align-items: center; gap: 8px; }
.touc-attach-btn {
    background: none;
    border: 1px dashed #ccc;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 12px;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}
.touc-attach-btn:hover { border-color: #1b5e4b; color: #1b5e4b; }
.touc-attach-preview { display: flex; gap: 8px; flex-wrap: wrap; }
.touc-attach-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f4f4f4;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    color: #666;
}
.touc-attach-chip button {
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
    font-size: 14px;
    line-height: 1;
    padding: 0;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.touc-attach-chip button:hover { color: #e74c3c; }

/* === DRAG OVERLAY === */
.touc-drag-overlay {
    position: absolute;
    inset: 0;
    background: rgba(27, 94, 75, 0.1);
    border: 2px dashed #1b5e4b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #1b5e4b;
    font-weight: 600;
    z-index: 10;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}
.touc-drag-overlay.active { opacity: 1; }

/* === MODAL === */
.touc-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.touc-modal {
    background: #fff;
    border-radius: 8px;
    width: 100%;
    max-width: 480px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.touc-modal-header {
    padding: 16px;
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.touc-modal-header h3 { margin: 0; font-size: 16px; font-weight: 600; }
.touc-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    line-height: 1;
}
.touc-modal-close:hover { color: #242429; }
.touc-modal-body { padding: 16px; overflow-y: auto; flex: 1; }
.touc-user-search input {
    width: 100%;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 14px;
    outline: none;
    margin-bottom: 12px;
}
.touc-user-search input:focus { border-color: #1b5e4b; }
.touc-user-results { display: flex; flex-direction: column; gap: 4px; }
.touc-user-result {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
}
.touc-user-result:hover { background: #f8f9fa; }
.touc-user-result-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f4f4f4;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: #1b5e4b;
    overflow: hidden;
    flex-shrink: 0;
}
.touc-user-result-avatar img { width: 100%; height: 100%; object-fit: cover; }
.touc-user-result-info { flex: 1; }
.touc-user-result-name { font-size: 14px; font-weight: 600; color: #242429; }
.touc-user-result-meta { font-size: 12px; color: #666; margin-top: 2px; }

/* === TYPING === */
.touc-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}
.touc-typing span {
    width: 6px;
    height: 6px;
    background: #999;
    border-radius: 50%;
    animation: toucPulse 1.4s infinite ease-in-out both;
}
.touc-typing span:nth-child(1) { animation-delay: -0.32s; }
.touc-typing span:nth-child(2) { animation-delay: -0.16s; }
@keyframes toucPulse {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* === MOBILE === */
@media (max-width: 768px) {
    .touc-trigger { width: 48px; height: 48px; bottom: 16px; right: 16px; }
    .touc-widget { width: 100vw; height: 100vh; bottom: 0; right: 0; border-radius: 0; }
    .touc-fullpage { flex-direction: column; height: auto; min-height: 500px; }
    .touc-sidebar { width: 100%; height: 40vh; border-right: none; border-bottom: 1px solid #e5e5e5; }
    .touc-main { width: 100%; height: 60vh; }
}
