/* =========================================================
   ZenG English Learn
   Global App Styles
   Green / Neem Leaf Inspired Theme
   Light + Dark Mode
   Responsive Mobile-First Layout
   ========================================================= */

:root {
  --primary: #168a45;
  --primary-dark: #0f6b35;
  --primary-light: #e7f7ed;
  --primary-soft: #f1fbf4;
  --accent: #42b96c;

  --bg: #f4fbf6;
  --surface: #ffffff;
  --surface-2: #eef8f1;

  --text: #172019;
  --text-secondary: #647168;
  --text-muted: #8b978f;

  --border: #dce9df;

  --incoming-bubble: #edf7f0;
  --outgoing-bubble: #168a45;
  --outgoing-text: #ffffff;

  --online: #25c76a;
  --read-blue: #248cff;

  --danger: #dc3545;
  --warning: #f2a900;

  --shadow: 0 8px 30px rgba(20, 80, 40, 0.08);
  --shadow-small: 0 3px 14px rgba(20, 80, 40, 0.07);

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;

  --header-height: 64px;
  --bottom-nav-height: 68px;

  color-scheme: light;
}

body.dark-mode {
  --primary: #54d47f;
  --primary-dark: #39bb65;
  --primary-light: #183b26;
  --primary-soft: #14251a;
  --accent: #68e091;

  --bg: #101512;
  --surface: #18201b;
  --surface-2: #202b24;

  --text: #eef8f1;
  --text-secondary: #b0bdb4;
  --text-muted: #829087;

  --border: #2b3930;

  --incoming-bubble: #202b24;
  --outgoing-bubble: #248b4d;
  --outgoing-text: #ffffff;

  --shadow: 0 8px 30px rgba(0, 0, 0, 0.30);
  --shadow-small: 0 3px 14px rgba(0, 0, 0, 0.22);

  color-scheme: dark;
}

/* =========================================================
   RESET
   ========================================================= */

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

