/* ═══════════════════════════════════════════════════════════════
   SmileCare Dental – WhatsApp Assistant Styles (Full Version)
   ═══════════════════════════════════════════════════════════════ */

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

:root {
  --wa-green: #25D366;
  --wa-dark-green: #128C7E;
  --wa-teal: #075E54;
  --wa-light-green: #DCF8C6;
  --wa-bg: #ECE5DD;
  --wa-bubble-in: #FFFFFF;
  --wa-bubble-out: #DCF8C6;
  --wa-header: #0a4d6e;
  --sidebar-bg: #0d1b2a;
  --sidebar-card: #112233;
  --sidebar-accent: #1a3a5c;
  --accent-blue: #1e88e5;
  --accent-teal: #00acc1;
  --text-light: #e0e0e0;
  --text-muted: #90a4b8;
  --time-color: #999;
  --tick-color: #53bdeb;
  --radius: 12px;
}

body {
  font-family: 'Inter', sans-serif;
  height: 90dvh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #020c18, #0a2744, #091929);
}


.bg-wallpaper {
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none'%3E%3Cg fill='%23ffffff' fill-opacity='0.025'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  z-index: 0;
}

/* ── App Wrapper ── */
.app-wrapper {
  position: relative;
  z-index: 1;
  display: flex;
  width: 95vw;
  max-width: 1100px;
  height: 92vh;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.65);
}

/* ── Sidebar ── */
.sidebar {
  width: 300px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px 16px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #1a3a5c transparent;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.logo-icon {
  font-size: 2rem;
  background: linear-gradient(135deg, #1e88e5, #00acc1);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(30, 136, 229, 0.4);
  flex-shrink: 0;
}

.sidebar-logo h2 {
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
}

.badge-online {
  color: var(--wa-green);
  font-size: 0.7rem;
  font-weight: 500;
}

.info-card {
  background: var(--sidebar-card);
  border-radius: 10px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.info-card h3 {
  color: var(--accent-teal);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 7px;
}

.info-card p,
.info-card li {
  color: var(--text-light);
  font-size: 0.8rem;
  line-height: 1.65;
}

.info-card ul {
  list-style: none;
  padding: 0;
}

.info-card ul li::before {
  content: "→ ";
  color: var(--accent-blue);
  font-weight: 600;
}

.quick-btns {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding-top: 8px;
}

.quick-label {
  color: var(--text-muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin-bottom: 2px;
}

.quick-btn {
  background: var(--sidebar-accent);
  color: #e8f4ff;
  border: 1px solid rgba(30, 136, 229, 0.2);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.78rem;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  font-family: 'Inter', sans-serif;
}

.quick-btn:hover {
  background: var(--accent-blue);
  border-color: var(--accent-teal);
  transform: translateX(3px);
  color: #fff;
}

/* ── Chat Panel ── */
.chat-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--wa-bg);
  background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%23a0a0a0' fill-opacity='0.06' fill-rule='evenodd'/%3E%3C/svg%3E");
  overflow: hidden;
}

/* ── Header ── */
.chat-header {
  background: var(--wa-header);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.header-avatar {
  position: relative;
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #1e88e5, #00acc1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.15);
}

.avatar-dot {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 10px;
  height: 10px;
  background: #25D366;
  border-radius: 50%;
  border: 2px solid var(--wa-header);
}

.header-info h1 {
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
}

.typing-status {
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.73rem;
}

.typing-status.typing {
  color: #64ffda;
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.35;
  }
}

.header-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* ── Messages Area ── */
.messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scroll-behavior: smooth;
}

.messages-area::-webkit-scrollbar {
  width: 5px;
}

.messages-area::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 4px;
}

.date-divider {
  text-align: center;
  margin: 10px 0;
}

