/* SocialGrow Modern Online Chat Widget */
#sg-chat-widget-root {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999999;
    font-family: inherit;
    direction: rtl;
    text-align: right;
}

/* Floating Launcher Button */
.sg-chat-launcher {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    border: none;
    outline: none;
}

.sg-chat-launcher:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 12px 30px rgba(16, 185, 129, 0.55);
}

.sg-chat-launcher i {
    font-size: 26px;
    transition: transform 0.3s ease;
}

.sg-chat-launcher .sg-icon-close {
    display: none;
    font-size: 24px;
}

#sg-chat-widget-root.sg-chat-open .sg-chat-launcher .sg-icon-open {
    display: none;
}

#sg-chat-widget-root.sg-chat-open .sg-chat-launcher .sg-icon-close {
    display: block;
}

.sg-chat-unread-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* Chat Window Box */
.sg-chat-box {
    position: absolute;
    bottom: 76px;
    right: 0;
    width: 370px;
    max-width: calc(100vw - 32px);
    height: 520px;
    max-height: calc(100vh - 120px);
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.18), 0 2px 10px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

#sg-chat-widget-root.sg-chat-open .sg-chat-box {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Chat Header */
.sg-chat-header {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #ffffff;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

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

.sg-chat-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 20px;
    position: relative;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
}

.sg-chat-status-dot {
    position: absolute;
    bottom: 1px;
    left: 1px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #10b981;
    border: 2px solid #0f172a;
}

.sg-chat-title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
}

.sg-chat-subtitle {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 2px;
}

.sg-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sg-chat-header-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #cbd5e1;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.sg-chat-header-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

/* Chat Messages Container */
.sg-chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

.sg-chat-welcome {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 14px;
    font-size: 13px;
    color: #334155;
    line-height: 1.7;
    box-shadow: 0 2px 6px rgba(0,0,0,0.03);
    margin-bottom: 4px;
}

.sg-msg-row {
    display: flex;
    flex-direction: column;
    max-width: 82%;
    word-break: break-word;
}

.sg-msg-user {
    align-self: flex-start;
}

.sg-msg-admin {
    align-self: flex-end;
}

.sg-msg-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.6;
    position: relative;
}

.sg-msg-user .sg-msg-bubble {
    background: #ffffff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}

.sg-msg-admin .sg-msg-bubble {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

.sg-msg-time {
    font-size: 10.5px;
    color: #94a3b8;
    margin-top: 4px;
    padding: 0 4px;
}

.sg-msg-admin .sg-msg-time {
    text-align: left;
}

/* Chat Input Bar */
.sg-chat-input-area {
    padding: 12px 14px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sg-chat-user-fields {
    display: flex;
    gap: 8px;
    font-size: 12px;
}

.sg-chat-user-fields input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 12px;
    background: #f8fafc;
    outline: none;
    transition: border 0.2s;
}

.sg-chat-user-fields input:focus {
    border-color: #10b981;
    background: #ffffff;
}

.sg-chat-input-form {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sg-chat-textarea {
    flex: 1;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 13.5px;
    font-family: inherit;
    resize: none;
    height: 44px;
    max-height: 100px;
    outline: none;
    background: #f8fafc;
    color: #1e293b;
    transition: all 0.2s;
    line-height: 1.4;
}

.sg-chat-textarea:focus {
    border-color: #10b981;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.sg-chat-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.sg-chat-send-btn .sg-send-icon {
    transform: rotate(-45deg) translate(1px, -1px);
    transition: transform 0.2s ease;
}

.sg-chat-send-btn:hover .sg-send-icon {
    transform: rotate(-45deg) translate(2px, -2px) scale(1.08);
}

.sg-chat-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}


.sg-chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Telegram badge in header */
.sg-chat-tg-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    background: rgba(36, 161, 222, 0.2);
    color: #38bdf8;
    padding: 2px 8px;
    border-radius: 10px;
    margin-right: 6px;
}

/* Mobile responsive adjustments */
@media (max-width: 480px) {
    #sg-chat-widget-root {
        bottom: 16px;
        right: 16px;
    }
    .sg-chat-box {
        bottom: 70px;
        width: calc(100vw - 32px);
        height: calc(100vh - 100px);
    }
}