html {
  width: 100%;
  min-height: 100%;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  width: 100%;
  min-width: 0;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;

  font-family:
    Inter,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Arial,
    sans-serif;

  background: var(--bg);
  color: var(--text);

  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;

  overflow-x: hidden;

  transition:
    background-color 0.25s ease,
    color 0.25s ease;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

input,
textarea,
select {
  -webkit-tap-highlight-color: transparent;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

#app {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
}

/* =========================================================
   SPLASH SCREEN
   ========================================================= */

.app-loading {
  position: fixed;
  inset: 0;
  z-index: 9999;

  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;

  display: flex;
  align-items: center;
  justify-content: center;

  overflow: hidden;

  background:
    radial-gradient(
      circle at 50% 35%,
      rgba(66, 185, 108, 0.13),
      transparent 38%
    ),
    var(--bg);

  color: var(--text);
}

.splash-content {
  width: min(88vw, 360px);

  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;

  text-align: center;

  padding:
    24px
    max(20px, env(safe-area-inset-right))
    24px
    max(20px, env(safe-area-inset-left));
}

.app-logo {
  width: clamp(60px, 18vw, 72px);
  height: clamp(60px, 18vw, 72px);

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 22px;

  background: linear-gradient(
    145deg,
    var(--primary),
    var(--primary-dark)
  );

  color: #ffffff;

  font-size: clamp(27px, 8vw, 34px);

  box-shadow:
    0 12px 35px rgba(22, 138, 69, 0.22);
}

.app-loading-title {
  margin-top: 16px;

  color: var(--primary);

  font-size: clamp(20px, 6vw, 25px);
  font-weight: 800;

  line-height: 1.2;
  letter-spacing: -0.4px;
}

.app-loading-text {
  margin-top: 8px;

  color: var(--text-secondary);

  font-size: clamp(11px, 3.2vw, 13px);
  font-weight: 500;

  line-height: 1.4;
  letter-spacing: 0.15px;
}

/* =========================================================
   COMMON PAGE
   ========================================================= */

.page {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;

  background: var(--bg);
  color: var(--text);
}

.page-container {
  width: min(100%, 760px);
  margin: 0 auto;

  padding:
    18px
    max(18px, env(safe-area-inset-right))
    18px
    max(18px, env(safe-area-inset-left));
}

/* =========================================================
   TOP HEADER
   ========================================================= */

.app-header {
  width: 100%;
  height: var(--header-height);

  display: flex;
  align-items: center;

  padding:
    0
    max(16px, env(safe-area-inset-right))
    0
    max(16px, env(safe-area-inset-left));

  background: var(--surface);
  border-bottom: 1px solid var(--border);

  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  min-width: 0;

  display: flex;
  align-items: center;
  gap: 10px;
}

.header-title {
  min-width: 0;

  font-size: clamp(17px, 4.5vw, 19px);
  font-weight: 750;

  color: var(--text);

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-subtitle {
  margin-top: 2px;

  color: var(--text-muted);
  font-size: 12px;
}

.header-actions {
  margin-left: auto;

  display: flex;
  align-items: center;
  gap: 4px;
}

/* =========================================================
   BUTTONS
   ========================================================= */

.icon-button {
  width: 42px;
  height: 42px;
  min-width: 42px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border-radius: 50%;

  background: transparent;
  color: var(--text);

  cursor: pointer;

  transition:
    background-color 0.18s ease,
    transform 0.18s ease;
}

.icon-button:hover {
  background: var(--surface-2);
}

.icon-button:active {
  transform: scale(0.92);
}

.primary-button {
  min-height: 46px;
  padding: 0 20px;

  border-radius: 14px;

  background: linear-gradient(
    135deg,
    var(--primary),
    var(--primary-dark)
  );

  color: #ffffff;

  font-weight: 700;

  cursor: pointer;

  box-shadow:
    0 6px 18px rgba(22, 138, 69, 0.18);
}

.primary-button:active {
  transform: scale(0.97);
}

.primary-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.secondary-button {
  min-height: 44px;
  padding: 0 18px;

  border: 1px solid var(--border);
  border-radius: 13px;

  background: var(--surface);
  color: var(--text);

  font-weight: 650;

  cursor: pointer;
}

/* =========================================================
   CARD
   ========================================================= */

.card {
  padding: 18px;

  border: 1px solid var(--border);
  border-radius: var(--radius-md);

  background: var(--surface);
  box-shadow: var(--shadow-small);
}

/* =========================================================
   AVATAR
   ========================================================= */

.avatar {
  width: 48px;
  height: 48px;
  flex-shrink: 0;

  border-radius: 50%;
  object-fit: cover;

  background: var(--primary-light);
  border: 2px solid var(--surface);
}

.avatar-small {
  width: 40px;
  height: 40px;
}

.avatar-large {
  width: 76px;
  height: 76px;
}

.avatar-wrapper {
  position: relative;
  display: inline-flex;
}

.online-dot {
  position: absolute;
  right: 0;
  bottom: 1px;

  width: 12px;
  height: 12px;

  border-radius: 50%;

  background: var(--online);
  border: 2px solid var(--surface);
}

/* =========================================================
   CHAT PAGE
   ========================================================= */

.chat-page {
  width: 100%;
  height: 100vh;
  height: 100dvh;

  display: flex;
  flex-direction: column;

  overflow: hidden;

  background: var(--bg);
  color: var(--text);
}

/* =========================================================
   CHAT HEADER
   ========================================================= */

.chat-header {
  flex: 0 0 var(--header-height);

  width: 100%;
  height: var(--header-height);

  display: flex;
  align-items: center;

  gap: 10px;

  padding:
    0
    max(12px, env(safe-area-inset-right))
    0
    max(12px, env(safe-area-inset-left));

  background: var(--surface);
  border-bottom: 1px solid var(--border);

  z-index: 20;
}

.chat-user-info {
  min-width: 0;

  display: flex;
  flex-direction: column;
}

.chat-user-name {
  color: var(--text);

  font-size: 16px;
  font-weight: 750;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-user-status {
  margin-top: 2px;

  color: var(--text-muted);
  font-size: 12px;
}

.chat-user-status.online {
  color: var(--online);
}

/* =========================================================
   CHAT MESSAGES
   ========================================================= */

.chat-messages {
  position: relative;
  z-index: 1;

  flex: 1 1 auto;

  min-height: 0;

  overflow-y: auto;
  overflow-x: hidden;

  padding:
    18px
    max(10px, env(safe-area-inset-right))
    16px
    max(10px, env(safe-area-inset-left));

  background:
    radial-gradient(
      circle at 20% 0%,
      rgba(66, 185, 108, 0.08),
      transparent 35%
    ),
    var(--bg);

  scroll-behavior: smooth;
  overscroll-behavior: contain;

  -webkit-overflow-scrolling: touch;
}

.chat-messages::before {
  content: "";

  position: absolute;
  inset: 0;

  pointer-events: none;

  opacity: 0.035;

  background-image:
    radial-gradient(
      ellipse at 20% 20%,
      var(--primary) 0,
      transparent 35%
    ),
    radial-gradient(
      ellipse at 80% 70%,
      var(--primary) 0,
      transparent 35%
    );
}

/* =========================================================
   MESSAGE
   ========================================================= */

.message-row {
  position: relative;
  z-index: 2;

  width: 100%;

  display: flex;

  margin-bottom: 8px;
}

.message-row.incoming {
  justify-content: flex-start;
}

.message-row.outgoing {
  justify-content: flex-end;
}

.message-bubble {
  position: relative;

  max-width: min(78%, 520px);

  padding: 9px 12px 7px;

  border-radius: 17px;

  font-size: 15px;
  line-height: 1.48;

  word-wrap: break-word;
  overflow-wrap: anywhere;

  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.045);
}

.message-row.incoming .message-bubble {
  background: var(--incoming-bubble);
  color: var(--text);
  border-bottom-left-radius: 5px;
}

.message-row.outgoing .message-bubble {
  background: var(--outgoing-bubble);
  color: var(--outgoing-text);
  border-bottom-right-radius: 5px;
}

.message-text {
  display: inline;

  font-size: 15px;
  font-weight: 450;

  letter-spacing: 0.05px;

  white-space: pre-wrap;
}

.message-meta {
  display: inline-flex;
  align-items: center;
  gap: 3px;

  margin-left: 8px;

  vertical-align: bottom;
  transform: translateY(2px);

  white-space: nowrap;
}

.message-time {
  font-size: 10px;
  opacity: 0.68;
}

.message-status {
  display: inline-flex;
  align-items: center;

  font-size: 13px;
  line-height: 1;
}

.message-status.read {
  color: var(--read-blue);
}

.message-status.delivered {
  color: currentColor;
}

.message-edited {
  margin-left: 4px;
  font-size: 9px;
  opacity: 0.65;
}

.message-bubble.editing {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

/* =========================================================
   TYPING INDICATOR
   ========================================================= */

.typing-container {
  flex: 0 0 auto;

  min-height: 30px;

  padding:
    2px
    max(15px, env(safe-area-inset-right))
    7px
    max(15px, env(safe-area-inset-left));

  background: transparent;
}

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

  padding: 7px 11px;

  border-radius: 14px;

  background: var(--incoming-bubble);
  color: var(--text-secondary);

  font-size: 12px;
}

.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.typing-dot {
  width: 5px;
  height: 5px;

  border-radius: 50%;

  background: var(--text-secondary);

  animation: typingBounce 1.2s infinite ease-in-out;
}

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

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

@keyframes typingBounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.45;
  }

  30% {
    transform: translateY(-3px);
    opacity: 1;
  }
}

