/* ═══════════════════════════════════════════════════════════
   Reformház portál — "Organic" mobil design
   Krémszínű, meleg alap · Caprasimo (+Baloo 2 ő/ű fallback) + Figtree
   Akcentus: reformhaz.hu zöld (#54a84f) tónusskálája;
   a meleg terrakotta skála csak hibára / dekorációra.
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Caprasimo:wght@400&family=Baloo+2:wght@800&family=Fraunces:opsz,wght@9..144,600;9..144,700&family=Figtree:wght@400;500;600;700&display=swap');

:root {
  --color-bg: #f6f5ec;
  --color-surface: #fdfcf6;
  --color-text: #201e1d;
  --color-divider: color-mix(in srgb, #201e1d 16%, transparent);
  --color-input: #fffaf2;
  --color-neutral-300: #dcd3c4;

  /* Céges zöld – a 500-as lépcső a reformhaz.hu márkaszín.
     Szöveg alá (gomb, avatar) a 700-as kell a kontraszt miatt. */
  --color-brand-100: #eef7ec;
  --color-brand-200: #d8eed4;
  --color-brand-300: #b5dcae;
  --color-brand-400: #86c47f;
  --color-brand: #54a84f;
  --color-brand-600: #44913f;
  --color-brand-700: #35753a;
  --color-brand-800: #2a5c30;
  --color-brand-900: #1c3220;

  /* Meleg terrakotta – hiba, "nem elérhető", dekor-foltok */
  --color-warm-100: #fff2eb;
  --color-warm-200: #ffe1d0;
  --color-warm-400: #f6a06b;
  --color-warm-800: #643312;

  /* Caprasimo az elsődleges (nincs benne ő/ű) — ezek a betűk karakter-szintű
     fallback-ként a stílusban közeli Baloo 2-ből jönnek, nem a rendszer-fontból. */
  --font-heading: "Caprasimo", "Baloo 2", system-ui, sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Figtree", system-ui, sans-serif;

  --radius-md: 16px;
  --radius-lg: 28px;
  --radius-sheet: 32px;

  --shadow-md: 0 3px 10px color-mix(in srgb, #2e2b25 16%, transparent);
  --shadow-lg: 0 12px 32px color-mix(in srgb, #2e2b25 22%, transparent);

  --text-72: color-mix(in srgb, var(--color-text) 72%, transparent);
  --text-60: color-mix(in srgb, var(--color-text) 60%, transparent);
}

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

body {
  margin: 0;
  min-height: 100vh;
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  overflow-x: hidden;
  /* KÉT színű lineáris gradiens: zsályazöld fent -> meleg krém lent. */
  background: linear-gradient(180deg, #d7e4c9 0%, #e6ecd9 38%, #f7f3e6 100%);
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
}

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--color-brand); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--color-brand) 30%, transparent); }

.icon {
  display: block;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Oldalkeret ── */

.page {
  position: relative;
  width: 100%;
  max-width: 440px;
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* a dekor-foltok ne okozzanak vízszintes görgetést */
}

.page > * { position: relative; }
.page > * { z-index: 1; }



/* ── Gombok, mezők ── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 8px 16px;
  transition: background-color 0.15s ease;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--color-brand-700); color: var(--color-bg); }
.btn-primary:hover:not(:disabled) { background: var(--color-brand-800); }
.btn-primary:active:not(:disabled) { background: var(--color-brand-900); }
.btn-secondary { border-color: var(--color-divider); }
.btn-secondary:hover { background: color-mix(in srgb, var(--color-text) 7%, transparent); }
.btn-secondary:active { background: color-mix(in srgb, var(--color-text) 14%, transparent); }

.field > label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  padding-left: 4px;
  margin-bottom: 6px;
  color: #35503a;
}
.input-wrap { position: relative; }
.input-icon {
  position: absolute;
  left: 17px; top: 50%;
  transform: translateY(-50%);
  color: #8a967f;
  pointer-events: none;
}
.input.has-icon { padding-left: 46px; }

.input {
  width: 100%;
  min-height: 54px;
  padding: 0 18px;
  font: inherit;
  font-size: 16px; /* iOS ne zoomoljon */
  color: var(--color-text);
  caret-color: var(--color-brand-700);
  background: #fffdf7;
  border: 1px solid #dde6d2;
  border-radius: 16px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 1px 2px color-mix(in srgb, #2e2b25 5%, transparent);
}
.input::placeholder { color: color-mix(in srgb, var(--color-text) 38%, transparent); }
.input:hover { border-color: color-mix(in srgb, var(--color-text) 45%, transparent); }
.input:focus {
  border-color: var(--color-brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-brand) 22%, transparent);
  outline: none;
}

/* ═════════════ LOGIN ═════════════ */

.login {
  padding: max(30px, env(safe-area-inset-top)) 26px 28px;
}

