/* ============================================================
   Lavoqa Grandma v2 — styles.css
   Шрифты: IBM Plex Sans + IBM Plex Sans Thai
   Лицензия шрифтов: SIL Open Font License (OFL) — коммерческое
   использование разрешено.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Sans+Thai:wght@400;500;600;700&display=swap');

:root {
  --green: #4ade80;
  --green-dark: #22c55e;
  --green-soft: rgba(74, 222, 128, 0.15);
  --green-text: #166534;
  --grey: #e5e5e5;
  --grey-dark: #d4d4d4;
  --light-grey: #f5f5f5;
  --text-muted: #6b6b6b;
  --blue: #1d4ed8;
  --red: #dc2626;
  --black: #1a1a1a;
  --white: #ffffff;
  --border: rgba(0, 0, 0, 0.08);

  --radius: 12px;
  --radius-sm: 8px;

  --font: 'IBM Plex Sans', 'IBM Plex Sans Thai', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html { background: var(--white); }

body {
  margin: 0;
  background: var(--white);
  color: var(--black);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: 0;
  background: none;
  padding: 0;
}
button:disabled { cursor: not-allowed; opacity: 0.6; }

a { color: var(--blue); }

/* Disable yellow autofill background in Chrome/Safari */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--white) inset;
  -webkit-text-fill-color: var(--black);
}

/* ============================================================
   Layout
   ============================================================ */

.app {
  min-height: 100vh;
  padding: 24px 12px;
  background: var(--white);
}

.page {
  width: 100%;
  max-width: 390px;
  margin: 0 auto;
}

/* ============================================================
   Header
   ============================================================ */

.header {
  margin-bottom: 20px;
  text-align: center;
}

.logo-box {
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.brand-logo {
  display: block;
  width: 180px;
  max-width: 60%;
  height: auto;
  flex-shrink: 0;
}

.lang-link {
  display: block;
  width: 100%;
  margin: 0 0 12px;
  color: var(--blue);
  text-align: right;
  text-decoration: underline;
  font-size: 12px;
  font-weight: 500;
}

h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.service-hours {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--light-grey);
  text-align: center;
}
.service-hours__label {
  font-size: 13px;
  color: var(--text-muted);
}
.service-hours__time {
  margin-top: 4px;
  font-size: 15px;
  font-weight: 600;
}

/* ============================================================
   Cards & sections
   ============================================================ */

.card {
  margin-bottom: 12px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--light-grey);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.card h2 {
  margin: 0 0 16px;
  font-size: 17px;
  line-height: 1.25;
  font-weight: 700;
}

/* ============================================================
   Form groups
   ============================================================ */

.field-group {
  margin-bottom: 18px;
}
.field-group:last-child {
  margin-bottom: 0;
}

.label {
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
}

.help-text {
  margin: -4px 0 8px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.hint {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
}

.error {
  margin-top: 6px;
  color: var(--red);
  font-size: 12px;
  font-weight: 600;
}

/* ============================================================
   Option buttons (size, temperature, etc)
   ============================================================ */

.option-grid {
  display: grid;
  gap: 10px;
}
.option-grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.option-btn {
  min-height: 44px;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  background: var(--grey);
  color: var(--black);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  transition: background 0.15s ease, transform 0.05s ease;
}
.option-btn:active { transform: scale(0.98); }
.option-btn.is-active {
  background: var(--green);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* ============================================================
   Primary / secondary / scan / upload / link buttons
   ============================================================ */

.primary-btn {
  width: 100%;
  min-height: 56px;
  border-radius: var(--radius-sm);
  background: var(--green);
  color: var(--black);
  font-size: 17px;
  font-weight: 700;
  transition: background 0.15s ease, transform 0.05s ease;
}
.primary-btn:hover:not(:disabled) { background: var(--green-dark); }
.primary-btn:active:not(:disabled) { transform: scale(0.99); }

.secondary-btn {
  width: 100%;
  min-height: 56px;
  border-radius: var(--radius-sm);
  background: var(--grey);
  color: var(--black);
  font-size: 17px;
  font-weight: 700;
}

.scan-btn,
.upload-btn,
.link-btn {
  width: 100%;
  min-height: 44px;
  border-radius: var(--radius-sm);
  background: var(--grey);
  color: var(--black);
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}
.scan-btn { margin-top: 10px; }

.upload-btn {
  position: relative;
  overflow: hidden;
}
.upload-btn .file-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.link-btn {
  background: transparent;
  color: var(--blue);
  text-decoration: underline;
  min-height: 32px;
  margin-top: 8px;
  padding: 0;
  justify-content: flex-start;
  width: auto;
}

/* ============================================================
   Inputs
   ============================================================ */

.input,
.textarea,
.select {
  width: 100%;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--white);
  padding: 0 12px;
  color: var(--black);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}
.input:focus,
.textarea:focus,
.select:focus {
  border-color: var(--green);
}
.textarea {
  min-height: 80px;
  padding: 10px 12px;
  resize: vertical;
}
.select {
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 14px) center, calc(100% - 9px) center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 28px;
}

/* ============================================================
   Checkbox row
   ============================================================ */

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  font-size: 14px;
  cursor: pointer;
  text-align: left;
}

.checkbox-box {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: var(--grey);
  color: var(--black);
  font-size: 14px;
  font-weight: 700;
  transition: background 0.15s ease;
}
.checkbox-box.is-active {
  background: var(--green);
}

/* ============================================================
   Phone field grid
   ============================================================ */

.phone-grid {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px;
}

/* ============================================================
   Info box (pickup time hint, priority info)
   ============================================================ */

.info-box {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--white);
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.info-box strong { font-weight: 700; }
.info-box span { color: var(--text-muted); }
.info-box p { margin: 0; }

