* {
  box-sizing: border-box;
}

:root {
  --pink-1: #ff9a9e;
  --pink-2: #fecfef;
  --pink-3: #ffdde1;
  --purple: #5a1f3b;
  --text-dark: #3c2233;
  --bubble-bot: #ffffff;
  --bubble-user: linear-gradient(135deg, #ff9a9e, #ff7eb3);
  --radius: 18px;
}

html, body {
  height: 100%;
  margin: 0;
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text-dark);
  background: linear-gradient(160deg, #ffe0ec 0%, #ffc9de 40%, #ffb6c9 100%);
  overflow: hidden;
  overflow-x: hidden;
  width: 100%;
}

.bg-decor {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.bg-decor .heart {
  position: absolute;
  bottom: -10%;
  font-size: 22px;
  opacity: 0.55;
  animation: floatUp linear infinite;
  filter: drop-shadow(0 2px 4px rgba(255, 105, 150, 0.25));
}

@keyframes floatUp {
  0% {
    transform: translateY(0) translateX(0) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 0.6;
  }
  90% {
    opacity: 0.4;
  }
  100% {
    transform: translateY(-115vh) translateX(var(--drift, 20px)) rotate(25deg);
    opacity: 0;
  }
}

.phone {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background: rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 20px 60px rgba(150, 30, 80, 0.25);
}

@media (min-width: 481px) {
  .phone {
    margin-top: 3vh;
    height: 94vh;
    border-radius: 28px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.6);
  }
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: linear-gradient(135deg, var(--pink-1), var(--pink-2));
  box-shadow: 0 4px 16px rgba(255, 130, 160, 0.35);
  flex-shrink: 0;
  min-width: 0;
}

.header-text {
  min-width: 0;
}

.back-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.55);
  color: var(--purple);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  animation: bubbleIn 0.3s ease both;
  transition: transform 0.15s ease, background 0.15s ease;
}

.back-btn:hover {
  background: #fff;
  transform: translateX(-2px);
}

.back-btn:active {
  transform: scale(0.92);
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.header-name {
  font-weight: 800;
  font-size: 16px;
  color: var(--purple);
}

.header-status {
  font-size: 12px;
  color: #7a3f56;
  display: flex;
  align-items: center;
  gap: 5px;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 rgba(52, 211, 153, 0.5);
  animation: dotPulse 1.6s infinite;
}

@keyframes dotPulse {
  0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5); }
  70% { box-shadow: 0 0 0 6px rgba(52, 211, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

.chat-window {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.chat-window::-webkit-scrollbar {
  width: 6px;
}
.chat-window::-webkit-scrollbar-thumb {
  background: rgba(255, 130, 160, 0.4);
  border-radius: 10px;
}

.bubble {
  max-width: 82%;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 15px;
  line-height: 1.45;
  animation: bubbleIn 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
  word-wrap: break-word;
  white-space: pre-wrap;
}

@keyframes bubbleIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.bubble.bot {
  align-self: flex-start;
  background: var(--bubble-bot);
  color: var(--text-dark);
  border-bottom-left-radius: 4px;
  box-shadow: 0 3px 10px rgba(90, 30, 60, 0.08);
}

.bubble.user {
  align-self: flex-end;
  background: var(--bubble-user);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 3px 12px rgba(255, 100, 140, 0.4);
}

.bubble.typing {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 14px 18px;
}

.bubble.typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d68aa4;
  animation: typingBounce 1.1s infinite ease-in-out;
}
.bubble.typing span:nth-child(2) { animation-delay: 0.15s; }
.bubble.typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-6px); opacity: 1; }
}

.chip-group {
  align-self: flex-start;
  width: 82%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 2px 0 6px;
  animation: bubbleIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.chip {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  min-width: 0;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1.5px solid rgba(255, 130, 160, 0.55);
  background: rgba(255, 255, 255, 0.75);
  color: var(--purple);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.chip-label {
  min-width: 0;
  overflow-wrap: break-word;
}

.chip:hover {
  transform: translateX(3px);
  background: #fff;
  box-shadow: 0 6px 14px rgba(255, 120, 160, 0.35);
}

.chip:active {
  transform: translateY(0) scale(0.97);
}

.chip.selected {
  background: var(--bubble-user);
  color: #fff;
  border-color: transparent;
}

.chip-emoji {
  font-size: 17px;
}

.chat-input-bar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.55);
  border-top: 1px solid rgba(255, 130, 160, 0.25);
  flex-shrink: 0;
  animation: slideUp 0.35s ease both;
}

@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

#noteInput {
  flex: 1;
  resize: none;
  border: none;
  outline: none;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 20px;
  padding: 12px 16px;
  font-family: inherit;
  font-size: 15px;
  max-height: 100px;
  color: var(--text-dark);
}

.send-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--bubble-user);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(255, 100, 140, 0.45);
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.send-btn:hover {
  transform: scale(1.08);
}
.send-btn:active {
  transform: scale(0.94);
}
.send-btn:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
}

.datetime-card {
  align-self: flex-start;
  width: 82%;
  min-width: 0;
  background: #fff;
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 3px 10px rgba(90, 30, 60, 0.08);
  animation: bubbleIn 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.datetime-row {
  display: flex;
  gap: 10px;
  min-width: 0;
}

.datetime-row label {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 130, 160, 0.08);
  border: 1.5px solid rgba(255, 130, 160, 0.3);
  border-radius: 12px;
  padding: 8px 10px;
}

.dt-icon {
  font-size: 15px;
  flex-shrink: 0;
}

.datetime-row input[type="date"],
.datetime-row input[type="time"] {
  border: none;
  background: transparent;
  outline: none;
  font-family: inherit;
  font-size: 14px;
  color: var(--text-dark);
  width: 100%;
  min-width: 0;
}

.datetime-actions {
  display: flex;
  gap: 8px;
}

.chip-action {
  flex: 1;
  padding: 10px;
  border-radius: 12px;
  border: none;
  font-family: inherit;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.chip-action:not(.ghost) {
  background: var(--bubble-user);
  color: #fff;
  box-shadow: 0 4px 12px rgba(255, 100, 140, 0.35);
}

.chip-action.ghost {
  background: rgba(255, 130, 160, 0.12);
  color: var(--purple);
  border: 1.5px solid rgba(255, 130, 160, 0.4);
}

.chip-action:hover {
  transform: translateY(-1px);
}

.chip-action:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
}

.success-card {
  align-self: center;
  text-align: center;
  padding: 26px 24px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 30px rgba(255, 100, 140, 0.35);
  animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  max-width: 88%;
}

@keyframes popIn {
  0% { opacity: 0; transform: scale(0.6); }
  100% { opacity: 1; transform: scale(1); }
}

.success-emoji {
  font-size: 46px;
  display: block;
  margin-bottom: 8px;
  animation: heartBeat 1.2s ease-in-out infinite;
}

@keyframes heartBeat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.error-text {
  color: #c0335d;
  font-weight: 700;
}
