/**
 * TG Live Chat - Frontend Widget Styles
 */

/* Widget Toggle Button */
.tglivechat-widget-toggle {
    position: fixed;
    bottom: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #667eea;
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    z-index: 999998;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

/* Toggle Button Position - Right (Default) */
.tglivechat-widget-toggle.tglivechat-position-right {
    right: 20px;
    left: auto;
}

/* Toggle Button Position - Left */
.tglivechat-widget-toggle.tglivechat-position-left {
    left: 20px;
    right: auto;
}

.tglivechat-widget-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.tglivechat-widget-toggle .dashicons {
    font-size: 28px;
    width: 28px;
    height: 28px;
}

/* Widget Container */
.tglivechat-widget {
    position: fixed;
    bottom: 20px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 40px);
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    z-index: 999999;
    display: none; /* Hidden by default, JavaScript will show it */
    flex-direction: column;
    overflow: hidden;
}

/* Widget Position - Right (Default) */
.tglivechat-widget.tglivechat-position-right {
    right: 20px;
    left: auto;
}

/* Widget Position - Left */
.tglivechat-widget.tglivechat-position-left {
    left: 20px;
    right: auto;
}

.tglivechat-widget.tglivechat-widget-visible {
    display: flex !important;
    animation: tglivechat-slide-up 0.3s ease;
}

/* Animation for right position */
.tglivechat-widget.tglivechat-position-right.tglivechat-widget-visible {
    animation: tglivechat-slide-up-right 0.3s ease;
}

/* Animation for left position */
.tglivechat-widget.tglivechat-position-left.tglivechat-widget-visible {
    animation: tglivechat-slide-up-left 0.3s ease;
}

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

@keyframes tglivechat-slide-up-right {
    from {
        transform: translate(0, 20px);
        opacity: 0;
    }
    to {
        transform: translate(0, 0);
        opacity: 1;
    }
}

@keyframes tglivechat-slide-up-left {
    from {
        transform: translate(0, 20px);
        opacity: 0;
    }
    to {
        transform: translate(0, 0);
        opacity: 1;
    }
}

/* Widget Header */
.tglivechat-widget-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.tglivechat-widget-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tglivechat-widget-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tglivechat-avatar-placeholder {
    color: white;
    font-weight: 600;
    font-size: 18px;
}

.tglivechat-widget-info {
    flex: 1;
}

.tglivechat-widget-name {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tglivechat-online-indicator {
    width: 10px;
    height: 10px;
    background: #10b981;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.3);
    animation: tglivechat-pulse 2s infinite;
    flex-shrink: 0;
}

@keyframes tglivechat-pulse {
    0%, 100% {
        box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.3);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
    }
}

.tglivechat-widget-status {
    font-size: 12px;
    opacity: 0.9;
}

.tglivechat-widget-close {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.tglivechat-widget-close:hover {
    opacity: 1;
}

.tglivechat-widget-close .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

/* Widget Body */
.tglivechat-widget-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Customer Form */
.tglivechat-widget-form {
    padding: 24px;
    flex: 1;
}

.tglivechat-welcome-message {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e5e7eb;
}

.tglivechat-welcome-message .tglivechat-message-item {
    margin-bottom: 0;
}

.tglivechat-welcome-message .tglivechat-message-bubble {
    background: #f3f4f6;
    color: #374151;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.tglivechat-widget-form h3 {
    margin: 0 0 20px 0;
    font-size: 18px;
    color: #1e293b;
    text-align: center;
}

.tglivechat-form-group {
    margin-bottom: 16px;
}

.tglivechat-form-group label {
    display: block;
    font-weight: 600;
    color: #334155;
    margin-bottom: 6px;
    font-size: 14px;
}

.tglivechat-form-group .required {
    color: #dc2626;
}

.tglivechat-form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.tglivechat-form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.tglivechat-btn-primary {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.tglivechat-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Messages Container */
.tglivechat-widget-messages {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.tglivechat-messages-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8f9fa;
}

.tglivechat-message-item {
    margin-bottom: 12px;
    display: flex;
    gap: 8px;
}

.tglivechat-message-item.customer {
    flex-direction: row-reverse;
}

.tglivechat-message-item.admin {
    flex-direction: row;
}

.tglivechat-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    overflow: hidden;
}

.tglivechat-message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tglivechat-message-avatar .tglivechat-avatar-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #667eea;
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.tglivechat-message-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: calc(100% - 40px);
}

