@import url('https://fonts.googleapis.com/css2?family=Kanit&display=swap');

/* Base Styles */
body {
    font-family: 'Kanit', sans-serif;
    font-weight: 400;
}

/* Container */
.chat-container {
    max-width: 1024px;
    margin: 0 auto;
}


/* Header Styles */
.chat-header-main {
    text-align: center;
    margin-bottom: 32px;
    margin-top: 0;       /* ถ้ามี */
}

.chat-header-main h1 {
    font-size: 30px;
    color: #2e7d32; /* เขียวแทน #1e293b */
    margin-top: 0;
    margin-bottom: 8px;
    font-family: 'Kanit', sans-serif;
}

.chat-header-main p {
    color: #64748b;
    margin-bottom: 16px;
    font-family: 'Kanit', sans-serif;
}

.header-divider {
    width: 64px;
    height: 4px;
    background: #c0a040; /* ทองแทน #2563eb */
    margin: 0 auto;
    border-radius: 9999px;
}

/* Chat Container */
.chat-box-container {
    background: #ffffff; /* ขาวแทน white */
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Chat Header */
.chat-header {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 16px 24px;
}

.chat-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bot-avatar {
    width: 40px;
    height: 40px;
    background: #2e7d32; /* เขียวแทน #2563eb */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bot-avatar svg {
    width: 20px;
    height: 20px;
    color: white;
}

.bot-info h3 {
    font-weight: 500;  /* เดิม 600 */
    color: #2e7d32; /* เขียวแทน #1e293b */
    margin: 0;
    font-size: 16px;
    font-family: 'Kanit', sans-serif;
}

.bot-status {
    font-size: 14px;
    color: #2e7d32; /* เขียวแทน #16a34a */
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
    font-family: 'Kanit', sans-serif;
    font-weight: 400;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #2e7d32; /* เขียวแทน #22c55e */
    border-radius: 50%;
}

.current-time {
    font-size: 14px;
    color: #64748b;
    font-family: 'Kanit', sans-serif;
    font-weight: 400;
}

/* Chat Messages Area */
.chat-messages {
    height: 384px;
    overflow-y: auto;
    padding: 24px;
    background: rgba(248, 250, 252, 0.3);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Message Animations */
.chat-message {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Message Styles */
.message-container {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.message-container.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.message-avatar.bot {
    background: #2e7d32; /* เขียวแทน #2563eb */
}

.message-avatar.user {
    background: #64748b;
}

.message-avatar svg {
    width: 16px;
    height: 16px;
    color: white;
}

.message-content {
    flex: 1;
    max-width: 448px;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    font-family: 'Kanit', sans-serif;
    font-weight: 400;
}

.message-bubble.bot {
    background: #ffffff; /* ขาวแทน white */
    border: 1px solid #e2e8f0;
    border-top-left-radius: 6px;
}

.message-bubble.user {
    background: #2e7d32; /* เขียวแทน #2563eb */
    color: white;
    border-top-right-radius: 6px;
}

.message-bubble p {
    margin: 0;
    color: #374151;
    line-height: 1.5;
    font-family: 'Kanit', sans-serif;
    font-weight: 400;
}

.message-bubble.user p {
    color: white;
}

.message-time {
    font-size: 11px;
    color: #64748b;
    margin-top: 4px;
    padding: 0 16px;
    font-family: 'Kanit', sans-serif;
    font-weight: 400;
}

.message-container.user .message-time {
    text-align: right;
}

/* Typing Indicator */
.typing-indicator {
    display: none;
    align-items: flex-start;
    gap: 12px;
}

.typing-indicator.active {
    display: flex;
}

.typing-bubble {
    background: #ffffff; /* ขาวแทน white */
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    border-top-left-radius: 6px;
    padding: 12px 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    font-family: 'Kanit', sans-serif;
    font-weight: 400;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #64748b;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) { 
    animation-delay: 0.2s; 
}

.typing-dot:nth-child(3) { 
    animation-delay: 0.4s; 
}

@keyframes typing {
    0%, 60%, 100% { 
        transform: translateY(0); 
    }
    30% { 
        transform: translateY(-10px); 
    }
}

/* Input Area */
.chat-input-area {
    border-top: 1px solid #e2e8f0;
    background: #ffffff; /* ขาวแทน white */
    padding: 24px;
}

.input-container {
    display: flex;
    align-items: flex-end;
    gap: 16px;
}

.input-wrapper {
    flex: 1;
    position: relative;
}

.message-input {
    width: 100%;
    padding: 12px 16px;
    padding-right: 48px;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    outline: none;
    background: #f8fafc;
    transition: all 0.2s;
    font-family: 'Kanit', sans-serif;
    font-size: 14px;
    font-weight: 400;
}

.message-input:focus {
    ring: 2px;
    ring-color: #2e7d32; /* เขียวแทน #2563eb */
    border-color: transparent;
    background: #ffffff;
}

.attach-button {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s;
    padding: 4px;
}

.attach-button:hover {
    color: #4b5563;
}

.attach-button svg {
    width: 20px;
    height: 20px;
}

.send-button {
    background: #2e7d32; /* เขียวแทน #2563eb */
    color: white;
    padding: 12px 24px;
    border-radius: 12px;
    border: none;
    font-weight: 400;  /* เดิม 500 */
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    font-family: 'Kanit', sans-serif;
}

.send-button:hover {
    background: #c0a040; /* ทองแทน #1d4ed8 */
    color: #000;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.send-button svg {
    width: 16px;
    height: 16px;
}

/* reCAPTCHA */
.recaptcha-container {
    margin-top: 16px;
    display: flex;
    justify-content: center;
}

.recaptcha-placeholder {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    color: #64748b;
    font-size: 14px;
    font-family: 'Kanit', sans-serif;
    font-weight: 400;
}

.recaptcha-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 8px;
}

.recaptcha-header svg {
    width: 16px;
    height: 16px;
}

.recaptcha-text {
    font-size: 12px;
    font-family: 'Kanit', sans-serif;
    font-weight: 400;
}

/* FAQ Link */
.faq-container {
    text-align: center;
    margin-top: 24px;
}

.faq-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #2e7d32; /* เขียวแทน #2563eb */
    font-weight: 400; /* เดิม 500 */
    font-size: 14px;
    text-decoration: none;
    transition: color 0.2s;
    font-family: 'Kanit', sans-serif;
}

.faq-link:hover {
    color: #c0a040; /* ทองแทน #1d4ed8 */
}

.faq-link svg {
    width: 16px;
    height: 16px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .chat-container {
        padding: 16px;
    }
    
    .chat-messages {
        height: 300px;
        padding: 16px;
    }
    
    .input-container {
        flex-direction: column;
        gap: 16px;
    }
    
    .send-button {
        width: 100%;
        justify-content: center;
    }
    
    .message-content {
        max-width: 280px;
    }
}

@media (max-width: 480px) {
    .chat-header {
        padding: 12px 16px;
    }
    
    .chat-messages {
        padding: 12px;
        gap: 12px;
    }
    
    .chat-input-area {
        padding: 16px;
    }
    
    .message-content {
        max-width: 240px;
    }
    
    .bot-info h3 {
        font-size: 14px;
    }
    
    .bot-status {
        font-size: 12px;
    }
}

/* Scrollbar Styling */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
/* ================= DARK MODE ================= */
body.dark-mode {
  background-color: #121212;
  color: #e0e0e0;
}

/* Container */
body.dark-mode .chat-box-container {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  box-shadow: 0 10px 20px rgba(0,0,0,0.6);
}

/* Header */
body.dark-mode .chat-header {
  background: #1a1a1a;
  border-bottom: 1px solid #2a2a2a;
}

body.dark-mode .chat-header-main h1 {
  color: #c0a040;
}
body.dark-mode .chat-header-main p {
  color: #aaa;
}

body.dark-mode .bot-info h3 {
  color: #c0a040;
}
body.dark-mode .bot-status {
  color: #2e7d32;
}
body.dark-mode .current-time {
  color: #bbb;
}

/* Messages area */
body.dark-mode .chat-messages {
  background: #181818;
}

/* Message Bubbles */
body.dark-mode .message-bubble.bot {
  background: #1e1e1e;
  border: 1px solid #2a2a2a;
  color: #e0e0e0;
}
body.dark-mode .message-bubble.bot p {
  color: #e0e0e0;
}

body.dark-mode .message-bubble.user {
  background: #2e7d32;
  color: #fff;
}
body.dark-mode .message-bubble.user p {
  color: #fff;
}

body.dark-mode .message-time {
  color: #999;
}

/* Typing Indicator */
body.dark-mode .typing-bubble {
  background: #1e1e1e;
  border: 1px solid #2a2a2a;
  color: #ccc;
}
body.dark-mode .typing-dot {
  background: #888;
}

/* Input Area */
body.dark-mode .chat-input-area {
  background: #1a1a1a;
  border-top: 1px solid #2a2a2a;
}
body.dark-mode .message-input {
  background: #222;
  border: 1px solid #333;
  color: #e0e0e0;
}
body.dark-mode .message-input:focus {
  background: #1a1a1a;
  border-color: #2e7d32;
}

/* Buttons */
body.dark-mode .attach-button {
  color: #bbb;
}
body.dark-mode .attach-button:hover {
  color: #fff;
}
body.dark-mode .send-button {
  background: #2e7d32;
  color: #fff;
}
body.dark-mode .send-button:hover {
  background: #c0a040;
  color: #000;
}

/* reCAPTCHA */
body.dark-mode .recaptcha-placeholder {
  background: #1e1e1e;
  border: 1px solid #2a2a2a;
  color: #aaa;
}

/* FAQ Link */
body.dark-mode .faq-link {
  color: #c0a040;
}
body.dark-mode .faq-link:hover {
  color: #2e7d32;
}

/* Scrollbar */
body.dark-mode .chat-messages::-webkit-scrollbar-track {
  background: #1a1a1a;
}
body.dark-mode .chat-messages::-webkit-scrollbar-thumb {
  background: #444;
}
body.dark-mode .chat-messages::-webkit-scrollbar-thumb:hover {
  background: #666;
}