/* =========================================================
   EMOJI / CARTOON BAR
   ========================================================= */

.emoji-bar {
  flex: 0 0 auto;

  width: 100%;

  display: flex;
  align-items: center;

  gap: 6px;

  padding:
    7px
    max(10px, env(safe-area-inset-right))
    7px
    max(10px, env(safe-area-inset-left));

  overflow-x: auto;

  background: var(--surface);
  border-top: 1px solid var(--border);

  scrollbar-width: none;

  -webkit-overflow-scrolling: touch;
}

.emoji-bar::-webkit-scrollbar {
  display: none;
}

.emoji-button {
  width: 38px;
  height: 38px;
  min-width: 38px;

  flex: 0 0 auto;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 12px;

  background: var(--surface-2);

  font-size: 21px;

  cursor: pointer;
}

.emoji-button:active {
  transform: scale(0.88);
}

/* =========================================================
   CHAT INPUT
   ========================================================= */

.chat-input-area {
  flex: 0 0 auto;

  width: 100%;

  display: flex;
  align-items: flex-end;

  gap: 7px;

  padding:
    8px
    max(10px, env(safe-area-inset-right))
    calc(8px + env(safe-area-inset-bottom))
    max(10px, env(safe-area-inset-left));

  background: var(--surface);
  border-top: 1px solid var(--border);
}

