/* =============================================
   HelloMind — Premium Dark UI v4.0
   ============================================= */

:root {
  --bg-deep: #050510;
  --bg-base: #0a0a1a;
  --bg-surface: #0f0f28;
  --bg-elevated: #141438;
  --bg-card: rgba(20, 20, 56, 0.55);

  --border-subtle: rgba(99, 102, 241, 0.06);
  --border-default: rgba(99, 102, 241, 0.12);
  --border-active: rgba(99, 102, 241, 0.35);

  --text-primary: #eeeeff;
  --text-secondary: #9a9ac8;
  --text-muted: #5f5f8a;
  --text-dim: #3d3d66;

  --accent: #6366f1;
  --accent-light: #818cf8;
  --accent-lighter: #a5b4fc;
  --accent-glow: rgba(99, 102, 241, 0.2);
  --accent-2: #a855f7;

  --user-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
  --bot-bg: rgba(15, 15, 40, 0.85);

  --danger: #f87171;
  --success: #34d399;

  --mood-senang: #34d399;
  --mood-biasa: #60a5fa;
  --mood-sedih: #818cf8;
  --mood-cemas: #fbbf24;
  --mood-marah: #f87171;

  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;
  --radius-full: 999px;

  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-spring: cubic-bezier(.32, .72, 0, 1);
}

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

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: -webkit-fill-available;
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  padding-top: var(--safe-top);
}

/* AMBIENT BG */
.ambient-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

/* Sidebar overlay — hidden on desktop, shown on mobile */
.sidebar-overlay {
  display: none;
  pointer-events: none;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.12;
  animation: orbFloat 24s infinite ease-in-out;
  will-change: transform;
}

.orb-1 {
  width: 550px;
  height: 550px;
  background: radial-gradient(circle, var(--accent), transparent 70%);
  top: -18%;
  right: -12%;
  animation-duration: 28s;
}

.orb-2 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, var(--accent-2), transparent 70%);
  bottom: -12%;
  left: -8%;
  animation-duration: 32s;
  animation-delay: -8s;
}

.orb-3 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, #3b82f6, transparent 70%);
  top: 40%;
  left: 50%;
  animation-duration: 26s;
  opacity: 0.06;
}

.orb-4 {
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, #10b981, transparent 70%);
  bottom: 30%;
  right: 20%;
  animation-duration: 30s;
  opacity: 0.04;
}

@keyframes orbFloat {

  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }

  33% {
    transform: translate(30px, -40px) scale(1.05);
  }

  66% {
    transform: translate(-25px, 25px) scale(0.95);
  }
}

/* LAYOUT */
.layout {
  display: flex;
  height: 100vh;
  height: 100dvh;
  position: relative;
  z-index: 1;
  margin-left: 260px;
  transition: margin-left 0.35s var(--ease-out);
  overflow: hidden;
}

body.sidebar-collapsed .layout {
  margin-left: 60px;
}

/* SIDEBAR */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 260px;
  z-index: 200;
  background: rgba(14, 14, 38, 0.98);
  border-right: 1px solid rgba(99, 102, 241, 0.18);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  transition: width 0.35s var(--ease-out);
  overflow-x: hidden;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
  padding: 0 2px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-brand img {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.brand-text {
  font-weight: 700;
  font-size: 15px;
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

#sidebarToggle {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

#sidebarToggle:hover {
  background: rgba(99, 102, 241, 0.06);
  color: var(--text-secondary);
}

#newChatBtn {
  background: var(--user-gradient);
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: white;
  font-weight: 600;
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 20px var(--accent-glow);
  transition: all 0.3s var(--ease-out);
}

#newChatBtn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 28px var(--accent-glow);
}

#newChatBtn:active {
  transform: scale(0.97);
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  padding: 10px 6px 4px;
}

.sidebar-features {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.feature-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.feature-btn:hover {
  background: rgba(99, 102, 241, 0.06);
  color: var(--text-primary);
}

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

.feature-label {
  font-weight: 500;
}

#history {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  flex: 1 1 0;
  min-height: 0;
  padding-right: 2px;
}

#history:empty::after {
  content: 'Belum ada riwayat';
  display: block;
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
  padding: 20px 10px;
  font-style: italic;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 2px;
  border-radius: 10px;
  padding: 2px;
  transition: all 0.2s;
  border: 1px solid transparent;
}

.history-item:hover {
  background: rgba(99, 102, 241, 0.05);
  border-color: var(--border-subtle);
}

