/* KNMC Chat Widget Styles v2.3.0 */
/* Optimized for performance - External CSS file */
/* Redesigned button with modern style */

#knmc-chat-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10000;
    min-width: 140px;
    height: 56px;
    padding: 0 20px;
    border-radius: 28px;
    background: linear-gradient(135deg, #FF9860 0%, #FF8C00 100%);
    border: none;
    box-shadow: 0 8px 24px rgba(255, 152, 96, 0.35),
                0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: white;
    text-decoration: none;
    letter-spacing: 0.3px;
    overflow: hidden;
}

#knmc-chat-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

#knmc-chat-btn:hover::before {
    left: 100%;
}

#knmc-chat-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(255, 152, 96, 0.45),
                0 4px 12px rgba(0, 0, 0, 0.15);
    background: linear-gradient(135deg, #FF8C00 0%, #FF7F50 100%);
}

#knmc-chat-btn:active {
    transform: translateY(0);
    box-shadow: 0 6px 20px rgba(255, 152, 96, 0.4),
                0 2px 6px rgba(0, 0, 0, 0.1);
}

#knmc-chat-btn .btn-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

#knmc-chat-btn .btn-icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
    transition: transform 0.3s ease;
}

#knmc-chat-btn:hover .btn-icon svg {
    transform: scale(1.1) rotate(-5deg);
}

#knmc-chat-btn .btn-text {
    position: relative;
    white-space: nowrap;
}

#knmc-chat-btn.online::after {
    content: "";
    position: absolute;
    top: 8px;
    right: 8px;
    width: 12px;
    height: 12px;
    background: #4CAF50;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.3);
    animation: statusPulse 2s infinite;
}

#knmc-chat-btn.offline::after {
    content: "";
    position: absolute;
    top: 8px;
    right: 8px;
    width: 12px;
    height: 12px;
    background: #9E9E9E;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 0 2px rgba(158, 158, 158, 0.2);
}

@keyframes statusPulse {
    0% {
        opacity: 1;
        transform: scale(1);
        box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.3);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.1);
        box-shadow: 0 0 0 4px rgba(76, 175, 80, 0.2);
    }
    100% {
        opacity: 1;
        transform: scale(1);
        box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.3);
    }
}

#knmc-chat-modal {
    display: none;
    position: fixed;
    z-index: 10001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

#knmc-chat-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

#knmc-chat-container {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: slideUp 0.3s ease;
    overflow: hidden;
}

@keyframes slideUp {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

#knmc-chat-header {
    background: linear-gradient(135deg, #FF9860 0%, #FF8C00 100%);
    color: white;
    padding: 20px;
    text-align: center;
    position: relative;
}

#knmc-chat-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

#knmc-chat-status {
    margin-top: 8px;
    font-size: 14px;
    opacity: 0.9;
}

.status-online { color: #4CAF50; }
.status-offline { color: #f44336; }

#knmc-chat-close {
    position: absolute;
    right: 15px;
    top: 15px;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

#knmc-chat-close:hover {
    background: rgba(255,255,255,0.2);
}

#knmc-chat-body {
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
    background: #f8f9fa;
}

.chat-messages {
    margin-bottom: 15px;
}

.message {
    margin-bottom: 12px;
    padding: 10px 14px;
    border-radius: 18px;
    max-width: 80%;
    word-wrap: break-word;
    animation: messageSlide 0.2s ease;
}

@keyframes messageSlide {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.visitor {
    background: linear-gradient(135deg, #FF9860 0%, #FF8C00 100%);
    color: white;
    margin-left: auto;
    text-align: right;
}

.message.agent {
    background: white;
    color: #333;
    border: 1px solid #e9ecef;
    margin-right: auto;
}

.message-time {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 5px;
}

.message-status {
    font-size: 12px;
    margin-left: 5px;
    opacity: 0.8;
    cursor: pointer;
    transition: opacity 0.2s;
}

.message-status:hover {
    opacity: 1;
}

.message-status.sending {
    animation: pulse 1.5s infinite;
}

.message-status.failed {
    color: #f44336;
}

.message-status.sent {
    color: #4CAF50;
}

#knmc-chat-input-container {
    padding: 20px;
    background: white;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 10px;
    align-items: center;
}

#knmc-chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

#knmc-chat-input:focus {
    border-color: #FF9860;
}

#knmc-chat-send {
    background: linear-gradient(135deg, #FF9860 0%, #FF8C00 100%);
    border: none;
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s;
}

#knmc-chat-send:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(255, 152, 96, 0.4);
}

#knmc-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.offline-form {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 15px;
}

.form-group {
    margin-bottom: 18px;
}

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #FF9860;
    box-shadow: 0 0 0 3px rgba(255, 152, 96, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
}

.required {
    color: #f44336;
}

#knmc-submit-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #FF9860 0%, #FF8C00 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 10px;
}

#knmc-submit-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(255, 152, 96, 0.4);
}

#knmc-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #FF9860;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.success-message,
.error-message {
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    text-align: center;
    font-weight: 500;
}

.success-message {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

#knmc-chat-footer {
    padding: 15px 20px;
    background: #f8f9fa;
    text-align: center;
    font-size: 12px;
    color: #6c757d;
    border-top: 1px solid #e9ecef;
}

#tunnel-password-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 15px;
    max-width: 350px;
    z-index: 10002;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    color: #856404;
}

#tunnel-password-message button {
    background: #ffc107;
    border: none;
    border-radius: 4px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 12px;
    color: #856404;
    margin-top: 5px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    #knmc-chat-btn {
        min-width: 120px;
        height: 50px;
        padding: 0 16px;
        bottom: 16px;
        right: 16px;
        font-size: 14px;
        gap: 8px;
    }
    
    #knmc-chat-btn .btn-icon {
        width: 18px;
        height: 18px;
    }
    
    #knmc-chat-btn.online::after,
    #knmc-chat-btn.offline::after {
        width: 10px;
        height: 10px;
        top: 6px;
        right: 6px;
    }
    
    #knmc-chat-container {
        width: 95%;
        max-width: 400px;
        margin: 10px;
    }
    
    #knmc-chat-body {
        max-height: 300px;
        padding: 15px;
    }
    
    .message {
        max-width: 90%;
        padding: 8px 12px;
    }
    
    #knmc-chat-input-container {
        padding: 15px;
        gap: 8px;
    }
    
    #knmc-chat-input {
        padding: 10px 12px;
        font-size: 16px;
    }
    
    #knmc-chat-send {
        width: 40px;
        height: 40px;
    }
    
    .offline-form {
        padding: 15px;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 12px 12px;
        font-size: 16px;
    }
    
    #knmc-submit-btn {
        padding: 16px;
        font-size: 16px;
    }
}