.tglivechat-message-item.customer .tglivechat-message-content {
    align-items: flex-end;
}

.tglivechat-message-item.admin .tglivechat-message-content {
    align-items: flex-start;
}

.tglivechat-message-bubble {
    padding: 10px 14px;
    border-radius: 12px;
    max-width: 75%;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.5;
}

.tglivechat-message-item.customer .tglivechat-message-bubble {
    background: #667eea;
    color: white;
    border-bottom-right-radius: 4px;
}

.tglivechat-message-item.admin .tglivechat-message-bubble {
    background: white;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
}

.tglivechat-message-time {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 4px;
    padding: 0 4px;
}

/* Message Input */
.tglivechat-message-input {
    display: flex;
    gap: 8px;
    padding: 12px;
    background: white;
    border-top: 1px solid #e2e8f0;
}

.tglivechat-message-input input {
    flex: 1;
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
}

.tglivechat-message-input input:focus {
    outline: none;
    border-color: #667eea;
}

.tglivechat-btn-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #667eea;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.tglivechat-btn-send:hover {
    background: #5568d3;
    transform: scale(1.05);
}

.tglivechat-btn-send .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

/* Widget Footer */
.tglivechat-widget-footer {
    padding: 8px 16px;
    text-align: center;
    background: #f8f9fa;
    border-top: 1px solid #e2e8f0;
}

.tglivechat-widget-footer small {
    font-size: 11px;
    color: #000000;
}

.tglivechat-footer-link {
    color: #000000;
    text-decoration: none;
    font-weight: 600;
    transition: opacity 0.2s;
}

.tglivechat-footer-link:hover {
    opacity: 0.7;
    text-decoration: underline;
}

/* Customer Details Modal */
.tglivechat-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tglivechat-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.tglivechat-modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 1;
}

.tglivechat-modal-content h3 {
    margin: 0 0 8px 0;
    font-size: 20px;
    color: #1e293b;
    font-weight: 600;
}

.tglivechat-modal-description {
    margin: 0 0 20px 0;
    color: #64748b;
    font-size: 14px;
}

.tglivechat-modal-actions {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
}

.tglivechat-modal-actions .tglivechat-btn-primary {
    width: 100%;
}

/* Skin Variations */
.tglivechat-skin-dark .tglivechat-widget-toggle,
.tglivechat-skin-dark .tglivechat-widget-header {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}

.tglivechat-skin-light .tglivechat-widget-toggle,
.tglivechat-skin-light .tglivechat-widget-header {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    color: #1e293b;
}

.tglivechat-skin-light .tglivechat-widget-header {
    border-bottom: 1px solid #e2e8f0;
}

/* Responsive */
@media (max-width: 480px) {
    .tglivechat-widget {
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        bottom: 0;
        border-radius: 0;
    }
    
    .tglivechat-widget.tglivechat-position-right {
        right: 0;
        left: auto;
    }
    
    .tglivechat-widget.tglivechat-position-left {
        left: 0;
        right: auto;
    }
    
    .tglivechat-widget-toggle {
        bottom: 15px;
        width: 56px;
        height: 56px;
    }
    
    .tglivechat-widget-toggle.tglivechat-position-right {
        right: 15px;
        left: auto;
    }
    
    .tglivechat-widget-toggle.tglivechat-position-left {
        left: 15px;
        right: auto;
    }
}

