/* ===== CSS-переменные — подтягиваются из темы Telegram через app.js ===== */
:root {
  --bg: #f2f2f7;
  --card-bg: #ffffff;
  --text: #1c1c1e;
  --text-secondary: #6c6c70;
  --button: #2AABEE;
  --button-text: #ffffff;
  --button-secondary-bg: #e5e5ea;
  --button-secondary-text: #1c1c1e;
  --border: #e5e5ea;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

/* ===== Сброс и база ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Гарантируем что hidden всегда скрывает элемент, даже если есть display: flex */
[hidden] {
  display: none !important;
}

body {
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 32px;
}

/* ===== Шапка ===== */
header {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 480px;
  margin: 0 auto;
}

.header-logo {
  font-size: 24px;
  line-height: 1;
}

.header-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

/* ===== Экран приветствия ===== */
#phone-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 57px);
  padding: 24px 16px;
}

.welcome-card {
  background: var(--card-bg);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 32px 24px;
  max-width: 400px;
  width: 100%;
  text-align: center;
}

.welcome-card h1 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 10px;
  line-height: 1.3;
}

.welcome-card p {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 28px;
  line-height: 1.5;
}

/* ===== Кнопки ===== */
.btn-primary {
  display: block;
  width: 100%;
  padding: 14px;
  background: var(--button);
  color: var(--button-text);
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-primary:active {
  opacity: 0.8;
}

.btn-secondary {
  display: block;
  width: 100%;
  padding: 14px;
  background: var(--button-secondary-bg);
  color: var(--button-secondary-text);
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-secondary:active {
  opacity: 0.8;
}

/* ===== Fallback ввод телефона ===== */
.fallback-hint {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 20px 0 8px;
}

#phone-input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  margin-bottom: 12px;
  outline: none;
}

#phone-input:focus {
  border-color: var(--button);
}

/* ===== Экран офферов ===== */
#offers-screen {
  padding: 16px;
  max-width: 480px;
  margin: 0 auto;
}

.offers-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  padding: 0 4px;
}

/* ===== Карточка оффера ===== */
.card {
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.card-logo {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  border: 1px solid var(--border);
  object-fit: contain;
  padding: 6px;
  background: #fff;
  flex-shrink: 0;
}

.card-logo-placeholder {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.card-name {
  font-size: 17px;
  font-weight: 700;
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.card-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 14px;
}

.card-row-label {
  color: var(--text-secondary);
}

.card-row-value {
  font-weight: 500;
  text-align: right;
}

.card-license {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.card-btn {
  display: block;
  width: 100%;
  padding: 12px;
  background: var(--button);
  color: var(--button-text);
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: opacity 0.15s;
}

.card-btn:active {
  opacity: 0.8;
}

/* ===== Кнопка «Подобрать ещё» и конец списка ===== */
#more-wrap {
  margin-top: 8px;
  margin-bottom: 4px;
}

.offers-end-text {
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 16px;
}

/* ===== Спиннер загрузки ===== */
.spinner {
  text-align: center;
  padding: 24px;
  color: var(--text-secondary);
  font-size: 14px;
}
