@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;500;600;700&display=swap');

* {
  margin: 0;
  padding: 0;
  border: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #804714;
  --primary-light: #9d5c2a;
  --primary-dark: #663a10;
  --accent-color: #337ab7;
  --accent-light: #5d9cd4;
  --accent-dark: #2a6496;
  --background-light: #FAFBFC;
  --text-primary: #ffffff;
  --text-dark: #2C3E50;
  --text-secondary: #7F8C8D;
  --border-light: rgba(128, 71, 20, 0.15);
  --shadow-color: rgba(128, 71, 20, 0.15);
}

.message.bot a,
.message a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
  border-bottom: 1px solid rgba(128, 71, 20, 0.3);
}

.message.bot a:hover,
.message a:hover {
  color: var(--primary-dark);
  border-bottom: 1px solid var(--primary-dark);
}

@keyframes typing {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 0;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  background-color: var(--primary-color);
  border-radius: 50%;
  display: inline-block;
  animation: typing 1.4s infinite ease-in-out;
}

.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; }

html {
  height: 100%;
  width: 100%;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box;
  overflow: hidden;
}

body {
  margin: 0 !important;
  padding: 0 !important;
  font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  width: 100%;
  height: 100%;
  overflow: hidden;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-size: 16px;
  background: transparent;
}

body.iframe-mode {
  margin: 0 !important;
  padding: 0 !important;
  width: 100% !important;
  height: 100% !important;
  overflow: hidden !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
}

#chatbot-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 380px;
  height: 100%;
  max-height: 600px;
  background: #ffffff;
  border-radius: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12),
              0 8px 25px rgba(128, 71, 20, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
  z-index: 9999;
  box-sizing: border-box;
  border: 1px solid rgba(128, 71, 20, 0.1);
}

body.iframe-mode #chatbot-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100% !important;
  height: 100% !important;
  max-height: 100% !important;
  border-radius: 0 !important;
  border: none !important;
}

#chatbot-container.closed {
  max-height: 56px;
  height: 56px;
  width: 260px;
  border-radius: 28px;
  box-shadow: 0 8px 30px rgba(128, 71, 20, 0.25);
}

body.iframe-mode #chatbot-container.closed {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-height: 100% !important;
  border-radius: 0 !important;
}

#chatbot-container.closed #chatbot-header {
  display: none !important;
}

#chatbot-container.closed #chatbot-body {
  display: none !important;
}

#chatbot-container.closed #chatbot-header-closed {
  display: flex !important;
  background: var(--primary-color);
  padding: 12px 24px;
  cursor: pointer;
  border: none;
  height: 56px;
  width: 100%;
  border-radius: 28px;
  box-sizing: border-box;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

body.iframe-mode #chatbot-container.closed #chatbot-header-closed {
  width: 100% !important;
  height: 100% !important;
  border-radius: 0 !important;
}

#chatbot-container.closed #chatbot-header-closed:hover {
  transform: scale(1.02);
  box-shadow: 0 12px 35px rgba(128, 71, 20, 0.35);
}

#chatbot-header-closed .closed-bot-text {
  color: white;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.3px;
  white-space: nowrap;
  text-align: center;
}

#chatbot-header-closed {
  background: var(--primary-color);
  color: white;
  cursor: pointer;
}

#chatbot-header {
  background: var(--primary-color);
  color: white;
  padding: 20px 24px;
  cursor: pointer;
  font-weight: 500;
  font-size: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
  flex-shrink: 0;
  min-height: 85px;
  max-height: 85px;
  height: 85px;
  box-sizing: border-box;
  border-radius: 24px 24px 0 0;
}

body.iframe-mode #chatbot-header {
  border-radius: 0 !important;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar-wrapper {
  position: relative;
  flex-shrink: 0;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-icon {
  height: 50px;
  width: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(10px);
}

.avatar-icon i {
  font-size: 22px;
  color: white;
}

.status-indicator {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  background: #2ECC71;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.user-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-name {
  font-weight: 600;
  font-size: 16px;
  color: #ffffff;
  line-height: 1.2;
}

.user-status {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
  line-height: 1.2;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

#reset-chat-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 14px;
}

#reset-chat-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(180deg);
}

#toggle-icon {
  font-size: 20px;
  font-weight: 300;
  transition: transform 0.4s ease;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#chatbot-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  background: var(--background-light);
  flex: 1 1 auto;
  box-sizing: border-box;
  position: relative;
  min-height: 0;
  max-height: calc(100% - 85px);
  overflow: hidden;
}

#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  min-height: 0;
}

#chat-messages::-webkit-scrollbar {
  display: none;
}

.message {
  padding: 14px 18px;
  border-radius: 18px;
  max-width: 85%;
  font-size: 14px;
  line-height: 1.55;
  position: relative;
  word-wrap: break-word;
  word-break: break-word;
  overflow-wrap: break-word;
  white-space: pre-wrap;
}

.message.user {
  align-self: flex-end;
  background: var(--accent-color);
  color: white;
  border-radius: 18px 18px 4px 18px;
  box-shadow: 0 4px 15px rgba(51, 122, 183, 0.25);
}

.message.bot {
  align-self: flex-start;
  background: white;
  color: var(--text-dark);
  border-radius: 18px 18px 18px 4px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

#input-area {
  display: flex;
  flex-direction: row;
  gap: 12px;
  padding: 16px 0 0 0;
  flex-shrink: 0;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

#user-input {
  flex: 1;
  resize: none;
  height: 48px;
  padding: 14px 18px;
  font-size: 14px;
  border-radius: 24px;
  border: 1.5px solid rgba(0, 0, 0, 0.08);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  box-sizing: border-box;
  background: white;
  color: var(--text-dark);
  outline: none;
  transition: all 0.3s ease;
  scrollbar-width: none;
  -ms-overflow-style: none;
  line-height: 1.4;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

#user-input::-webkit-scrollbar {
  display: none;
}

