/* ═══════════════════════════════════════════════════════
   Аквамарин QR-Роботы — общие стили
   ═══════════════════════════════════════════════════════ */

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

:root {
  --blue:      #1a73e8;
  --blue-dark: #1558b0;
  --blue-light:#e8f0fe;
  --green:     #1e8e3e;
  --green-bg:  #e6f4ea;
  --red:       #d93025;
  --red-bg:    #fce8e6;
  --yellow-bg: #fef7e0;
  --text:      #202124;
  --text-2:    #5f6368;
  --border:    #dadce0;
  --surface:   #fff;
  --surface-2: #f8f9fa;
  --radius:    12px;
  --shadow:    0 1px 6px rgba(60,64,67,.15), 0 2px 12px rgba(60,64,67,.1);
  --shadow-sm: 0 1px 3px rgba(60,64,67,.12);
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--surface-2);
  line-height: 1.5;
}

/* ─── Admin header ──────────────────────────────────────────────────────────── */
.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow-sm);
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.header-logo {
  display: flex; align-items: center; gap: 10px;
}
.logo-icon {
  font-size: 24px;
  color: var(--blue);
}
.logo-text {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.logo-sub {
  font-weight: 400;
  color: var(--text-2);
  font-size: 14px;
}
.domain-badge {
  background: var(--blue-light);
  color: var(--blue-dark);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 500;
}

/* ─── Admin main ────────────────────────────────────────────────────────────── */
.admin-page .admin-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ─── Cards ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.card h2 { font-size: 20px; margin-bottom: 12px; color: var(--text); }
.card h3 { font-size: 16px; margin-bottom: 16px; color: var(--text); font-weight: 600; }

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 700px) { .dashboard-grid { grid-template-columns: 1fr; } }

/* ─── Stats ─────────────────────────────────────────────────────────────────── */
.stats-row {
  display: flex; gap: 16px; flex-wrap: wrap;
}
.stat-item {
  flex: 1; min-width: 80px;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 16px 12px;
  text-align: center;
  border: 1px solid var(--border);
}
.stat-num {
  display: block;
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
}
.stat-num.stat-pending   { color: #f9ab00; }
.stat-num.stat-scanned   { color: var(--blue); }
.stat-num.stat-confirmed { color: var(--green); }
.stat-label {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 4px;
  display: block;
}

/* ─── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 16px; border-radius: 6px; border: none;
  font-size: 14px; font-weight: 500; cursor: pointer;
  text-decoration: none; transition: opacity .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn:hover { opacity: .85; }
.btn-primary  { background: var(--blue); color: #fff; }
.btn-danger   { background: var(--red);  color: #fff; }
.btn-outline  { background: transparent; color: var(--blue); border: 1px solid var(--blue); }
.btn-sm       { padding: 5px 12px; font-size: 13px; }
.btn-xs       { padding: 3px 8px; font-size: 12px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.btn-group    { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

/* ─── Alerts ────────────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px; border-radius: 8px; font-size: 14px;
  border-left: 4px solid;
}
.alert-error   { background: var(--red-bg);    border-color: var(--red);   color: #700; }
.alert-success { background: var(--green-bg);  border-color: var(--green); color: #1a4a2e; }

/* ─── Status badges ─────────────────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600;
}
.badge-pending   { background: var(--yellow-bg); color: #7a5700; }
.badge-scanned   { background: var(--blue-light); color: var(--blue-dark); }
.badge-confirmed { background: var(--green-bg);  color: var(--green); }

/* ─── Table ─────────────────────────────────────────────────────────────────── */
.table-card .table-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px;
}
.qr-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.qr-table th {
  background: var(--surface-2);
  text-align: left; padding: 8px 12px;
  border-bottom: 2px solid var(--border);
  color: var(--text-2); font-weight: 600; font-size: 12px;
  white-space: nowrap;
}
.qr-table td {
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.qr-table tr:hover td { background: var(--surface-2); }

/* ─── Setup form ────────────────────────────────────────────────────────────── */
.setup-card { max-width: 480px; }
.setup-form { display: flex; gap: 10px; margin: 16px 0; }
.input-field {
  flex: 1; padding: 8px 12px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 14px;
}
.input-field:focus { outline: none; border-color: var(--blue); }
.hint { color: var(--text-2); font-size: 12px; margin-top: 8px; }

.empty-hint { color: var(--text-2); text-align: center; padding: 24px; }

code {
  background: var(--surface-2); padding: 2px 6px; border-radius: 4px;
  font-size: 12px; border: 1px solid var(--border);
}


/* ═══════════════════════════════════════════════════════
   QR-Страница (landing page)
   ═══════════════════════════════════════════════════════ */

.qr-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #1a73e8 0%, #0d47a1 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}

.qr-container {
  width: 100%; max-width: 420px;
}

.qr-card {
  background: #fff;
  border-radius: 24px;
  padding: 40px 32px;
  box-shadow: 0 8px 40px rgba(0,0,0,.25);
  text-align: center;
  animation: slideUp .4s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

.qr-logo {
  margin-bottom: 24px;
}
.qr-logo-icon {
  font-size: 36px;
  color: var(--blue);
}

/* Приветственный текст */
.qr-welcome-text {
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 24px;
}

/* Данные сущности */
.qr-entity-info {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 24px;
  text-align: left;
}
.entity-row {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 4px 0; border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.entity-row:last-child { border-bottom: none; }
.entity-key { color: var(--text-2); flex-shrink: 0; }
.entity-val { font-weight: 500; text-align: right; }

/* Кнопка подтверждения */
.btn-confirm {
  display: block; width: 100%;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 16px 24px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  box-shadow: 0 4px 16px rgba(26,115,232,.4);
}
.btn-confirm:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(26,115,232,.5);
}
.btn-confirm:active {
  transform: translateY(0);
}

/* Уже подтверждён */
.qr-card--confirmed {
  border-top: 6px solid var(--green);
}
.confirmed-icon {
  width: 72px; height: 72px;
  background: var(--green-bg);
  color: var(--green);
  border-radius: 50%;
  font-size: 36px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  border: 3px solid var(--green);
}
.qr-confirmed h2 {
  font-size: 22px; color: var(--green); margin-bottom: 8px;
}
.confirmed-time {
  color: var(--text-2); font-size: 13px;
}
.confirmed-text {
  color: var(--text); font-size: 15px; line-height: 1.5;
  margin: 12px 0; text-align: center;
}
.qr-close-hint {
  margin-top: 16px; font-size: 13px; color: var(--text-2);
  background: #f0fdf4; border: 1px solid #86efac;
  border-radius: 8px; padding: 8px 16px;
}

.qr-meta {
  margin-top: 20px;
}
.qr-campaign {
  background: var(--blue-light);
  color: var(--blue-dark);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
}

/* ─── Fields reference ──────────────────────────────────────────────────────── */
.fields-card .table-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.copy-code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
  transition: background .15s;
  white-space: nowrap;
}
.copy-code:hover { background: var(--blue-light); color: var(--blue-dark); border-color: var(--blue); }
.option-chip {
  display: inline-block;
  background: #f0f4ff;
  border: 1px solid #c5d0f5;
  color: #3355bb;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  margin: 2px 2px 2px 0;
  cursor: pointer;
  user-select: none;
  transition: background .15s;
}
.option-chip:hover { background: var(--blue-light); border-color: var(--blue); }
.options-cell { max-width: 320px; line-height: 1.8; }
