/* ===== RESET & BASE ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
body { background: #d9dcdd; font-family: 'Roboto', Arial, sans-serif; overflow-x: hidden; }
a { font-weight: bold; color: #412C76; text-decoration: none; }

/* ===== HEADER ===== */
header { position: fixed; top: 0; width: 100%; z-index: 1000; box-shadow: 1px 3px 10px #dedede; }
.header-bar { background: #412C76; padding: 8px 0; }
.header-inner { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 5px 15px; }
.logo-area img { max-width: 220px; height: auto; }
.trust-area img { max-height: 40px; }
.phone-area { color: #fff; text-align: right; }
.phone-area a { color: #fff; text-decoration: none; font-size: 24px; font-weight: 900; }
.phone-area .phone-icon { font-size: 20px; margin-right: 5px; }
.phone-area .call-label { font-size: 12px; display: block; }
.phone-area .disclaimer { font-size: 9px; color: rgba(255,255,255,0.7); margin-top: 2px; }

/* ===== MAIN CHAT AREA ===== */
.chatbot { padding-top: 90px; background: #d9dcdd; height: 100vh; height: 100dvh; }
.chat-container { max-width: 800px; margin: 0 auto; padding: 10px 15px; }
#chatArea { height: calc(100vh - 100px); height: calc(100dvh - 100px); overflow-y: auto; padding: 10px 5px 120px 5px; padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px)); scroll-behavior: smooth; -webkit-overflow-scrolling: touch; }

/* ===== CHAT BUBBLES (LEFT) ===== */
.bubble-container { display: block; margin-top: 20px; width: 98%; clear: both; }
.bubble-text { position: relative; background: #f8f8fa; border-radius: 9px; display: inline-block; padding: 30px 20px; font-size: 24px; font-weight: 700; color: #435382; max-width: 85%; word-wrap: break-word; }
.bubble-text::after { content: ''; position: absolute; left: 0; bottom: -8px; width: 0; height: 0; border: 35px solid transparent; border-right-color: #f8f8fa; border-left: 0; border-bottom: 0; margin-top: -12px; margin-left: -21px; transform: rotate(-28deg); }

/* ===== ANSWER AREA (RIGHT) ===== */
.answer-area { display: block; margin-top: 20px; width: 100%; text-align: right; overflow: hidden; }
.button-grid { display: inline-flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; max-width: 550px; }

/* ===== ORANGE BUTTONS ===== */
.btn-option { position: relative; background: #FA6742; border-radius: 8px; border: none; outline: none; display: inline-block; padding: 20px 15px; font-size: 18px; font-weight: 700; color: #fff; cursor: pointer; white-space: normal; min-width: 180px; max-width: 200px; min-height: 44px; flex: 1 1 calc(50% - 10px); text-align: center; transition: background 0.2s, transform 0.1s; -webkit-tap-highlight-color: transparent; }
.btn-option:hover { background: #f33f11; }
.btn-option:active { transform: scale(0.97); }
.btn-option.selected { background: #412C76; border: 2px solid #412C76; }
.btn-option.selected::before { content: '✓ '; font-size: 16px; }
.btn-option.faded { opacity: 0.4; pointer-events: none; }

/* ===== GO BUTTON ===== */
.btn-go { background: #c0392b; border: none; border-radius: 8px; padding: 12px 25px; font-size: 18px; font-weight: 700; color: #fff; cursor: pointer; min-height: 44px; transition: background 0.2s; -webkit-tap-highlight-color: transparent; }
.btn-go:hover { background: #a93226; }
.btn-go:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== BOOK APPOINTMENT BUTTON ===== */
.btn-book { position: relative; background: #FA6742; border-radius: 8px; border: none; outline: none; display: inline-block; padding: 20px 30px; font-size: 20px; font-weight: 700; color: #fff; cursor: pointer; text-decoration: none; transition: background 0.2s; }
.btn-book:hover { background: #f33f11; color: #fff; }
.btn-book::after { content: ''; position: absolute; right: 0; bottom: -8px; width: 0; height: 0; border: 20px solid transparent; border-left-color: #FA6742; border-right: 0; border-bottom: 0; margin-right: -12px; transform: rotate(17deg); }
.btn-book:hover::after { border-left-color: #f33f11; }

/* ===== TEXT INPUT AREA ===== */
.input-area { display: inline-flex; align-items: center; background: #fff; border-radius: 8px; padding: 12px 15px; margin-top: 10px; position: relative; }
.input-area::after { content: ''; position: absolute; right: 0; bottom: -3px; width: 0; height: 0; border: 25px solid transparent; border-left-color: #fff; border-right: 0; border-bottom: 0; margin-right: -15px; transform: rotate(17deg); }
.input-field { border: 1px solid #ddd; border-radius: 5px; padding: 12px 15px; font-size: 18px; font-weight: 700; color: #435382; outline: none; width: 220px; }
.input-field:focus { border-color: #412C76; }
.input-field::placeholder { color: #aaa; font-weight: 400; }
.input-submit { background: #c0392b; border: none; border-radius: 8px; padding: 12px 20px; font-size: 16px; font-weight: 700; color: #fff; cursor: pointer; margin-left: 10px; min-height: 44px; min-width: 44px; transition: background 0.2s; -webkit-tap-highlight-color: transparent; }
.input-submit:hover { background: #a93226; }

/* ===== TYPING INDICATOR ===== */
.typing-indicator { display: none; margin-top: 20px; }
.typing-bubble { background: #fff; border-radius: 50px; display: inline-flex; align-items: center; padding: 14px 25px; gap: 6px; }
.typing-dot { width: 10px; height: 10px; border-radius: 50%; background: #435382; animation: typingBounce 1.4s infinite ease-in-out; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

/* ===== COUNTDOWN TIMER ===== */
.countdown-wrapper { display: flex; align-items: center; justify-content: center; width: 100%; margin-top: 10px; }
.countdown-circle { width: 70px; height: 70px; border: 3px solid #c0392b; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 700; color: #435382; }

/* ===== ERROR MESSAGE ===== */
.error-msg { color: #c0392b; font-size: 14px; font-weight: 700; margin-top: 5px; text-align: right; }

/* ===== ANIMATIONS ===== */
@keyframes typingBounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-8px); }
}
@keyframes fadeInLeft {
  from { opacity: 0; transform: translateX(-30px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes fadeInRight {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}
.fade-in-left { animation: fadeInLeft 0.5s ease forwards; }
.fade-in-right { animation: fadeInRight 0.5s ease forwards; }
.fade-out { opacity: 0.35 !important; transition: opacity 0.4s ease; }

/* ===== PRIVACY MODAL ===== */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6); z-index: 2000; justify-content: center; align-items: center; }
.modal-overlay.active { display: flex; }
.modal-content { background: #fff; border-radius: 10px; max-width: 600px; width: 90%; max-height: 80vh; overflow-y: auto; padding: 30px; }
.modal-content h2 { color: #412C76; margin-bottom: 15px; font-size: 20px; }
.modal-content p { color: #555; font-size: 14px; line-height: 1.6; margin-bottom: 10px; }
.modal-close { background: #412C76; color: #fff; border: none; border-radius: 8px; padding: 10px 25px; font-size: 16px; font-weight: 700; cursor: pointer; margin-top: 15px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .header-inner { padding: 5px 10px; }
  .logo-area img { max-width: 150px; }
  .phone-area a { font-size: 18px; }
  .phone-area .call-label { font-size: 10px; }
  .trust-area { display: none; }
  .bubble-text { font-size: 18px; padding: 20px 15px; max-width: 90%; }
  .btn-option { font-size: 16px; padding: 15px 10px; min-width: 140px; max-width: 160px; }
  .input-field { width: 180px; font-size: 16px; }
  .chatbot { padding-top: 70px; }
  #chatArea { height: calc(100vh - 80px); height: calc(100dvh - 80px); padding-bottom: 160px; padding-bottom: calc(160px + env(safe-area-inset-bottom, 0px)); }
  .button-grid { max-height: 70vh; max-height: 70dvh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
}
@media (max-width: 400px) {
  .bubble-text { font-size: 16px; padding: 15px 12px; }
  .btn-option { min-width: 120px; max-width: 140px; font-size: 14px; padding: 12px 8px; min-height: 44px; }
  .input-field { width: 150px; }
}