.history-item.active {
  background: rgba(99, 102, 241, 0.08);
  border-color: var(--border-default);
}

.history-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-family: var(--font);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.history-item:hover .history-btn,
.history-item.active .history-btn {
  color: var(--text-primary);
}

.history-action {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: all 0.2s;
  flex-shrink: 0;
  opacity: 0;
  pointer-events: none;
}

.history-item:hover .history-action {
  opacity: 1;
  pointer-events: all;
}

.history-action:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
}

.history-action.delete:hover {
  color: var(--danger);
  background: rgba(248, 113, 113, 0.08);
}

/* Collapsed */
.sidebar.collapsed {
  width: 60px;
}

.sidebar.collapsed .brand-text,
.sidebar.collapsed #newChatBtn span,
.sidebar.collapsed .sidebar-section-label,
.sidebar.collapsed #history,
.sidebar.collapsed #newChatBtn,
.sidebar.collapsed .sidebar-features,
.sidebar.collapsed .feature-label {
  opacity: 0;
  pointer-events: none;
}

/* APP */
.app {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
  overflow: hidden;
}

/* HERO */
#hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  animation: fadeUp 0.5s var(--ease-out);
}

.hero-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  max-width: 520px;
  width: 100%;
  padding: 40px 24px 32px;
}

.hero-icon-wrap {
  position: relative;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.hero-icon-glow {
  position: absolute;
  inset: -16px;
  background: radial-gradient(circle, var(--accent-glow), transparent 70%);
  border-radius: 50%;
  animation: glowPulse 4s ease-in-out infinite;
}

@keyframes glowPulse {

  0%,
  100% {
    opacity: 0.3;
    transform: scale(1);
  }

  50% {
    opacity: 0.7;
    transform: scale(1.15);
  }
}

.hero-icon {
  font-size: 42px;
  position: relative;
  z-index: 1;
  animation: float 4s ease-in-out infinite;
}

@keyframes float {

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

  50% {
    transform: translateY(-6px);
  }
}

#hero h1 {
  font-size: 42px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.05;
  background: linear-gradient(135deg, #fff 0%, var(--accent-lighter) 40%, var(--accent-light) 70%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  /* no shimmer animation */
}

@keyframes shimmer {

  0%,
  100% {
    background-position: 0% center;
  }

  50% {
    background-position: 100% center;
  }
}

.hero-subtitle {
  color: var(--text-secondary);
  max-width: 350px;
  font-size: 14px;
  line-height: 1.65;
  margin-bottom: 12px;
}

/* MOOD */
.mood-checkin {
  width: 100%;
  max-width: 440px;
  margin-bottom: 16px;
}

.mood-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.mood-options {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mood-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.3s var(--ease-out);
  backdrop-filter: blur(12px);
  min-width: 64px;
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
}

.mood-btn:hover {
  transform: translateY(-2px) scale(1.03);
  border-color: var(--border-active);
}

.mood-btn:active {
  transform: scale(0.95);
}

.mood-btn.selected {
  border-color: var(--accent);
  box-shadow: 0 0 18px var(--accent-glow);
  transform: scale(1.05);
}

.mood-btn[data-mood="senang"].selected {
  border-color: var(--mood-senang);
  box-shadow: 0 0 16px rgba(52, 211, 153, 0.2);
}

.mood-btn[data-mood="biasa"].selected {
  border-color: var(--mood-biasa);
  box-shadow: 0 0 16px rgba(96, 165, 250, 0.2);
}

.mood-btn[data-mood="sedih"].selected {
  border-color: var(--mood-sedih);
  box-shadow: 0 0 16px rgba(129, 140, 248, 0.2);
}

.mood-btn[data-mood="cemas"].selected {
  border-color: var(--mood-cemas);
  box-shadow: 0 0 16px rgba(251, 191, 36, 0.2);
}

.mood-btn[data-mood="marah"].selected {
  border-color: var(--mood-marah);
  box-shadow: 0 0 16px rgba(248, 113, 113, 0.2);
}

.mood-emoji {
  font-size: 26px;
  transition: transform 0.3s var(--ease-out);
}

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

.mood-name {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* PROMPT CARDS */
.examples {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  max-width: 440px;
  width: 100%;
  margin-bottom: 16px;
}

.prompt-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.25s var(--ease-out);
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  font-family: var(--font);
  backdrop-filter: blur(12px);
  -webkit-tap-highlight-color: transparent;
}

.prompt-card:hover {
  border-color: var(--border-active);
  transform: translateY(-2px);
}

.prompt-card:active {
  transform: scale(0.97);
}

.prompt-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.prompt-text {
  font-size: 12.5px;
  color: var(--text-secondary);
  font-weight: 500;
  line-height: 1.35;
}

.prompt-card:hover .prompt-text {
  color: var(--text-primary);
}

/* WELLNESS CAROUSEL */
.wellness-carousel {
  width: 100%;
  max-width: 440px;
  overflow: hidden;
  margin-bottom: 8px;
}

.wellness-track {
  display: flex;
  transition: transform 0.5s var(--ease-out);
}

.wellness-card {
  min-width: 100%;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(12px);
  text-align: center;
}

.wellness-card .wellness-icon {
  font-size: 22px;
  display: block;
  margin-bottom: 6px;
}

.wellness-card p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.wellness-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
}