.date-divider span {
  background: rgba(255, 255, 255, 0.88);
  color: #777;
  font-size: 0.71rem;
  padding: 3px 11px;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

/* ── Message Bubbles ── */
.msg-row {
  display: flex;
  animation: slideIn 0.22s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.msg-row.bot {
  justify-content: flex-start;
}

.msg-row.user {
  justify-content: flex-end;
}

.bubble {
  max-width: 72%;
  padding: 9px 13px 6px;
  border-radius: 12px;
  font-size: 0.87rem;
  line-height: 1.56;
  position: relative;
  word-break: break-word;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.13);
}

.bubble.bot {
  background: var(--wa-bubble-in);
  border-top-left-radius: 3px;
  color: #111;
}

.bubble.user {
  background: var(--wa-bubble-out);
  border-top-right-radius: 3px;
  color: #111;
}

.bubble.bot::before {
  content: "";
  position: absolute;
  top: 0;
  left: -8px;
  border-width: 0 8px 8px 0;
  border-style: solid;
  border-color: transparent var(--wa-bubble-in) transparent transparent;
}

.bubble.user::after {
  content: "";
  position: absolute;
  top: 0;
  right: -8px;
  border-width: 0 0 8px 8px;
  border-style: solid;
  border-color: transparent transparent transparent var(--wa-bubble-out);
}

.bubble-time {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 4px;
}

.time-text {
  font-size: 0.68rem;
  color: var(--time-color);
}

.tick {
  font-size: 0.75rem;
  color: var(--tick-color);
}

.bubble.confirm {
  background: linear-gradient(135deg, #e3f2fd, #bbdefb);
  border: 1px solid #90caf9;
  max-width: 78%;
}

.bubble.success {
  background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
  border: 1px solid #a5d6a7;
}

.bubble.error-bubble {
  background: linear-gradient(135deg, #fff3e0, #ffe0b2);
  border: 1px solid #ffcc80;
}

.bubble.cancel-bubble {
  background: linear-gradient(135deg, #fce4ec, #f8bbd0);
  border: 1px solid #f48fb1;
}

/* ── Typing Indicator ── */
.typing-bubble {
  background: var(--wa-bubble-in);
  border-radius: 12px;
  border-top-left-radius: 3px;
  padding: 12px 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  display: flex;
  gap: 5px;
  align-items: center;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: #aaa;
  border-radius: 50%;
  animation: dotBounce 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes dotBounce {

  0%,
  60%,
  100% {
    transform: translateY(0);
  }

  30% {
    transform: translateY(-6px);
    background: var(--accent-blue);
  }
}

/* ── Webhook Bar ── */
.webhook-bar {
  background: #0d1b2a;
  padding: 8px 18px;
  border-top: 1px solid rgba(30, 136, 229, 0.3);
  animation: slideIn 0.3s ease;
}

#webhookMsg {
  font-size: 0.78rem;
  font-weight: 500;
}

#webhookMsg.sending {
  color: #64b5f6;
}

#webhookMsg.success {
  color: #81c784;
}

#webhookMsg.error {
  color: #e57373;
}

/* ── Footer ── */
.chat-footer {
  position: sticky;
  bottom: 0;
  z-index: 10;
}

.input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border-radius: 30px;
  padding: 6px 8px 6px 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.emoji-btn {
  font-size: 1.3rem;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
  transition: transform 0.2s;
}

.emoji-btn:hover {
  transform: scale(1.2);
}

#userInput {
  flex: 1;
  border: none;
  outline: none;
  font-size: 0.9rem;
  font-family: 'Inter', sans-serif;
  color: #333;
  background: transparent;
}

#userInput::placeholder {
  color: #aaa;
}

.send-btn {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #25D366, #128C7E);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(37, 211, 102, 0.4);
  transition: all 0.2s ease;
}

.send-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 16px rgba(37, 211, 102, 0.6);
}

.send-btn svg {
  width: 18px;
  height: 18px;
}

/* ═══════════════════════════════════════════════════
   WIDGET STYLES
   ═══════════════════════════════════════════════════ */

/* ── Widget Row (container for all inline widgets) ── */
.widget-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  animation: slideIn 0.25s ease;
  margin: 4px 0;
}

