/* ===== UNIFIED CHATBOT STYLES ===== */

:root {
    --primary: #667eea;
    --primary-dark: #764ba2;
    --success: #43e97b;
    --danger: #f5576c;
    --bg: #f9fafb;
    --border: #e5e7eb;
    --text: #1f2937;
    --text-light: #6b7280;
}

#uchat-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99999;
}

/* ===== BUTTON ===== */

.uchat-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    border: none;
}

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

.uchat-btn.uchat-hidden {
    display: none;
}

/* ===== CHAT WINDOW ===== */

.uchat-window {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 380px;
    height: 600px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 40px rgba(0, 0, 0, 0.16);
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

.uchat-window.uchat-hidden {
    display: none;
}

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

/* ===== HEADER ===== */

.uchat-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 16px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.uchat-header-info h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.uchat-status {
    font-size: 12px;
    opacity: 0.9;
    margin-top: 4px;
}

.uchat-status.online {
    color: #4ade80;
}

.uchat-status.offline {
    color: #f87171;
}

.uchat-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.uchat-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ===== MESSAGES AREA ===== */

.uchat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.uchat-msg {
    display: flex;
    animation: fadeIn 0.3s ease;
}

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

.uchat-msg-user {
    justify-content: flex-end;
}

.uchat-msg-bot {
    justify-content: flex-start;
}

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

.uchat-msg-user .uchat-bubble {
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.uchat-msg-bot .uchat-bubble {
    background: white;
    color: var(--text);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

.uchat-msg-bot .uchat-bubble a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.uchat-msg-bot .uchat-bubble strong {
    color: var(--primary);
}

/* ===== INPUT SECTION ===== */

.uchat-input-section {
    padding: 12px;
    border-top: 1px solid var(--border);
    background: white;
    border-radius: 0 0 12px 12px;
}

.uchat-input-group {
    display: flex;
    gap: 8px;
}

#uchat-input {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

#uchat-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.uchat-send {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s;
}

.uchat-send:hover {
    background: var(--primary-dark);
}

.uchat-send:active {
    transform: scale(0.98);
}

/* ===== OFFLINE FORM ===== */

.uchat-offline {
    padding: 12px;
}

.uchat-offline p {
    margin: 0 0 12px 0;
    font-size: 13px;
    color: var(--text-light);
}

#uchat-offline-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#uchat-offline-form input,
#uchat-offline-form textarea {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px;
    font-size: 13px;
    font-family: inherit;
}

#uchat-offline-form input:focus,
#uchat-offline-form textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#uchat-offline-form button {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

#uchat-offline-form button:hover {
    background: var(--primary-dark);
}

/* ===== SCROLLBAR ===== */

.uchat-messages::-webkit-scrollbar {
    width: 6px;
}

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

.uchat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.uchat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* ===== RESPONSIVE ===== */

@media (max-width: 480px) {
    .uchat-window {
        width: 100vw;
        height: 100vh;
        right: 0;
        bottom: 0;
        border-radius: 0;
    }
    
    .uchat-btn {
        width: 56px;
        height: 56px;
        bottom: 16px;
        right: 16px;
    }
    
    .uchat-bubble {
        max-width: 85% !important;
    }
}