/* styles.css — Smart Audio Guide v23.0 (Полноэкранная карта + Bottom Sheet) */

:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-alt: #eef2f7;
  --text: #1e293b;
  --muted: #64748b;
  --border: #cbd5e1;
  --primary: #2563eb;
  --accent: #10b981;
  --danger: #ef4444;
  --sent-active: #fef08a;
  --shadow: 0 -4px 16px rgba(15, 23, 42, 0.14);
}

body[data-theme="dark"] {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-alt: #334155;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --border: #475569;
  --primary: #3b82f6;
  --sent-active: #854d0e;
}

body[data-theme="contrast"] {
  --bg: #000000;
  --surface: #0a0a0a;
  --surface-alt: #1a1a1a;
  --text: #ffffff;
  --muted: #e2e8f0;
  --border: #facc15;
  --primary: #facc15;
  --accent: #22c55e;
  --sent-active: #713f12;
  --shadow: none;
}

body[data-theme="contrast"] .btn-primary { color: #000; font-weight: 700; }

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

html, body {
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 0.88rem;
}

/* Компактная плавающая верхняя панель поверх карты */
.topbar {
  position: fixed;
  top: 6px;
  left: 6px;
  right: 6px;
  z-index: 950;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

body[data-theme="dark"] .topbar,
body[data-theme="contrast"] .topbar {
  background: var(--surface);
}

.topbar .controls-row {
  width: 100%;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 4px;
}

.controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

/* Кнопки и компактные иконки */
button, .btn-label {
  background: var(--surface-alt);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 5px 8px;
  font-size: 0.8rem;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.btn-icon {
  padding: 5px 7px;
  font-size: 0.95rem;
  min-width: 30px;
}

button.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
button.btn-accent { background: var(--accent); color: #fff; border-color: var(--accent); }
button.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }

input[type="text"], input[type="password"], input[type="number"], select, textarea {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 5px 8px;
  font-size: 0.84rem;
  width: 100%;
  max-width: 100%;
}

/* Карта на 100% экрана */
.main-layout {
  position: relative;
  width: 100%;
  height: 100dvh;
}

.map-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

#map {
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Тонкая строка статуса прямо под верхней панелью */
.status-bar {
  position: fixed;
  top: 44px;
  left: 6px;
  right: 6px;
  z-index: 900;
  padding: 2px 8px;
  font-size: 0.72rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

body[data-theme="dark"] .status-bar,
body[data-theme="contrast"] .status-bar {
  background: var(--surface);
}

/* Выдвижной плеер снизу (по умолчанию виден только язычок 68px) */
.guide-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-radius: 14px 14px 0 0;
  padding: 6px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 76dvh;
  transform: translateY(calc(100% - 64px));
  transition: transform 0.25s ease;
  box-shadow: var(--shadow);
  overflow-y: auto;
}

.guide-panel.open {
  transform: translateY(0);
}

.sheet-handle {
  cursor: pointer;
  padding-bottom: 2px;
}

.handle-bar {
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto 5px;
}

.spot-header h2 {
  font-size: 0.95rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spot-meta {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#spotImg {
  width: 100%;
  max-height: 120px;
  object-fit: cover;
  border-radius: 6px;
  display: none;
}

#aiStatus {
  display: none;
  background: var(--surface-alt);
  border: 1px solid var(--primary);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.78rem;
}

.ai-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

#storyBox {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  min-height: 80px;
  max-height: 180px;
  overflow-y: auto;
  font-size: 0.86rem;
  line-height: 1.38;
  overflow-wrap: anywhere;
}

.sent { cursor: pointer; border-radius: 3px; padding: 0 2px; }
.sent.active { background: var(--sent-active); font-weight: 600; }

.guide-panel .controls-row input[type="text"] {
  flex: 1;
  width: auto;
  min-width: 100px;
}

#spotsList {
  max-height: 130px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.spot-item {
  padding: 5px 8px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
}

.spot-item small { color: var(--muted); white-space: nowrap; }

/* Модальное окно настроек */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  z-index: 1200;
  align-items: center;
  justify-content: center;
  padding: 6px;
}
.modal.show { display: flex; }

.modal-card {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 100%;
  max-width: 600px;
  max-height: 94dvh;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-head {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-body {
  padding: 8px 10px;
  overflow-y: auto;
  overflow-x: hidden;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-foot {
  padding: 6px 10px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}

.field-group { display: flex; flex-direction: column; gap: 3px; min-width: 0; max-width: 100%; }
.field-group label { font-size: 0.76rem; font-weight: 600; }
.chk-row { display: flex; align-items: center; gap: 4px; font-size: 0.76rem; cursor: pointer; }

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin-bottom: 6px; }
.stat-card { background: var(--surface-alt); border: 1px solid var(--border); border-radius: 6px; padding: 6px; text-align: center; }
.stat-card b { display: block; font-size: 0.95rem; color: var(--primary); }
.stat-card span { font-size: 0.7rem; color: var(--muted); }
.stat-community { background: var(--surface-alt); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; font-size: 0.76rem; display: flex; flex-direction: column; gap: 2px; }

#logContent {
  background: #0b1120;
  color: #38bdf8;
  font-family: monospace;
  font-size: 0.72rem;
  padding: 6px;
  border-radius: 6px;
  width: 100%;
  max-width: 100%;
  min-height: 70px;
  max-height: 140px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

#toasts {
  position: fixed;
  top: 74px;
  right: 8px;
  z-index: 1500;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 260px;
}

.toast {
  background: #1e293b;
  color: #fff;
  border: 1px solid #475569;
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 0.76rem;
}