/* ── Option Chips ── */
.option-row {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 2px 8px;
}

.option-chip {
  background: #fff;
  border: 1.5px solid var(--wa-dark-green);
  color: var(--wa-teal);
  border-radius: 20px;
  padding: 7px 16px;
  font-size: 0.82rem;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.option-chip:hover {
  background: var(--wa-dark-green);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(18, 140, 126, 0.3);
}

/* ── Calendar Card ── */
.calendar-card {
  background: #fff;
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  width: 300px;
  max-width: 90vw;
}

.cal-quickpick {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.quick-date-btn {
  flex: 1;
  background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
  border: 1px solid #a5d6a7;
  color: #2e7d32;
  border-radius: 8px;
  padding: 6px 0;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: all 0.2s;
}

.quick-date-btn:hover {
  background: #2e7d32;
  color: #fff;
  border-color: #2e7d32;
}

.cal-header-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.cal-month-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: #333;
}

.cal-nav {
  background: #f0f4f8;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 1.1rem;
  cursor: pointer;
  color: #555;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.cal-nav:hover {
  background: var(--accent-blue);
  color: #fff;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.cal-head {
  text-align: center;
  font-size: 0.65rem;
  font-weight: 600;
  color: #888;
  padding: 3px 0;
}

.cal-cell {
  text-align: center;
  padding: 7px 2px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  color: #333;
  position: relative;
  transition: all 0.15s;
  user-select: none;
}

.cal-cell:not(.disabled):not(.empty):hover {
  background: var(--wa-dark-green);
  color: #fff;
  transform: scale(1.1);
}

.cal-cell.today {
  background: linear-gradient(135deg, #DCF8C6, #b2dfdb);
  color: #1a6b45;
  font-weight: 700;
}

.cal-cell.disabled {
  color: #ccc;
  cursor: not-allowed;
}

.cal-cell.empty {
  cursor: default;
}

.today-dot {
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  background: var(--wa-dark-green);
  border-radius: 50%;
}

.cal-note {
  font-size: 0.65rem;
  color: #aaa;
  margin-top: 8px;
  text-align: center;
}

/* ── Time Picker Card ── */
.timepicker-card {
  background: #fff;
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  width: 310px;
  max-width: 90vw;
}

.timepicker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.timepicker-header span {
  font-size: 0.88rem;
  font-weight: 600;
  color: #333;
}

.timepicker-header small {
  font-size: 0.7rem;
  color: #888;
}

.time-section-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 8px 0 4px;
}

.time-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

.time-slot {
  text-align: center;
  padding: 7px 4px;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  color: #075E54;
  background: #f0faf5;
  border: 1px solid #b2dfdb;
  transition: all 0.15s;
  user-select: none;
}

.time-slot:not(.taken):hover {
  background: var(--wa-dark-green);
  color: #fff;
  border-color: var(--wa-dark-green);
  transform: scale(1.05);
}

.time-slot.taken {
  background: #fde8e8;
  color: #c62828;
  border-color: #ef9a9a;
  cursor: not-allowed;
  opacity: 0.75;
}

/* ── Treatment Buttons ── */
.treatment-widget {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 2px 8px;
}

.treat-btn {
  background: #fff;
  border: 1.5px solid #0a4d6e;
  color: #0a4d6e;
  border-radius: 12px;
  padding: 8px 14px;
  font-size: 0.81rem;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
}

.treat-btn:hover {
  background: #0a4d6e;
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(10, 77, 110, 0.3);
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: #1a3a5c;
  color: #fff;
  padding: 10px 22px;
  border-radius: 22px;
  font-size: 0.82rem;
  z-index: 9999;
  animation: toastIn 0.3s ease;
  border: 1px solid rgba(30, 136, 229, 0.4);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translate(-50%, 10px);
  }

  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .app-wrapper {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
  }

  .calendar-card,
  .timepicker-card {
    width: 280px;
  }

  .time-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