.login-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 18px;
  padding: 34px 0 24px;
}
.login-head-text { display: flex; flex-direction: column; gap: 8px; }

.logo {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--color-brand);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 10px 24px color-mix(in srgb, var(--color-brand-800) 30%, transparent);
}

.login-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(30px, 8.6vw, 38px);
  line-height: 1.06;
  letter-spacing: -0.012em;
  color: #1e3d24;
}

.login-sub {
  margin: 0;
  font-size: 14.5px;
  color: #6a7a62;
}

/* Kitűző-kártya (csak információs elem, nem gomb) */

.badge-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 18px;
  border-radius: 22px;
  background: #eef4e6;
  border: 1px solid color-mix(in srgb, var(--color-brand) 20%, transparent);
  color: #23422a;
}
.badge-icon {
  flex: none;
  width: 42px; height: 42px;
  border-radius: 13px;
  background: #ffffff;
  color: var(--color-brand-700);
  display: grid;
  place-items: center;
  box-shadow: 0 3px 10px color-mix(in srgb, #2e2b25 10%, transparent);
}

.badge-icon {
  flex: none;
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--color-bg);
  color: var(--color-brand-700);
  display: grid;
  place-items: center;
}

.badge-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.badge-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
}

.badge-hint {
  font-size: 13px;
  line-height: 1.35;
  color: var(--color-brand-800);
}

.pulse-dot {
  flex: none;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--color-brand);
  animation: rh-pulse 2.2s ease-in-out infinite;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 16px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #86917c;
}
.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--color-divider);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pass-wrap { position: relative; }
.pass-wrap .input { padding-right: 54px; }

.pass-toggle {
  position: absolute;
  right: 6px; top: 4px;
  width: 44px; height: 44px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-60);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.pass-toggle:hover { background: color-mix(in srgb, var(--color-text) 7%, transparent); }
.pass-toggle[aria-pressed="true"] { color: var(--color-brand-700); }

.btn-login {
  width: 100%;
  min-height: 56px;
  margin-top: 10px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
  border-radius: 16px;
  background: #2f6b33;
  color: #fff;
  box-shadow: 0 10px 22px color-mix(in srgb, #2f6b33 26%, transparent);
}
.btn-login:hover:not(:disabled) { background: #275a2b; }
.btn-login:active:not(:disabled) { background: #1f4a23; }

/* Állapotsáv */

.status {
  display: none;
  margin-top: 16px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  animation: rh-rise 0.25s ease-out both;
}

.status.error {
  display: block;
  background: var(--color-warm-100);
  color: var(--color-warm-800);
}

.status.ok {
  display: block;
  background: var(--color-brand-100);
  color: var(--color-brand-800);
}

.status.busy {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--color-surface);
  color: var(--color-text);
}

.status.busy::before {
  content: "";
  flex: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2.5px solid var(--color-divider);
  border-top-color: var(--color-brand);
  animation: rh-spin 0.8s linear infinite;
}

/* ═════════════ DASHBOARD ═════════════ */

.dash {
  padding: max(12px, env(safe-area-inset-top)) 20px 28px;
}

.dash-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 6px;
}

.dash-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
}

.logo-sm {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--color-brand);
  color: var(--color-bg);
  display: grid;
  place-items: center;
}

.avatar-btn {
  width: 46px; height: 46px;
  border: none;
  border-radius: 50%;
  background: var(--color-brand-700);
  color: var(--color-bg);
  font: inherit;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: background-color 0.15s ease;
}
.avatar-btn:hover { background: var(--color-brand-800); }

.greeting {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 28px 0 22px;
}

.greeting-hello {
  font-size: 14px;
  color: color-mix(in srgb, var(--color-text) 65%, transparent);
}

.greeting-name {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 400;
  font-size: clamp(24px, 6vw, 32px);
  line-height: 1.05;
  letter-spacing: -0.015em;
  overflow-wrap: anywhere; /* hosszú teljes nevek is elférnek */
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-60);
}

.refresh-btn {
  flex: none;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 12.5px;
  color: var(--color-brand-700);
  padding: 8px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.refresh-btn:hover { background: var(--color-brand-100); }
.refresh-btn.spinning .icon { animation: rh-spin 0.8s linear infinite; }

/* App lista */

.app-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.app-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  animation: rh-rise 0.4s ease-out both;
  transition: background-color 0.15s ease, transform 0.1s ease;
}
.app-row:hover { background: var(--color-neutral-300); }
.app-row:active { transform: scale(0.985); }
.app-row:focus-visible { outline: 2px solid var(--color-brand); outline-offset: 2px; }

.app-icon {
  flex: none;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--color-bg);
  display: grid;
  place-items: center;
  font-size: 26px;
  line-height: 1;
}

/* ShippingApp logó-csempe: a CÉG zöld arculatában (a ShippingApp ikonja is a
   Reformház-zöld logó), lekerekített négyzet, halvány zöld izzással. */