.chat-input-wrapper {
  flex: 1 1 auto;
  min-width: 0;

  display: flex;
  align-items: flex-end;

  min-height: 44px;

  padding: 5px 8px;

  border: 1px solid var(--border);
  border-radius: 22px;

  background: var(--surface-2);
}

.chat-input-wrapper:focus-within {
  border-color: var(--primary);
}

.chat-input {
  width: 100%;

  min-height: 32px;
  max-height: 120px;

  resize: none;

  border: 0;
  outline: 0;

  background: transparent;
  color: var(--text);

  font-size: 15px;
  line-height: 1.4;
}

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

.send-button {
  width: 44px;
  height: 44px;
  min-width: 44px;

  flex: 0 0 44px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 50%;

  background: var(--primary);
  color: #ffffff;

  cursor: pointer;

  font-size: 19px;

  box-shadow:
    0 5px 15px rgba(22, 138, 69, 0.20);
}

.send-button:active {
  transform: scale(0.90);
}

.send-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* =========================================================
   CHAT LIST
   ========================================================= */

.chat-list {
  width: 100%;

  display: flex;
  flex-direction: column;

  background: var(--surface);
}

.chat-list-item {
  width: 100%;

  display: flex;
  align-items: center;

  gap: 12px;

  padding:
    12px
    max(14px, env(safe-area-inset-right))
    12px
    max(14px, env(safe-area-inset-left));

  background: var(--surface);

  border-bottom: 1px solid var(--border);

  cursor: pointer;
}

.chat-list-item:hover {
  background: var(--surface-2);
}

.chat-list-content {
  flex: 1;
  min-width: 0;
}