.wellness-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-dim);
  cursor: pointer;
  transition: all 0.3s;
  border: none;
  padding: 0;
}

.wellness-dot.active {
  background: var(--accent);
  width: 18px;
  border-radius: 4px;
  box-shadow: 0 0 8px var(--accent-glow);
}

/* CHAT */
#chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px 28px 10px;
  scroll-behavior: smooth;
  width: 100%;
}

.message-wrap {
  display: flex;
  gap: 10px;
  animation: fadeUp 0.3s var(--ease-out);
}

.message-wrap.user-wrap {
  flex-direction: row-reverse;
}

.msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  margin-top: 2px;
}

.msg-avatar.bot-avatar {
  background: var(--bot-bg);
  border: 1px solid var(--border-default);
}

.msg-avatar.user-avatar {
  background: var(--user-gradient);
}

.msg-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: 72%;
  min-width: 0;
}

.message-wrap.user-wrap .msg-body {
  align-items: flex-end;
}

.message {
  padding: 11px 16px;
  border-radius: var(--radius-lg);
  line-height: 1.6;
  font-size: 14px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.bot {
  background: var(--bot-bg);
  border-bottom-left-radius: 6px;
  border: 1px solid var(--border-default);
  backdrop-filter: blur(16px);
  color: var(--text-primary);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

.user {
  background: var(--user-gradient);
  color: white;
  border-bottom-right-radius: 6px;
  box-shadow: 0 4px 20px var(--accent-glow);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.msg-time {
  font-size: 10px;
  color: var(--text-dim);
  padding: 0 4px;
}

.message.error-msg {
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.15);
  color: var(--text-secondary);
  font-style: italic;
}

/* TYPING */
.typing-wrap {
  display: flex;
  gap: 10px;
  animation: fadeUp 0.3s ease;
}

.typing {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 11px 16px;
  border-radius: var(--radius-lg);
  border-bottom-left-radius: 6px;
  background: var(--bot-bg);
  border: 1px solid var(--border-default);
  backdrop-filter: blur(16px);
}

.typing .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  animation: typingPulse 1.4s infinite;
}

.typing .dot:nth-child(1) {
  background: var(--accent);
}

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

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

@keyframes typingPulse {

  0%,
  80%,
  100% {
    transform: scale(0.6);
    opacity: 0.3;
  }

  40% {
    transform: scale(1.2);
    opacity: 1;
  }
}

/* INPUT */
.input-area {
  padding: 8px 28px 14px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.disclaimer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
}

.disclaimer strong {
  color: var(--text-muted);
}

.input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(12, 12, 32, 0.85);
  border-radius: var(--radius-full);
  padding: 5px 5px 5px 18px;
  border: none;
  backdrop-filter: blur(20px);
  transition: all 0.3s var(--ease-out);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.input-wrapper:focus-within {
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.12), 0 4px 20px rgba(0, 0, 0, 0.18);
}

input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font);
  padding: 9px 0;
  min-width: 0;
}

input::placeholder {
  color: var(--text-muted);
}

#sendBtn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--user-gradient);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.25s var(--ease-out);
  box-shadow: 0 3px 14px var(--accent-glow);
}

#sendBtn:hover {
  transform: scale(1.08);
}

#sendBtn:active {
  transform: scale(0.92);
}

#sendBtn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* MODALS */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 16, 0.88);
  backdrop-filter: blur(10px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease-out);
  padding: 20px;
  padding-top: calc(20px + var(--safe-top));
  padding-bottom: calc(20px + var(--safe-bottom));
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: 28px 24px;
  max-width: 420px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.5);
  transform: translateY(16px) scale(0.97);
  transition: transform 0.3s var(--ease-out);
}

