:root {
    --tc-pub-primary: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    --tc-pub-bg: rgba(255, 255, 255, 0.98);
    --tc-pub-text: #0f172a;
    --tc-pub-text-light: #64748b;
    --tc-pub-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --tc-pub-radius: 24px;
    --tc-pub-accent: #4f46e5;
}

.tc-widget-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 999999;
    font-family: 'Outfit', 'Inter', -apple-system, sans-serif;
}

.tc-toggle-btn {
    width: 68px;
    height: 68px;
    border-radius: 22px;
    background: var(--tc-pub-primary);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 10px 20px -5px rgba(79, 70, 229, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.tc-toggle-btn:hover {
    transform: translateY(-5px) scale(1.05);
}

.tc-toggle-btn svg {
    width: 32px;
    height: 32px;
}

.tc-chat-window {
    position: absolute;
    bottom: 85px;
    right: 0;
    width: 420px;
    height: 700px;
    max-height: calc(100vh - 150px);
    background: var(--tc-pub-bg);
    backdrop-filter: blur(10px);
    border-radius: var(--tc-pub-radius);
    box-shadow: var(--tc-pub-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    animation: tc-slide-up 0.5s cubic-bezier(0.19, 1, 0.22, 1);
}

/* Almost Full Screen Mode */
.tc-chat-window.tc-fullscreen {
    position: fixed;
    top: 10%;
    left: 10%;
    width: 80% !important;
    height: 80% !important;
    max-height: 80% !important;
    bottom: auto;
    right: auto;
    transform: none !important;
    z-index: 1000000;
}

@media (max-width: 500px) {
    .tc-chat-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 100px);
        bottom: 80px;
        right: -10px;
    }
}

@keyframes tc-slide-up {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.tc-chat-header {
    padding: 20px 25px;
    background: var(--tc-pub-primary);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.tc-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.tc-icon-btn,
.tc-close-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.tc-icon-btn:hover,
.tc-close-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.tc-pre-chat {
    padding: 35px;
    flex: 1;
    overflow-y: auto;
}

.tc-form-group {
    margin-bottom: 20px;
}

.tc-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--tc-pub-text);
}

.tc-form-group input,
.tc-form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid #e2e8f0;
    border-radius: 14px;
    font-size: 14px;
    color: var(--tc-pub-text);
    background: #fff;
}

.tc-btn-start {
    width: 100%;
    padding: 15px;
    background: var(--tc-pub-primary);
    color: white;
    border: none;
    border-radius: 14px;
    font-weight: 700;
    cursor: pointer;
}

.tc-chat-interface {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f8fafc;
    overflow: hidden;
}

.tc-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto !important;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
}

.tc-msg {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.tc-msg.visitor {
    background: var(--tc-pub-primary);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.tc-msg.support {
    background: white;
    color: var(--tc-pub-text);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.tc-chat-footer {
    padding: 15px 20px;
    background: white;
    border-top: 1px solid #f1f5f9;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
    position: relative;
}

.tc-footer-actions {
    display: flex;
    gap: 5px;
}

.tc-action-btn {
    background: #f1f5f9;
    color: var(--tc-pub-text-light);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.tc-chat-footer textarea {
    flex: 1;
    border: none;
    background: #f1f5f9;
    padding: 10px 15px;
    border-radius: 15px;
    font-size: 14px;
    max-height: 100px;
    resize: none;
    color: var(--tc-pub-text);
}

.tc-send-btn {
    background: var(--tc-pub-primary);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.tc-action-btn:hover {
    background: #e2e8f0;
    color: var(--tc-pub-text);
}

.tc-send-btn:hover {
    transform: scale(1.05);
}

/* Premium Emoji Picker */
.tc-emoji-picker {
    position: absolute;
    bottom: 80px;
    left: 20px;
    width: 320px;
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
    padding: 0;
    z-index: 1000;
    border: 1px solid rgba(0, 0, 0, 0.05);
    overflow: hidden;
    animation: tc-emoji-pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes tc-emoji-pop {
    from {
        transform: translateY(20px) scale(0.9);
        opacity: 0;
    }

    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.tc-emoji-header {
    padding: 15px 20px;
    background: #f8fafc;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
    font-weight: 700;
    color: var(--tc-pub-text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.tc-emoji-header::before {
    content: '✨';
}

.tc-emoji-list {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    max-height: 280px;
    overflow-y: auto;
    padding: 15px;
    background: #ffffff;
}

.tc-emoji-item {
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    border-radius: 12px;
    text-align: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tc-emoji-item:hover {
    background: #f1f5f9;
    transform: scale(1.25) rotate(5deg);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.tc-emoji-item:active {
    transform: scale(0.95);
}

/* Custom Scrollbar for Emoji List */
.tc-emoji-list::-webkit-scrollbar {
    width: 6px;
}

.tc-emoji-list::-webkit-scrollbar-track {
    background: transparent;
}

.tc-emoji-list::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 10px;
}

.tc-emoji-list::-webkit-scrollbar-thumb:hover {
    background: #cbd5e1;
}

/* File Links in Chat */
.tc-file-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: inherit;
    text-decoration: underline;
    font-weight: 600;
}

/* Modal Styles (Theme Independent) */
.tc-modal {
    display: none;
    position: fixed;
    z-index: 2000000;
    /* Higher than fullscreen chat */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    font-family: 'Outfit', 'Inter', sans-serif;
}

.tc-modal-content {
    position: relative;
    background-color: #fff;
    margin: 5% auto;
    padding: 0;
    width: 80%;
    max-width: 900px;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    animation: tc-modal-in 0.3s ease-out;
}

@keyframes tc-modal-in {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.tc-modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
}

.tc-modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: #0f172a;
}

.tc-modal-close {
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #64748b;
    line-height: 1;
}

.tc-modal-close:hover {
    color: #0f172a;
}

.tc-modal-body {
    padding: 30px;
    text-align: center;
    max-height: 60vh;
    overflow-y: auto;
    background: #fff;
}

.tc-modal-body img {
    max-width: 100%;
    border-radius: 8px;
}

.tc-modal-body video,
.tc-modal-body audio {
    width: 100%;
}

.tc-modal-body iframe {
    width: 100%;
    height: 500px;
    border: none;
    border-radius: 8px;
}

.tc-modal-footer {
    padding: 20px 25px;
    border-top: 1px solid #eee;
    text-align: right;
    background: #f8fafc;
}

.tc-btn-secondary {
    padding: 10px 20px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    color: #0f172a;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s;
    cursor: pointer;
    display: inline-block;
}

.tc-btn-secondary:hover {
    background: #f8fafc;
    border-color: #64748b;
}