.app-icon.brand-green {
  border-radius: 16px;
  background: linear-gradient(180deg, var(--color-brand-400) 0%, var(--color-brand-700) 100%);
  border: 1px solid var(--color-brand-700);
  color: var(--color-brand-100);
  box-shadow: 0 0 18px color-mix(in srgb, var(--color-brand) 35%, transparent);
}

/* Vonalkód-szkenner (rxtx) – hűvös kék tint */
.app-icon.brand-blue {
  color: #2f6fb2;
  background: color-mix(in srgb, #2f6fb2 12%, var(--color-bg));
  border: 1px solid color-mix(in srgb, #2f6fb2 25%, transparent);
}

/* Elektromos állomás (kutatkutat) – borostyán tint */
.app-icon.brand-amber {
  color: #b45309;
  background: color-mix(in srgb, #f59e0b 14%, var(--color-bg));
  border: 1px solid color-mix(in srgb, #f59e0b 30%, transparent);
}

/* GPS – korall-vörös tint */
.app-icon.brand-red {
  color: #c0392b;
  background: color-mix(in srgb, #c0392b 10%, var(--color-bg));
  border: 1px solid color-mix(in srgb, #c0392b 25%, transparent);
}

/* Erdőtérkép – sötét erdei zöld tint */
.app-icon.brand-forest {
  color: #2f7d4f;
  background: color-mix(in srgb, #2f7d4f 12%, var(--color-bg));
  border: 1px solid color-mix(in srgb, #2f7d4f 25%, transparent);
}

/* Garázs – palaszürke tint */
.app-icon.brand-slate {
  color: #546a7b;
  background: color-mix(in srgb, #546a7b 12%, var(--color-bg));
  border: 1px solid color-mix(in srgb, #546a7b 25%, transparent);
}

.app-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.app-name {
  font-family: var(--font-heading);
  font-size: 18px;
  line-height: 1.15;
}

.app-desc {
  font-size: 13px;
  line-height: 1.35;
  color: var(--text-72);
}

.app-state {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-brand-800);
}

.app-state .led {
  flex: none;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--color-brand);
  animation: rh-pulse 2.6s ease-in-out infinite;
}

.app-go {
  flex: none;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--color-brand-700);
  color: var(--color-bg);
  display: grid;
  place-items: center;
}

/* Nem elérhető app */

.app-row.unavailable {
  background: transparent;
  border: 1.5px dashed var(--color-divider);
  cursor: not-allowed;
}
.app-row.unavailable:active { transform: none; }
.app-row.unavailable .app-icon {
  background: var(--color-surface);
  filter: grayscale(0.8);
  opacity: 0.6;
}
.app-row.unavailable .app-name,
.app-row.unavailable .app-desc { color: var(--text-60); }
.app-row.unavailable .app-state { color: var(--color-warm-800); }
.app-row.unavailable .app-state .led {
  background: var(--color-warm-400);
  animation: none;
}

.empty-note {
  margin: 0;
  padding: 40px 24px;
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  text-align: center;
  font-size: 14.5px;
  color: color-mix(in srgb, var(--color-text) 70%, transparent);
}

/* Profil-lap (bottom sheet) */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--color-text) 35%, transparent);
  animation: rh-fade 0.2s ease-out both;
}

.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 31;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 18px;
  padding: 12px 24px calc(40px + env(safe-area-inset-bottom));
  background: var(--color-bg);
  border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
  box-shadow: var(--shadow-lg);
  animation: rh-sheet 0.28s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.sheet[hidden],
.sheet-backdrop[hidden] { display: none; }

.sheet-handle {
  align-self: center;
  width: 40px; height: 5px;
  border-radius: 999px;
  background: var(--color-divider);
}

.sheet-user {
  display: flex;
  align-items: center;
  gap: 14px;
}

.sheet-avatar {
  flex: none;
  width: 60px; height: 60px;
  border-radius: 50%;
  background: var(--color-brand-700);
  color: var(--color-bg);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 20px;
}

.sheet-names {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sheet-name {
  font-family: var(--font-heading);
  font-size: 22px;
  line-height: 1.15;
}

.sheet-method {
  font-size: 13px;
  color: color-mix(in srgb, var(--color-text) 65%, transparent);
}

.btn-logout {
  width: 100%;
  min-height: 52px;
  font-size: 15.5px;
  color: var(--color-warm-800);
}

/* ═════════════ Animációk ═════════════ */

@keyframes rh-pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, #54a84f 55%, transparent); }
  70%  { box-shadow: 0 0 0 12px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@keyframes rh-rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
@keyframes rh-spin { to { transform: rotate(360deg); } }
@keyframes rh-sheet {
  from { transform: translateY(100%); }
  to   { transform: none; }
}
@keyframes rh-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
