:root {
    /* Color Variables */
    --primary-color: #2c5282;
    --primary-dark: #1f2937;
    --text-color: #2d3748;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --chat-bg: #f8fafc;
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    padding: 20px;
}

/* Chat Toggle Container */
.chat-toggle-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 25px;
    padding: 8px;
    box-shadow: var(--shadow);
    z-index: 999;
    width: 256px;
    height: 104px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.chat-toggle-content {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.chat-toggle-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #636161;
    flex-shrink: 0;
}

.toggle-text {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toggle-title {
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
    font-size: 14px;
    font-weight: 300;
    line-height: 20px;
    color: #1f2937;
    margin: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Ask Question Button */
.ask-question-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 232px;
    height: 36px;
    background: #636161;
    color: #ffffff;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
    font-size: 14px;
    font-weight: 300;
    line-height: 20px;
    border: none;
    border-radius: 18px;
    padding: 0 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    text-size-adjust: 100%;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

.ask-question-btn i.fa-phone-alt {
    transform: scaleX(-1);
}

.ask-question-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.ask-question-btn i {
    font-size: 14px;
    line-height: 20px;
}

/* Chat Widget */
#chat-widget {
    position: fixed;
    bottom: 120px;
    right: 30px;
    width: 400px;
    background: white;
    border-radius: 10px;
    box-shadow: var(--shadow);
    display: none;
    flex-direction: column;
    z-index: 1000;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(20px);
    overflow: hidden;
}

#chat-widget.visible {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

#chat-widget.message-input {
    display: flex;
    padding: 10px;
    border-top: 1px solid #e0e0e0;
    position: relative;
}

/* Close Chat Button */
.close-chat-btn {
    position: fixed;
    bottom: 40px;
    right: 50px;
    width: 60px;
    height: 60px;
    border-radius: 30px;
    background: #636161;
    border: 8px solid #ffffff;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

#chat-widget.visible + .close-chat-btn {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.close-chat-btn i {
    color: #ffffff;
    font-size: 16px;
}

.close-chat-btn:hover {
    background: #1f2937;
}

/* Chat Header */
.chat-header {
    height: 64px;
    padding: 0 16px;
    background: white;
    border-bottom: 1px solid var(--border-color);
    display: none;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.company-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.assistant-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.company-name {
    font-weight: 600;
    font-size: 16px;
    color: var(--primary-color);
}

/* Chat Messages */
#chat-messages {
    height: 418px;
    overflow-y: auto;
    padding: 16px;
    background: white;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
}

.message {
    max-width: 80%;
    padding: 14px 14px 14px 14px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.4;
    position: relative;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    margin: 4px 0;
}

.bot-message {
    background: #f3f4f6;
    color: #636161;
    align-self: flex-start;
    border-bottom-left-radius: 10px;
    margin: 4px 0 4px 30px;
    max-width: 80%;
    position: relative;
    padding-left: 10px;
}

.bot-message::before {
    content: '';
    position: absolute;
    left: -25px;
    top: 0;
    width: 20px;
    height: 20px;
    background-image: url('assistent.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    border-radius: 10px;
}

.user-message {
    background: #636161;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 10px;
    margin-left: auto;
    max-width: 80%;
}

.message-content {
    padding-right: 40px;
    min-height: 20px;
}

.message-time {
    font-size: 11px;
    color: rgba(0, 0, 0, 0.45);
    position: absolute;
    right: 12px;
    bottom: 6px;
    padding: 2px 0;
    white-space: nowrap;
}

/* For dark text on light background in bot messages */
.bot-message .message-time {
    color: #636161;
    opacity: 0.7;
}

/* For light text on dark background in user messages */
.user-message .message-time {
    color: rgba(255, 255, 255, 0.7);
}

/* Assistant Image Styles */
.assistant-image-container {
    position: relative; 
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    width: 100%;
    padding: 20px;
}

.assistant-image {
    width: 192px;
    height: 192px;
    object-fit: contain;
    border-radius: 50%;
    position: relative;
}

.phone-icon-circle {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) translateY(50%);
    width: 60px;
    height: 60px;
    background-color: #636161;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    border: 6px solid white;
    z-index: 1;
    margin-bottom: 100px;
}

.phone-icon-circle i {
    color: white;
    font-size: 20px;
    transform: scaleX(-1);
}

/* Chat Input Container */
.chat-input-container {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: #f5f5f5;
    border-top: 1px solid #e0e0e0;
    border-radius: 0 0 10px 10px;
}

/* Chat Input */
.chat-input {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0 8px 0 16px;
    height: 35.6px;
}

#user-input {
    flex: 1;
    height: 100%;
    border: none;
    outline: none;
    font-size: 14px;
    background: transparent;
    padding: 0;
}

#user-input::placeholder {
    color: #a0aec0;
}

/* Send Button */
#send-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    transition: color 0.3s;
    opacity: 0;
    visibility: hidden;
}

#send-btn.visible {
    opacity: 1;
    visibility: visible;
}

#send-btn:hover {
    color: #007bff;
}

#send-btn i {
    color: #4a5568;
    font-size: 16px;
}

/* Voice Button */
#voice-btn {
    background: #636161;
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.3s;
}

#voice-btn:hover {
    background: #4a4a4a;
}

#voice-btn.listening {
    background: #e74c3c;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(231, 76, 60, 0); }
    100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0); }
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: fit-content;
    margin-bottom: 12px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #a0aec0;
    border-radius: 50%;
    display: inline-block;
    animation: bounce 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Responsive Design */
@media (max-width: 480px) {
    #chat-widget {
        width: 90%;
        right: 5%;
        bottom: 150px;
        max-height: 50vh;
    }
    
    .chat-toggle-container {
        bottom: 20px;
        right: 20px;
        max-width: calc(100% - 40px);
    }
    
    .message {
        max-width: 90%;
    }
}