.chat-list-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-list-name {
  flex: 1;
  min-width: 0;

  color: var(--text);

  font-size: 15px;
  font-weight: 700;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-list-time {
  color: var(--text-muted);
  font-size: 10px;
  white-space: nowrap;
}

.chat-list-bottom {
  display: flex;
  align-items: center;
  gap: 7px;

  margin-top: 4px;
}

.chat-list-preview {
  flex: 1;
  min-width: 0;

  color: var(--text-secondary);

  font-size: 13px;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.unread-count {
  min-width: 20px;
  height: 20px;

  padding: 0 6px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 10px;

  background: var(--primary);
  color: #ffffff;

  font-size: 10px;
  font-weight: 750;
}

/* =========================================================
   MEMBERS
   ========================================================= */

.members-list {
  display: flex;
  flex-direction: column;

  background: var(--surface);
}

.member-item {
  display: flex;
  align-items: center;

  gap: 12px;

  padding:
    13px
    max(15px, env(safe-area-inset-right))
    13px
    max(15px, env(safe-area-inset-left));

  border-bottom: 1px solid var(--border);

  cursor: pointer;
}

.member-item:hover {
  background: var(--surface-2);
}

.member-info {
  flex: 1;
  min-width: 0;
}

.member-name {
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
}

.member-status {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 12px;
}

/* =========================================================
   MENU
   ========================================================= */

.menu-container {
  position: relative;
}

.menu-dropdown {
  position: absolute;

  top: calc(100% + 8px);
  right: 8px;

  width: min(190px, calc(100vw - 24px));

  padding: 7px;

  border: 1px solid var(--border);
  border-radius: 15px;

  background: var(--surface);
  box-shadow: var(--shadow);

  z-index: 300;
}

.menu-item {
  width: 100%;
  min-height: 42px;

  display: flex;
  align-items: center;

  gap: 10px;

  padding: 0 12px;

  border-radius: 10px;

  background: transparent;
  color: var(--text);

  text-align: left;

  cursor: pointer;
}

.menu-item:hover {
  background: var(--surface-2);
}

.menu-item.danger {
  color: var(--danger);
}

/* =========================================================
   THEME TOGGLE
   ========================================================= */

.theme-toggle {
  width: 48px;
  height: 27px;

  padding: 3px;

  border-radius: 20px;

  background: var(--border);

  cursor: pointer;
}

.theme-toggle.active {
  background: var(--primary);
}

.theme-toggle-knob {
  width: 21px;
  height: 21px;

  border-radius: 50%;

  background: #ffffff;

  transform: translateX(0);

  transition: transform 0.2s ease;
}

.theme-toggle.active .theme-toggle-knob {
  transform: translateX(21px);
}

/* =========================================================
   FORMS
   ========================================================= */

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

.form-label {
  display: block;

  margin-bottom: 7px;

  color: var(--text);

  font-size: 13px;
  font-weight: 700;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;

  min-height: 46px;

  padding: 10px 13px;

  border: 1px solid var(--border);
  border-radius: 13px;

  outline: none;

  background: var(--surface);
  color: var(--text);
}

.form-textarea {
  min-height: 110px;
  resize: vertical;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--primary);
}

/* =========================================================
   SEARCH
   ========================================================= */

.search-box {
  width: 100%;

  display: flex;
  align-items: center;

  gap: 8px;

  min-height: 44px;

  padding: 0 13px;

  border: 1px solid var(--border);
  border-radius: 14px;

  background: var(--surface);
}

.search-input {
  flex: 1;
  min-width: 0;

  border: 0;
  outline: 0;

  background: transparent;
  color: var(--text);

  font-size: 14px;
}

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

/* =========================================================
   BADGES
   ========================================================= */

.badge {
  display: inline-flex;
  align-items: center;

  min-height: 22px;

  padding: 0 8px;

  border-radius: 11px;

  background: var(--primary-light);
  color: var(--primary);

  font-size: 10px;
  font-weight: 750;
}

.badge-online {
  background: rgba(37, 199, 106, 0.12);
  color: var(--online);
}

/* =========================================================
   EMPTY STATE
   ========================================================= */

.empty-state {
  min-height: 260px;

  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;

  gap: 8px;

  padding: 30px;

  text-align: center;
}

.empty-icon {
  font-size: 42px;
  opacity: 0.75;
}

.empty-title {
  color: var(--text);

  font-size: 17px;
  font-weight: 750;
}

.empty-text {
  max-width: 300px;

  color: var(--text-secondary);

  font-size: 13px;
  line-height: 1.5;
}

/* =========================================================
   TOAST
   ========================================================= */

.toast-container {
  position: fixed;

  left: 50%;
  bottom: calc(85px + env(safe-area-inset-bottom));

  transform: translateX(-50%);

  z-index: 1000;

  display: flex;
  flex-direction: column;

  gap: 8px;

  width: min(92vw, 400px);

  pointer-events: none;
}

.toast {
  padding: 12px 15px;

  border-radius: 13px;

  background: #1b241e;
  color: #ffffff;

  font-size: 13px;

  box-shadow: var(--shadow);

  animation:
    toastIn 0.22s ease,
    toastOut 0.22s ease 3.5s forwards;
}

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

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

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* =========================================================
   MODAL
   ========================================================= */

.modal-overlay {
  position: fixed;
  inset: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  padding:
    18px
    max(18px, env(safe-area-inset-right))
    18px
    max(18px, env(safe-area-inset-left));

  background: rgba(0, 0, 0, 0.48);

  z-index: 900;
}

.modal {
  width: min(100%, 430px);
  max-height: 90dvh;

  overflow-y: auto;

  padding: 20px;

  border-radius: 20px;

  background: var(--surface);
  color: var(--text);

  box-shadow: var(--shadow);
}

.modal-title {
  margin-bottom: 8px;

  font-size: 19px;
  font-weight: 800;
}

.modal-text {
  color: var(--text-secondary);

  font-size: 13px;
  line-height: 1.55;
}

/* =========================================================
   BOTTOM NAV
   ========================================================= */

.bottom-nav {
  flex: 0 0 var(--bottom-nav-height);

  width: 100%;
  height: var(--bottom-nav-height);

  display: flex;
  align-items: center;
  justify-content: space-around;

  padding:
    5px
    max(6px, env(safe-area-inset-right))
    calc(5px + env(safe-area-inset-bottom))
    max(6px, env(safe-area-inset-left));

  background: var(--surface);
  border-top: 1px solid var(--border);

  z-index: 100;
}

.bottom-nav-item {
  min-width: 62px;
  height: 56px;

  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;

  gap: 3px;

  border-radius: 13px;

  background: transparent;
  color: var(--text-muted);

  cursor: pointer;
}

.bottom-nav-item.active {
  color: var(--primary);
  background: var(--primary-light);
}

.bottom-nav-icon {
  font-size: 20px;
}

.bottom-nav-label {
  font-size: 10px;
  font-weight: 650;
}

/* =========================================================
   LEARNING TOPICS
   ========================================================= */

.topic-grid {
  display: grid;

  grid-template-columns:
    repeat(2, minmax(0, 1fr));

  gap: 12px;
}

.topic-card {
  min-height: 125px;

  padding: 15px;

  border: 1px solid var(--border);
  border-radius: 17px;

  background: var(--surface);

  cursor: pointer;

  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    background-color 0.18s ease;
}

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

.topic-icon {
  font-size: 26px;
  margin-bottom: 8px;
}

.topic-title {
  color: var(--text);
  font-size: 14px;
  font-weight: 750;
}

.topic-description {
  margin-top: 4px;

  color: var(--text-secondary);

  font-size: 11px;
  line-height: 1.4;
}

/* =========================================================
   PROGRESS
   ========================================================= */

.progress-track {
  width: 100%;
  height: 8px;

  overflow: hidden;

  border-radius: 10px;

  background: var(--surface-2);
}

.progress-bar {
  height: 100%;

  border-radius: inherit;

  background: linear-gradient(
    90deg,
    var(--primary-dark),
    var(--primary)
  );

  transition: width 0.35s ease;
}

/* =========================================================
   UTILITIES
   ========================================================= */

.hidden {
  display: none !important;
}

.invisible {
  visibility: hidden !important;
}

.no-scroll {
  overflow: hidden !important;
}

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

.text-primary {
  color: var(--primary) !important;
}

.text-muted {
  color: var(--text-muted) !important;
}

.text-danger {
  color: var(--danger) !important;
}

.fw-bold {
  font-weight: 700 !important;
}

.w-full {
  width: 100% !important;
}

/* =========================================================
   SCROLLBAR
   ========================================================= */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* =========================================================
   TABLETS / SMALL LAPTOPS
   ========================================================= */

@media (min-width: 601px) {
  .page-container {
    padding-left: 22px;
    padding-right: 22px;
  }

  .chat-messages {
    padding-left: 18px;
    padding-right: 18px;
  }
}

/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 600px) {
  :root {
    --header-height: 60px;
    --bottom-nav-height: 66px;
  }

  .page-container {
    padding:
      13px
      max(13px, env(safe-area-inset-right))
      13px
      max(13px, env(safe-area-inset-left));
  }

  .message-bubble {
    max-width: 84%;
  }

  .message-text {
    font-size: 15px;
  }

  .chat-messages {
    padding-top: 14px;
    padding-bottom: 12px;
  }

  .chat-input {
    font-size: 16px;
  }

  .topic-grid {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));

    gap: 10px;
  }

  .topic-card {
    min-height: 115px;
    padding: 13px;
  }

  .bottom-nav-item {
    min-width: 54px;
  }
}