#user-input::placeholder {
  color: var(--text-secondary);
}

#user-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(128, 71, 20, 0.12),
              0 4px 15px rgba(128, 71, 20, 0.1);
}

button {
  background: var(--accent-color);
  color: white;
  border: none;
  border-radius: 50%;
  padding: 0;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  height: 48px;
  width: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(51, 122, 183, 0.25);
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(51, 122, 183, 0.35);
}

button:active {
  transform: translateY(0);
}

#chatbot-footer {
  text-align: center;
  padding: 4px 0;
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
}

#chatbot-footer a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.3s ease;
}

#chatbot-footer a:hover {
  color: var(--primary-dark);
}

.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
  padding: 0;
}

.quick-reply-btn {
  background: white;
  color: var(--primary-color);
  border: 1.5px solid var(--primary-color);
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  white-space: nowrap;
  height: auto;
  width: auto;
  min-height: 38px;
  box-shadow: 0 2px 8px rgba(128, 71, 20, 0.1);
}

.quick-reply-btn:hover {
  background: var(--primary-color);
  color: white;
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(128, 71, 20, 0.25);
}

.contact-btn {
  background: var(--accent-color);
  color: white;
  border: none;
  border-radius: 22px;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  height: auto;
  width: auto;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
  box-shadow: 0 4px 15px rgba(93, 173, 226, 0.25);
}

.contact-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(93, 173, 226, 0.35);
}

.contact-form {
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 16px;
  padding: 20px;
  margin: 12px 0;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
}

.contact-form h4 {
  margin: 0 0 8px 0;
  color: var(--primary-color);
  font-size: 15px;
  font-weight: 600;
}

.contact-form p {
  margin: 0 0 16px 0;
  line-height: 1.5;
}

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

.form-group label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-dark);
  font-size: 13px;
  font-weight: 500;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  background: var(--background-light);
  color: var(--text-dark);
  font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  box-sizing: border-box;
  transition: all 0.3s ease;
  resize: none;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  background: white;
  box-shadow: 0 0 0 3px rgba(128, 71, 20, 0.1);
}

.form-group textarea {
  height: 80px;
  min-height: 80px;
}

.form-submit-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 14px 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(128, 71, 20, 0.25);
}

.form-submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(128, 71, 20, 0.35);
}

.form-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Responsive styles */
@media (max-width: 768px) {
  body:not(.iframe-mode) #chatbot-container {
    bottom: 10px;
    right: 10px;
    left: 10px;
    width: auto;
    max-width: calc(100vw - 20px);
    max-height: 70vh;
    border-radius: 20px;
  }
  
  body:not(.iframe-mode) #chatbot-container.closed {
    width: 240px;
    height: 52px;
    left: auto;
    right: 10px;
    border-radius: 26px;
  }
  
  body.iframe-mode #chatbot-container {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    top: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  
  body:not(.iframe-mode) #chatbot-header {
    padding: 12px 16px;
    min-height: 70px;
    max-height: 70px;
    height: 70px;
    border-radius: 20px 20px 0 0;
  }
  
  body:not(.iframe-mode) .avatar-wrapper {
    width: 40px;
    height: 40px;
  }
  
  body:not(.iframe-mode) .avatar-icon {
    height: 40px;
    width: 40px;
  }
  
  body:not(.iframe-mode) .avatar-icon i {
    font-size: 18px;
  }
  
  body:not(.iframe-mode) .user-name {
    font-size: 15px;
  }
  
  body:not(.iframe-mode) #chatbot-body {
    padding: 14px;
    max-height: calc(100% - 70px);
  }
  
  body:not(.iframe-mode) #user-input {
    height: 46px;
    font-size: 16px !important;
  }
  
  body:not(.iframe-mode) .message {
    max-width: 88%;
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  body:not(.iframe-mode) #chatbot-container {
    bottom: 5px;
    right: 5px;
    left: 5px;
    max-width: calc(100vw - 10px);
    max-height: 80vh;
  }
  
  body:not(.iframe-mode) #chatbot-container.closed {
    width: 220px;
    height: 50px;
    right: 5px;
  }
  
  body:not(.iframe-mode) #chatbot-header {
    padding: 10px 14px;
    min-height: 60px;
    max-height: 60px;
    height: 60px;
  }
  
  body:not(.iframe-mode) .avatar-wrapper {
    width: 36px;
    height: 36px;
  }
  
  body:not(.iframe-mode) .avatar-icon {
    height: 36px;
    width: 36px;
  }
  
  body:not(.iframe-mode) .user-name {
    font-size: 14px;
  }
  
  body:not(.iframe-mode) .user-status {
    font-size: 11px;
  }
  
  body:not(.iframe-mode) #chatbot-body {
    padding: 12px;
    max-height: calc(100% - 60px);
  }
  
  body:not(.iframe-mode) #user-input {
    height: 44px;
    padding: 10px 14px;
  }
  
  body:not(.iframe-mode) button {
    height: 44px;
    width: 44px;
  }
  
  body:not(.iframe-mode) .message {
    padding: 12px 14px;
    max-width: 90%;
    font-size: 13.5px;
  }
  
  body:not(.iframe-mode) .quick-reply-btn {
    padding: 8px 14px;
    font-size: 12.5px;
    min-height: 34px;
  }
}