.modal-overlay.active .modal-content {
  transform: translateY(0) scale(1);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  z-index: 2;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.modal-content h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
  padding-right: 36px;
  background: linear-gradient(135deg, var(--text-primary), var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.modal-desc {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 20px;
  line-height: 1.6;
}

/* Shared buttons */
.btn-primary {
  background: var(--user-gradient);
  border: none;
  border-radius: var(--radius-full);
  padding: 11px 24px;
  color: white;
  font-weight: 600;
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.3s var(--ease-out);
  box-shadow: 0 3px 16px var(--accent-glow);
  -webkit-tap-highlight-color: transparent;
}

.btn-primary:hover {
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: scale(0.96);
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  padding: 10px 20px;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.25s;
  -webkit-tap-highlight-color: transparent;
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

/* Breathing */
.breathing-circle-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.breathing-circle {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.12), rgba(168, 85, 247, 0.05));
  border: 2px solid var(--accent);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.6s var(--ease-out);
  box-shadow: 0 0 35px var(--accent-glow);
}

.breathing-circle.inhale {
  transform: scale(1.25);
  box-shadow: 0 0 55px var(--accent-glow);
}

.breathing-circle.hold {
  transform: scale(1.25);
  border-color: var(--accent-2);
}

.breathing-circle.exhale {
  transform: scale(1);
}

.breathing-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.breathing-timer {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent-light);
}

.breathing-controls {
  text-align: center;
}

.breathing-cycles {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Journal */
.journal-prompt-card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 22px 18px;
  margin-bottom: 14px;
  text-align: center;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.journal-prompt-card p {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.6;
  font-style: italic;
}

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

.journal-actions .btn-outline,
.journal-actions .btn-primary {
  flex: 1;
  min-width: 120px;
  text-align: center;
}

/* Tips */
.tips-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.tip-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
  transition: all 0.25s var(--ease-out);
}

.tip-card:hover {
  border-color: var(--border-active);
  transform: translateY(-2px);
}

.tip-card .tip-icon {
  font-size: 22px;
  display: block;
  margin-bottom: 6px;
}

.tip-card .tip-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.tip-card .tip-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* History Modal */
.history-new-chat {
  width: 100%;
  margin-bottom: 12px;
}

#historyModalList {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#historyModalList:empty::after {
  content: 'Belum ada riwayat obrolan';
  display: block;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  padding: 28px 16px;
  font-style: italic;
}

#historyModalList .history-item {
  border-radius: var(--radius-sm);
  padding: 4px 6px;
  min-height: 46px;
}

#historyModalList .history-btn {
  padding: 12px 10px;
  font-size: 14px;
  min-height: 46px;
  display: flex;
  align-items: center;
}

#historyModalList .history-action {
  opacity: 1;
  pointer-events: all;
  width: 30px;
  height: 30px;
  background: rgba(99, 102, 241, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
}

#historyModalList .history-action:active {
  transform: scale(0.88);
}

#historyModalList .history-action.delete {
  background: rgba(248, 113, 113, 0.06);
  border-color: rgba(248, 113, 113, 0.12);
}

#historyModalList .history-item:active {
  background: rgba(99, 102, 241, 0.08);
}

/* FOOTER */
.footer {
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--text-dim);
  background: rgba(5, 5, 16, 0.85);
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
  padding-bottom: var(--safe-bottom);
}

/* SCROLLBAR */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.15);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.3);
}

/* BOTTOM NAV */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(8, 8, 22, 0.97);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid var(--border-subtle);
  padding: 2px 0;
  padding-bottom: calc(2px + var(--safe-bottom));
}

.mobile-bottom-nav .nav-items {
  display: flex;
  justify-content: space-around;
  align-items: center;
}

.mobile-bottom-nav .nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 6px 8px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 9px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border-radius: 10px;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

.mobile-bottom-nav .nav-item .nav-icon {
  font-size: 18px;
  transition: transform 0.2s var(--ease-out);
}

.mobile-bottom-nav .nav-item:active {
  transform: scale(0.88);
}

.mobile-bottom-nav .nav-item.active {
  color: var(--accent-light);
}

.mobile-bottom-nav .nav-item.active .nav-icon {
  transform: scale(1.08);
}

