/* ============================================================
   Teams Live Chat Widget — Teams Blue Theme (#0078d4)
   ============================================================ */

/* Reset for widget scope */
.tlc-widget,
.tlc-widget *,
.tlc-widget *::before,
.tlc-widget *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 13px;
}

/* ---- Chat Bubble ---- */

.tlc-bubble {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #0078d4;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    z-index: 99999;
}

.tlc-bubble:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.tlc-bubble:active {
    transform: scale(0.96);
}

/* Unread badge */
.tlc-unread-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #e81123;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}

/* ---- Chat Panel ---- */

.tlc-panel {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 370px;
    height: 520px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 99999;
    animation: tlc-slide-up 0.3s ease;
}

@keyframes tlc-slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---- Header ---- */

.tlc-header {
    background: #0078d4;
    color: #fff;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

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

.tlc-header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tlc-header-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
}

.tlc-header-status {
    font-size: 12px;
    opacity: 0.85;
    line-height: 1.3;
}

.tlc-minimize {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.15s;
}

.tlc-minimize:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.15);
}

/* ---- Body (form & chat share this) ---- */

.tlc-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

/* ---- Contact Form ---- */

.tlc-welcome {
    padding: 24px 20px 8px;
}

.tlc-welcome h3 {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 4px;
}

.tlc-welcome p {
    font-size: 11px;
    color: #666;
    line-height: 1.4;
}

.tlc-form {
    padding: 12px 20px 20px;
}

.tlc-field {
    margin-bottom: 14px;
}

.tlc-field label {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: #333;
    margin-bottom: 3px;
}

.tlc-required {
    color: #e81123;
}

.tlc-widget .tlc-field input:not([type=submit]),
.tlc-widget .tlc-field textarea {
    width: 100%;
    padding: 4px 10px;
    font-size: 14px !important;
    line-height: 1.3 !important;
    border: 1.5px solid #d1d5db;
    border-radius: 6px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    background: #fff;
    color: #1a1a1a;
    resize: none;
}

.tlc-field input:focus,
.tlc-field textarea:focus {
    border-color: #0078d4;
    box-shadow: 0 0 0 3px rgba(0, 120, 212, 0.15);
}

.tlc-widget .tlc-field input::placeholder,
.tlc-widget .tlc-field textarea::placeholder {
    color: #9ca3af;
    font-size: 14px !important;
}

.tlc-submit-btn {
    width: 100%;
    padding: 12px;
    background: #0078d4;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.tlc-submit-btn:hover {
    background: #106ebe;
}

.tlc-submit-btn:disabled {
    background: #93c5fd;
    cursor: not-allowed;
}

.tlc-form-error {
    margin-top: 10px;
    padding: 10px;
    background: #fef2f2;
    color: #dc2626;
    border-radius: 6px;
    font-size: 13px;
    text-align: center;
}

/* ---- Chat View ---- */

#tlc-chat-view {
    flex-direction: column;
}

.tlc-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Message bubbles */
.tlc-msg {
    display: flex;
    flex-direction: column;
    max-width: 80%;
}

.tlc-msg-visitor {
    align-self: flex-end;
    align-items: flex-end;
}

.tlc-msg-agent {
    align-self: flex-start;
    align-items: flex-start;
}

.tlc-msg-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.45;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.tlc-msg-visitor .tlc-msg-bubble {
    background: #0078d4;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.tlc-msg-agent .tlc-msg-bubble {
    background: #f0f0f0;
    color: #1a1a1a;
    border-bottom-left-radius: 4px;
}

.tlc-msg-time {
    font-size: 11px;
    color: #999;
    margin-top: 3px;
    padding: 0 4px;
}

.tlc-msg-system {
    text-align: center;
    font-size: 12px;
    color: #999;
    padding: 4px 0;
    font-style: italic;
}

/* Input area */
.tlc-input-area {
    padding: 12px 16px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    flex-shrink: 0;
    background: #fff;
}

.tlc-message-input {
    flex: 1;
    padding: 10px 12px;
    font-size: 14px;
    border: 1.5px solid #d1d5db;
    border-radius: 20px;
    outline: none;
    resize: none;
    max-height: 100px;
    line-height: 1.4;
    transition: border-color 0.15s;
    background: #fff;
    color: #1a1a1a;
}

.tlc-message-input:focus {
    border-color: #0078d4;
}

.tlc-message-input::placeholder {
    color: #9ca3af;
}

.tlc-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #0078d4;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}

.tlc-send-btn:hover {
    background: #106ebe;
}

/* ---- Mobile Responsive ---- */

@media (max-width: 480px) {
    .tlc-panel {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .tlc-bubble {
        bottom: 16px;
        right: 16px;
    }
}

/* ---- Scrollbar Styling ---- */

.tlc-messages::-webkit-scrollbar {
    width: 5px;
}

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

.tlc-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.tlc-messages::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* ---- Body scrollable form ---- */

#tlc-form-view {
    overflow-y: auto;
}

/* ---- Department Selection View ---- */

#tlc-dept-view {
    overflow-y: auto;
}

.tlc-dept-options {
    display: flex;
    gap: 12px;
    padding: 12px 20px 0;
}

.tlc-dept-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 12px;
    border: 2px solid #d1d5db;
    border-radius: 12px;
    background: #fff;
    color: #0078d4;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.tlc-dept-btn:hover {
    border-color: #0078d4;
    background: rgba(0, 120, 212, 0.04);
}

.tlc-dept-btn--active {
    border-color: #0078d4;
    background: rgba(0, 120, 212, 0.08);
    box-shadow: 0 0 0 3px rgba(0, 120, 212, 0.15);
}

.tlc-dept-label {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.2;
}

.tlc-dept-desc {
    font-size: 11px;
    color: #666;
    line-height: 1.3;
    text-align: center;
}

.tlc-dept-msg-area {
    animation: tlc-fade-in 0.25s ease;
}

@keyframes tlc-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
