.chat-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    font-family: 'Inter', sans-serif;
}

.chat-bubble {
    width: 60px;
    height: 60px;
    background-color: #0056b3;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: transform 0.3s ease;
}

.chat-bubble:hover {
    transform: scale(1.1);
}

.chat-bubble .material-icons-round {
    color: white;
    font-size: 30px;
}

.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 450px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: fadeInUp 0.3s ease-out;
}

.chat-window.active {
    display: flex;
}

.chat-header {
    background: #0056b3;
    padding: 20px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}

.chat-header .close-chat {
    cursor: pointer;
    font-size: 20px;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f8f9fa;
}

.message {
    max-width: 85%;
    padding: 10px 15px;
    border-radius: 15px;
    font-size: 14px;
    line-height: 1.4;
    word-break: break-word;
}

.message.received {
    background: #fff;
    align-self: flex-start;
    border-bottom-left-radius: 2px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.message.sent {
    background: #0056b3;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

.chat-input-area {
    padding: 15px;
    background: white;
    display: flex;
    gap: 10px;
    border-top: 1px solid #eee;
}

.chat-input {
    flex: 1;
    border: none;
    background: #f4f4f4;
    padding: 10px 15px;
    border-radius: 10px;
    font-size: 14px;
    outline: none;
}

.chat-send {
    color: #0056b3;
    cursor: pointer;
    display: flex;
    align-items: center;
}

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

@media (max-width: 480px) {
    .chat-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 120px);
        bottom: 70px;
    }
}

.typing-indicator {
    display: none;
    align-self: flex-start;
    background: #fff;
    padding: 10px 15px;
    border-radius: 15px;
    border-bottom-left-radius: 2px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.typing-indicator span {
    height: 8px;
    width: 8px;
    float: left;
    margin: 0 1px;
    background-color: #9E9E9E;
    display: block;
    border-radius: 50%;
    opacity: 0.4;
    animation: typing 1s infinite;
}

.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.33s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.66s; }

@keyframes typing {
    0% { transform: translateY(0px); opacity: 0.4; }
    50% { transform: translateY(-5px); opacity: 0.8; }
    100% { transform: translateY(0px); opacity: 0.4; }
}

/* Service Cards in Chat */
.chat-service-card {
    background: linear-gradient(135deg, #f8f9ff 0%, #e8f0ff 100%);
    border: 1px solid #d0e0ff;
    border-radius: 12px;
    padding: 12px;
    margin-top: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,86,179,0.1);
}

.chat-service-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,86,179,0.15);
}

/* Better Message Styling */
.message.received .msg-text {
    font-size: 14px;
    line-height: 1.6;
    color: #333;
}

.message.received .msg-text strong {
    color: #0056b3;
    font-weight: 600;
}

.message.received .msg-text em {
    color: #666;
    font-style: italic;
}

.message.received .msg-text li {
    margin-left: 15px;
    margin-bottom: 4px;
    position: relative;
}

.message.received .msg-text li::before {
    content: "•";
    color: #0056b3;
    font-weight: bold;
    position: absolute;
    left: -12px;
}

/* Better spacing for messages */
.message {
    max-width: 90%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
    animation: messageAppear 0.3s ease-out;
}

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

/* ==================== DARK MODE CHAT ==================== */

body.dark-mode .chat-window {
    background: #1a1a2e;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

body.dark-mode .chat-header {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    color: #ffffff !important;
}

body.dark-mode .chat-header h3 {
    color: #ffffff !important;
}

body.dark-mode .chat-header .close-chat {
    color: #ffffff !important;
}

body.dark-mode .chat-messages {
    background: #141416;
}

body.dark-mode .message.received {
    background: #1e1e24;
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

body.dark-mode .message.sent {
    background: #2563eb;
    color: white;
}

body.dark-mode .chat-input-area {
    background: #1a1a2e;
    border-top-color: #2a2a3e;
}

body.dark-mode .chat-input {
    background: #2a2a3e;
    color: #f5f5f7;
}

body.dark-mode .chat-input::placeholder {
    color: #6b7280;
}

body.dark-mode .chat-send {
    color: #60a5fa;
}

body.dark-mode .typing-indicator {
    background: #1e1e24;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

body.dark-mode .typing-indicator span {
    background-color: #60a5fa;
}

/* Service Cards in Dark Mode */
body.dark-mode .chat-service-card {
    background: linear-gradient(135deg, #1a1a1f 0%, #0f0f12 100%);
    border-color: #2a2a35;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    color: #ffffff;
}

body.dark-mode .chat-service-card:hover {
    background: linear-gradient(135deg, #202025 0%, #15151a 100%);
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    transform: translateY(-2px);
    border-color: #3a3a45;
}

/* Message text in dark mode - ALL WHITE */
body.dark-mode .message.received .msg-text {
    color: #ffffff !important;
}

body.dark-mode .message.received .msg-text * {
    color: #ffffff !important;
}

body.dark-mode .message.received .msg-text strong {
    color: #1e3a8a !important;
    font-weight: 700;
}

body.dark-mode .message.received .msg-text em {
    color: #e0e0e0 !important;
}

body.dark-mode .message.received .msg-text li::before {
    color: #ffffff !important;
}

/* Chat bubble in dark mode */
body.dark-mode .chat-bubble {
    background-color: #2563eb;
    box-shadow: 0 4px 15px rgba(37,99,235,0.4);
}

/* Registration form in dark mode */
body.dark-mode #chat-reg-form {
    background: #1a1a2e;
}

body.dark-mode #chat-reg-form p {
    color: #ffffff !important;
}

body.dark-mode #chat-reg-name,
body.dark-mode #chat-reg-phone {
    background: #2a2a3e !important;
    color: #f5f5f7;
    border: 1px solid #3a3a4e;
}

body.dark-mode #chat-reg-name::placeholder,
body.dark-mode #chat-reg-phone::placeholder {
    color: #6b7280;
}

body.dark-mode #chat-reg-btn {
    background: #2563eb;
}

body.dark-mode #chat-reg-btn:hover {
    background: #3b82f6;
}

/* Scrollbar styling for dark mode */
body.dark-mode .chat-messages::-webkit-scrollbar {
    width: 8px;
}

body.dark-mode .chat-messages::-webkit-scrollbar-track {
    background: #141416;
}

body.dark-mode .chat-messages::-webkit-scrollbar-thumb {
    background: #3a3a4e;
    border-radius: 4px;
}

body.dark-mode .chat-messages::-webkit-scrollbar-thumb:hover {
    background: #4a4a5e;
}

/* Close button hover in dark mode */
body.dark-mode .chat-header .close-chat:hover {
    opacity: 0.8;
}