.mobile-bottom-nav .nav-item.active::after {
  content: '';
  position: absolute;
  bottom: 1px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

/* ============ TABLET ============ */
@media (max-width: 1024px) {
  .sidebar {
    width: 220px;
  }

  .layout {
    margin-left: 220px;
  }

  body.sidebar-collapsed .layout {
    margin-left: 60px;
  }
}

/* ============ MOBILE ============ */
@media (max-width: 768px) {
  .layout {
    margin-left: 0;
  }

  body.sidebar-collapsed .layout {
    margin-left: 0;
  }

  .sidebar {
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.4s var(--ease-spring);
    box-shadow: none;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 12px 0 48px rgba(0, 0, 0, 0.5);
  }

  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 199;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s var(--ease-spring);
    -webkit-tap-highlight-color: transparent;
  }

  .sidebar-overlay.active {
    opacity: 1;
    pointer-events: all;
  }

  .mobile-bottom-nav {
    display: block;
  }

  .layout {
    height: 100vh;
    height: 100dvh;
  }

  /* Mobile header */
  .mobile-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(8, 8, 22, 0.95);
    border-bottom: 1px solid var(--border-subtle);
    backdrop-filter: blur(20px);
    flex-shrink: 0;
    z-index: 10;
    padding-top: calc(10px + var(--safe-top));
  }

  .mobile-header .mobile-menu-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-header .mobile-title {
    font-size: 16px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }

  .mobile-header .mobile-new-chat {
    margin-left: auto;
    background: var(--user-gradient);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    font-weight: 300;
    box-shadow: 0 2px 10px var(--accent-glow);
    -webkit-tap-highlight-color: transparent;
  }

  /* Hero */
  .hero-content {
    padding: 16px 14px 20px;
    gap: 6px;
  }

  .hero-icon-wrap {
    width: 48px;
    height: 48px;
    margin-bottom: 0;
  }

  .hero-icon {
    font-size: 32px;
  }

  #hero h1 {
    font-size: 32px;
  }

  .hero-subtitle {
    font-size: 13px;
    margin-bottom: 10px;
  }

  .mood-options {
    gap: 6px;
  }

  .mood-btn {
    padding: 10px 12px;
    min-width: 56px;
  }

  .mood-emoji {
    font-size: 22px;
  }

  .examples {
    gap: 6px;
    margin-bottom: 12px;
  }

  .prompt-card {
    padding: 10px 12px;
  }

  .prompt-text {
    font-size: 12px;
  }

  .wellness-card {
    padding: 12px 14px;
  }

  /* Chat */
  #chat {
    padding: 12px 12px 6px;
    gap: 10px;
  }

  .message {
    padding: 10px 14px;
    font-size: 13.5px;
    border-radius: 18px;
  }

  .msg-avatar {
    width: 26px;
    height: 26px;
    font-size: 12px;
  }

  .msg-body {
    max-width: 80%;
  }

  /* Input */
  .input-area {
    padding: 6px 12px 8px;
    padding-bottom: calc(56px + var(--safe-bottom));
    background: rgba(5, 5, 16, 0.96);
    border-top: 1px solid var(--border-subtle);
  }

  .input-wrapper {
    padding: 3px 3px 3px 14px;
  }

  input {
    font-size: 15px;
    padding: 8px 0;
  }

  #sendBtn {
    width: 36px;
    height: 36px;
  }

  .disclaimer {
    font-size: 10px;
  }

  .footer {
    display: none;
  }

  /* Modal mobile */
  .modal-overlay {
    padding: 12px;
    align-items: flex-end;
  }

  .modal-content {
    padding: 22px 16px;
    max-height: 80vh;
    border-radius: var(--radius-xl) var(--radius-xl) var(--radius-sm) var(--radius-sm);
    margin-bottom: var(--safe-bottom);
  }

  .tips-grid {
    gap: 8px;
  }

  .breathing-circle {
    width: 130px;
    height: 130px;
  }
}

/* ============ SMALL PHONE ============ */
@media (max-width: 390px) {
  .hero-content {
    padding: 12px 10px 16px;
  }

  #hero h1 {
    font-size: 26px;
  }

  .hero-subtitle {
    font-size: 12px;
  }

  .mood-btn {
    padding: 8px 10px;
    min-width: 50px;
  }

  .mood-emoji {
    font-size: 20px;
  }

  .examples {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .tips-grid {
    grid-template-columns: 1fr;
  }

  .modal-content {
    padding: 18px 14px;
  }
}

/* ANIMATIONS */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

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

/* ACCESSIBILITY */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }

  .orb {
    animation: none;
  }
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}