/* ========= БАЗА ========= */

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

:root {
  --bg-dark: #020617;
  --bg-dark-soft: #030712;
  --bg-card-dark: #020617;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.16);
  --accent-strong: #1d4ed8;
  --danger: #ef4444;

  --text-dark: #e5e7eb;
  --text-soft-dark: #9ca3af;

  --bg-light: #f3f4ff;
  --bg-card-light: #ffffff;
  --text-light: #020617;
  --text-soft-light: #4b5563;

  --border-subtle-dark: rgba(148, 163, 253, 0.5);
  --border-subtle-light: rgba(15, 23, 42, 0.12);

  --radius-lg: 20px;
  --radius-md: 14px;

  --shadow-card-dark: 0 18px 40px rgba(15, 23, 42, 0.9);
  --shadow-card-light: 0 14px 32px rgba(15, 23, 42, 0.14);
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, #020617, #000) fixed;
  color: var(--text-dark);
}

body[data-theme="light"] {
  background: radial-gradient(circle at top left, #e5e7ff, #f9fafb) fixed;
  color: var(--text-light);
}

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

/* ========= APP SHELL ========= */

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
/* ========= HEADER ========= */

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 10px 16px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  background: linear-gradient(
    to bottom,
    rgba(2, 6, 23, 0.98),
    rgba(2, 6, 23, 0.9),
    rgba(2, 6, 23, 0.75),
    transparent
  );
  backdrop-filter: blur(14px);
}

body[data-theme="light"] .app-header {
  background: linear-gradient(
    to bottom,
    rgba(243, 244, 255, 0.98),
    rgba(243, 244, 255, 0.9),
    rgba(243, 244, 255, 0.78),
    transparent
  );
}

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

.brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: radial-gradient(circle at 20% 0, #bfdbfe, #2563eb);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  color: #f9fafb;
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.75);
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-name {
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: 13px;
}

.brand-tagline {
  font-size: 11px;
  opacity: 0.8;
}

/* NAV */

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.nav-btn {
  border-radius: 999px;
  border: 1px solid var(--border-subtle-dark);
  background: rgba(15, 23, 42, 0.95);
  color: var(--text-dark);
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.nav-btn:hover {
  background: rgba(17, 24, 39, 1);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.7);
  transform: translateY(-1px);
}

.nav-btn.active {
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  border-color: transparent;
  color: #f9fafb;
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.9);
}

body[data-theme="light"] .nav-btn {
  background: #ffffff;
  border-color: var(--border-subtle-light);
  color: var(--text-light);
}

body[data-theme="light"] .nav-btn:hover {
  background: #e5ecff;
}

/* HEADER RIGHT */

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.lang-select {
  border-radius: 999px;
  border: 1px solid var(--border-subtle-dark);
  background: transparent;
  padding: 4px 10px;
  font-size: 12px;
  color: inherit;
}

body[data-theme="light"] .lang-select {
  border-color: var(--border-subtle-light);
}

.header-user {
  border-radius: 999px;
  border: 1px solid var(--border-subtle-dark);
  padding: 4px 10px;
  font-size: 12px;
}
/* ========= MAIN / CARDS ========= */

main {
  flex: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 16px;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.card {
  background: radial-gradient(circle at 0 0, rgba(37, 99, 235, 0.14), transparent 55%),
    linear-gradient(135deg, var(--bg-dark-soft), #020617);
  border-radius: var(--radius-lg);
  padding: 16px 16px 14px;
  border: 1px solid var(--border-subtle-dark);
  box-shadow: var(--shadow-card-dark);
  margin-bottom: 16px;
}

body[data-theme="light"] .card {
  background: var(--bg-card-light);
  border-color: var(--border-subtle-light);
  box-shadow: var(--shadow-card-light);
}

.card h1,
.card h2,
.card h3 {
  margin-top: 0;
  margin-bottom: 8px;
}

.muted {
  font-size: 13px;
  color: var(--text-soft-dark);
}

body[data-theme="light"] .muted {
  color: var(--text-soft-light);
}

.muted.small {
  font-size: 12px;
}

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

button {
  font-family: inherit;
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 999px;
  border: none;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: #f9fafb;
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.9);
  transition: transform 0.08s ease, box-shadow 0.12s ease, opacity 0.08s ease;
}

.primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 40px rgba(37, 99, 235, 1);
}

.primary-btn:active {
  transform: translateY(0);
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.8);
  opacity: 0.9;
}

.primary-btn.full-width {
  width: 100%;
}

.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--border-subtle-dark);
  background: transparent;
  color: inherit;
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.12s ease, box-shadow 0.12s ease, transform 0.08s ease;
}

.ghost-btn:hover {
  background: rgba(15, 23, 42, 0.85);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.9);
  transform: translateY(-1px);
}

.ghost-btn.full-width {
  width: 100%;
}

body[data-theme="light"] .ghost-btn:hover {
  background: rgba(226, 232, 255, 0.9);
}

.danger-btn {
  border-color: rgba(248, 113, 113, 0.8);
  color: #fecaca;
}

/* CHIP BUTTONS */

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 10px;
}

.chip-btn {
  border-radius: 999px;
  border: 1px solid var(--border-subtle-dark);
  background: transparent;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
}