/* =========================================================
   SMALL PHONES
   ========================================================= */

@media (max-width: 380px) {
  :root {
    --header-height: 58px;
    --bottom-nav-height: 64px;
  }

  .header-title {
    font-size: 17px;
  }

  .message-bubble {
    max-width: 88%;
    padding: 8px 10px 6px;
  }

  .message-text {
    font-size: 14px;
  }

  .emoji-button {
    width: 36px;
    height: 36px;
    min-width: 36px;
    font-size: 19px;
  }

  .send-button {
    width: 42px;
    height: 42px;
    min-width: 42px;
    flex-basis: 42px;
  }

  .bottom-nav-label {
    font-size: 9px;
  }

  .bottom-nav-icon {
    font-size: 19px;
  }
}

/* =========================================================
   VERY SMALL PHONES
   ========================================================= */

@media (max-width: 330px) {
  .page-container {
    padding-left: 10px;
    padding-right: 10px;
  }

  .chat-messages {
    padding-left: 7px;
    padding-right: 7px;
  }

  .message-bubble {
    max-width: 91%;
  }

  .emoji-bar {
    gap: 4px;
  }

  .emoji-button {
    width: 34px;
    height: 34px;
    min-width: 34px;
  }

  .bottom-nav-item {
    min-width: 48px;
  }
}

/* =========================================================
   LANDSCAPE PHONES
   ========================================================= */

@media (max-height: 500px) and (orientation: landscape) {
  .chat-header {
    --header-height: 52px;
  }

  .chat-page {
    height: 100dvh;
  }

  .emoji-button {
    width: 34px;
    height: 34px;
    min-width: 34px;
  }

  .chat-input-area {
    padding-top: 5px;
    padding-bottom: 5px;
  }
}

/* =========================================================
   REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