/* ============================================================
   Bag photo preview
   ============================================================ */

.preview-image {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin: 10px 0;
  background: var(--grey-dark);
}

.small-bold {
  margin: 4px 0 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

/* ============================================================
   Total line at the bottom of each section
   ============================================================ */

.total-line {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
}

/* ============================================================
   Grand total card
   ============================================================ */

.grand-total {
  text-align: center;
  padding: 20px 16px;
}
.grand-total h2 {
  margin: 0 0 8px;
}
.grand-total__amount {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 4px 0 6px;
}
.grand-total__note {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ============================================================
   Terms & footer
   ============================================================ */

.terms-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 4px 4px;
  font-size: 13px;
  cursor: pointer;
}
.terms-row a {
  font-weight: 600;
}

.footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 16px auto 0;
  padding: 12px 0 24px;
  flex-wrap: wrap;
}

.footer-link {
  color: var(--blue);
  font-size: 14px;
  text-decoration: underline;
}

.footer-link-sep {
  color: var(--text-muted);
  font-size: 13px;
}

/* Inline link button (used in copy text) */
.inline-link {
  color: var(--blue);
  text-decoration: underline;
  font: inherit;
}

/* ============================================================
   Confirmed screen
   ============================================================ */

.confirm-card {
  text-align: center;
  padding: 24px 16px;
}

.order-number-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 4px;
}

.order-number {
  font-size: 52px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  margin: 4px 0 16px;
}

.qr-box {
  width: 148px;
  height: 148px;
  margin: 8px auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  padding: 8px;
}
.qr-box canvas,
.qr-box img {
  display: block;
  max-width: 100%;
  height: auto;
}

.screenshot-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0 0 8px;
}

.instructions {
  margin-top: 12px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--white);
  text-align: left;
  font-size: 13px;
  line-height: 1.55;
}
.instructions p {
  margin: 0 0 8px;
  font-weight: 600;
}
.instructions p:last-of-type {
  margin-bottom: 12px;
}
.instructions ol {
  margin: 0;
  padding-left: 20px;
}
.instructions li {
  margin-bottom: 6px;
  font-weight: 400;
}

.summary-card {
  text-align: left;
}
.summary-card h2 {
  margin-bottom: 12px;
}
.summary-card p {
  margin: 0 0 8px;
  font-size: 13px;
  line-height: 1.5;
}
.summary-card p:last-child {
  margin-bottom: 0;
}
.summary-card b {
  font-weight: 600;
}

.whatsapp-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--blue);
  text-decoration: underline;
}

.illustration-box {
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  background: var(--grey-dark);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 13px;
}

.success-note {
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--green-soft);
  font-size: 12px;
  font-weight: 600;
  color: var(--green-text);
}

/* ============================================================
   Closed / failure screen
   ============================================================ */

.failure-card {
  text-align: center;
  padding: 24px 16px;
}

.failure-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--grey-dark);
  font-size: 32px;
  font-weight: 700;
  color: var(--black);
}

.failure-title {
  margin: 0 0 16px;
  font-size: 22px;
  line-height: 1.2;
  font-weight: 700;
}

.white-box {
  padding: 14px 16px;
  margin: 16px 0;
  border-radius: var(--radius);
  background: var(--white);
}
.white-box .small {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.white-box .large {
  font-size: 15px;
  font-weight: 600;
}

.failure-card p {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.5;
}
.failure-card p.strong {
  font-weight: 600;
}

/* ============================================================
   QR scanner modal
   ============================================================ */

.qr-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.62);
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.qr-modal__card {
  width: 100%;
  max-width: 390px;
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px;
}
.qr-modal__card h2 {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 700;
}
.qr-modal__card p {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--text-muted);
}

#qr-reader {
  width: 100%;
  min-height: 240px;
  background: #000;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
#qr-reader video {
  width: 100% !important;
  height: auto !important;
  display: block;
}

/* ============================================================
   intl-tel-input compatibility (in case it gets enabled later)
   ============================================================ */

.iti { width: 100%; }
.iti input {
  width: 100%;
  min-height: 44px;
  border-radius: var(--radius-sm);
  background: var(--white);
  padding: 0 12px 0 52px;
  color: var(--black);
  font-size: 14px;
  outline: none;
  border: 1px solid transparent;
}
.iti input:focus {
  border-color: var(--green);
}

/* ============================================================
   Staff page (table of orders) — kept from previous version
   ============================================================ */

.page-actions {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.staff-table {
  display: grid;
  gap: 12px;
}

.staff-order {
  background: var(--white);
  border-radius: var(--radius);
  padding: 12px;
  font-size: 13px;
  line-height: 1.45;
}
.staff-order__head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-weight: 700;
  margin-bottom: 8px;
}
.staff-order p {
  margin: 0 0 4px;
}

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--green);
  font-size: 11px;
  font-weight: 700;
}

.loading {
  padding: 36px 20px;
  text-align: center;
  font-weight: 600;
  color: var(--text-muted);
}

/* ============================================================
   Mobile adaptations
   ============================================================ */

@media (max-width: 360px) {
  .app { padding-left: 10px; padding-right: 10px; }
  h1 { font-size: 24px; }
  .card { padding: 14px; }
  .grand-total__amount { font-size: 30px; }
  .order-number { font-size: 44px; }
  .phone-grid { grid-template-columns: 100px 1fr; }
}

/* ============================================================
   Print styles (confirmed screen → printable receipt)
   ============================================================ */

@media print {
  body { background: var(--white); }
  .app { padding: 0; }
  .lang-link,
  .footer-link,
  .primary-btn,
  .secondary-btn { display: none; }
  .card {
    box-shadow: none;
    border: 1px solid var(--border);
    page-break-inside: avoid;
  }
}