.chip-btn.active {
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: #f9fafb;
  border-color: transparent;
}
/* ========= FORMS ========= */

.form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
}

.form label {
  font-size: 13px;
}

.form input,
.form select,
.form textarea {
  width: 100%;
  border-radius: 999px;
  border: 1px solid var(--border-subtle-dark);
  padding: 8px 12px;
  background: rgba(15, 23, 42, 0.95);
  color: var(--text-dark);
  font-size: 14px;
  outline: none;
}

.form textarea {
  border-radius: 16px;
  min-height: 70px;
  resize: vertical;
}

.form input:focus,
.form select:focus,
.form textarea:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.6);
}

body[data-theme="light"] .form input,
body[data-theme="light"] .form select,
body[data-theme="light"] .form textarea {
  background: #ffffff;
  border-color: var(--border-subtle-light);
  color: var(--text-light);
}

/* INPUT + EYE */

.input-with-eye {
  position: relative;
}

.eye-btn {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 16px;
  color: inherit;
}

/* CHECKBOX ROW */

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  margin-top: 4px;
}

.checkbox-row span {
  color: var(--text-soft-dark);
}

body[data-theme="light"] .checkbox-row span {
  color: var(--text-soft-light);
}

.bullet-list {
  padding-left: 18px;
  margin: 6px 0 0;
  font-size: 14px;
}

.bullet-list li {
  margin-bottom: 4px;
}

/* LISTS */

#activitiesList,
#homeActivitiesList,
#myActivitiesList,
#peopleList {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.list-item {
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle-dark);
  padding: 8px 10px;
  background: rgba(15, 23, 42, 0.96);
  font-size: 14px;
}

body[data-theme="light"] .list-item {
  background: #ffffff;
  border-color: var(--border-subtle-light);
}

.list-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.list-item-title {
  font-weight: 500;
}

.list-item-sub {
  font-size: 12px;
  opacity: 0.8;
}

.tag-pill {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 253, 0.6);
  padding: 2px 8px;
  font-size: 11px;
}

/* FOOTER */

.app-footer {
  text-align: center;
  padding: 8px 0 16px;
  font-size: 12px;
  color: var(--text-soft-dark);
}

body[data-theme="light"] .app-footer {
  color: var(--text-soft-light);
}
/* ========= MODALS ========= */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.88);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal-backdrop.show {
  display: flex;
}

.modal {
  max-width: 560px;
  width: calc(100% - 32px);
  background: radial-gradient(circle at 0 0, rgba(56, 189, 248, 0.12), transparent 55%),
    radial-gradient(circle at 100% 0, rgba(129, 140, 248, 0.2), transparent 60%),
    linear-gradient(135deg, #020617, #020617 60%, #000000);
  border-radius: var(--radius-lg);
  padding: 18px 18px 16px;
  border: 1px solid var(--border-subtle-dark);
  color: var(--text-dark);
  box-shadow: var(--shadow-card-dark);
}

body[data-theme="light"] .modal {
  background: #ffffff;
  border-color: var(--border-subtle-light);
  color: var(--text-light);
  box-shadow: var(--shadow-card-light);
}

.modal h2 {
  margin-top: 0;
  margin-bottom: 10px;
}

.modal-body-scroll {
  max-height: 260px;
  overflow-y: auto;
  margin-bottom: 10px;
  font-size: 14px;
}

.modal-btn-row {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.auth-modal .form {
  margin-top: 6px;
}

.auth-mode-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.small-ghost {
  padding-inline: 10px;
  font-size: 13px;
}

/* ACTIVITY MODAL + CHAT */

.activity-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.activity-modal-info {
  margin-top: 8px;
  margin-bottom: 8px;
  font-size: 14px;
}

.activity-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.card-subtitle {
  margin-top: 10px;
  margin-bottom: 6px;
}

/* Chat */

.activity-chat-block {
  margin-top: 8px;
  border-top: 1px solid rgba(148, 163, 253, 0.4);
  padding-top: 8px;
}

.activity-chat-list {
  max-height: 220px;
  overflow-y: auto;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 253, 0.4);
  padding: 8px 10px;
  margin-bottom: 8px;
  background: rgba(15, 23, 42, 0.9);
}

body[data-theme="light"] .activity-chat-list {
  background: #ffffff;
  border-color: var(--border-subtle-light);
}

.chat-message {
  font-size: 13px;
  margin-bottom: 6px;
}

.chat-message-header {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  opacity: 0.8;
  margin-bottom: 2px;
}

.chat-message-author {
  font-weight: 500;
}

.chat-message-text {
  font-size: 13px;
}

.activity-chat-input-row {
  display: flex;
  gap: 6px;
}

.activity-chat-input-row input {
  flex: 1;
}

.small-btn {
  padding-inline: 10px;
  font-size: 13px;
}

/* MAP */

#mapCanvas {
  width: 100%;
  height: 260px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(148, 163, 253, 0.45);
  overflow: hidden;
}

body[data-theme="light"] #mapCanvas {
  border-color: var(--border-subtle-light);
}

/* RESPONSIVE */

@media (max-width: 720px) {
  .app-header {
    grid-template-columns: 1fr;
    row-gap: 6px;
  }

  .nav {
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  main {
    padding: 12px;
  }

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