/* Mentalportal.hu — teljes design rendszer (shared). Arculati kézikönyv tokenjei alapján. */

:root {
  --text-primary: #084B5C;
  --text-secondary: #526B78;
  --text-faint: #93A5AF;
  --brand-primary: #007F8B;
  --brand-hover: #006773;
  --brand-pressed: #00535F;
  --brand-bright: #00A5AF;
  --brand-soft: #DFF4F3;
  --pink-accent: #F77DA8;
  --pink-strong: #B82762;
  --pink-soft: #FCE8EF;
  --surface-canvas: #F5FAFB;
  --surface-card: #FFFFFF;
  --border-subtle: #D6E4E8;
  --border-control: #B3C6CE;
  --focus: #005FCC;
  --success: #23734D;
  --warning: #8A5A00;
  --danger: #B42335;
  --radius-control: 12px;
  --radius-card: 20px;
  --radius-hero: 24px;
  --radius-pill: 999px;
  --shadow-card: 0 4px 18px rgba(8, 75, 92, 0.07);
  --shadow-elevated: 0 12px 32px rgba(8, 75, 92, 0.14);
  --sidebar: 248px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { background: var(--surface-canvas); color: var(--text-primary); margin: 0; }
body {
  font-family: 'Nunito Sans', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; font-weight: 800; color: var(--text-primary); }
p { margin: 0; }
a { color: var(--brand-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; height: auto; }

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ========== APP LAYOUT (bejelentkezett) ========== */
.layout { display: flex; min-height: 100vh; align-items: stretch; }

aside.sidebar {
  flex: 0 0 var(--sidebar);
  width: var(--sidebar);
  background: var(--surface-card);
  background-image: url("/assets/dashboard/menu-hatter.webp");
  background-size: 100% auto;
  background-position: center bottom;
  background-repeat: no-repeat;
  border-right: 1px solid var(--border-subtle);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  overflow-y: auto;
}
.sidebar .logo-wrap { padding: 0 8px 20px; border-bottom: 1px solid var(--border-subtle); }
.sidebar .logo-wrap img { width: 100%; max-width: 200px; height: auto; display: block; }
.sidebar nav ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: var(--radius-control);
  color: var(--text-primary); font-size: 15px; font-weight: 600;
  transition: background 120ms ease-out; min-height: 44px; text-decoration: none;
}
.sidebar nav a:hover { background: var(--brand-soft); text-decoration: none; }
.sidebar nav a.active { background: var(--brand-soft); color: var(--brand-primary); }
.sidebar nav a svg { width: 20px; height: 20px; stroke-width: 1.75; flex-shrink: 0; }
.sidebar .caveat-foot { margin-top: auto; padding: 24px 10px 4px; text-align: left; }
.sidebar .caveat-foot .lines {
  font-family: 'Caveat', cursive; font-weight: 600; font-size: 32px;
  color: var(--text-primary); line-height: 0.98; display: block;
}
.sidebar .caveat-foot .flourish { display: block; width: 100%; max-width: 220px; height: auto; margin-top: 6px; }

main.main { flex: 1 1 auto; min-width: 0; padding: 20px 32px 48px; }

/* ========== TOP BAR ========== */
.topbar {
  display: grid; grid-template-columns: 1fr auto;
  align-items: center; gap: 24px; margin-bottom: 24px;
}
.topbar-search {
  background: var(--surface-card); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill); padding: 8px 20px;
  display: grid; grid-template-columns: 20px 1fr; gap: 12px; align-items: center;
  max-width: 560px; box-shadow: var(--shadow-card);
}
.topbar-search svg { width: 20px; height: 20px; color: var(--text-secondary); stroke-width: 2; }
.topbar-search input {
  border: 0; background: transparent; outline: none; font: inherit;
  font-size: 15px; color: var(--text-primary); padding: 6px 0; width: 100%; min-width: 0;
}
.topbar-search input::placeholder { color: var(--text-secondary); }
.user-wrap { display: flex; align-items: center; gap: 16px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: var(--radius-pill);
  background: var(--surface-card); border: 1px solid var(--border-subtle);
  display: grid; place-items: center; color: var(--text-primary);
  position: relative; transition: background 120ms ease-out;
}
.icon-btn:hover { background: var(--brand-soft); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn .dot {
  position: absolute; top: 8px; right: 8px;
  width: 8px; height: 8px; background: var(--pink-accent); border-radius: 50%;
  border: 2px solid var(--surface-card);
}
.user-pill {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 16px 4px 4px; border-radius: var(--radius-pill);
  background: var(--surface-card); border: 1px solid var(--border-subtle);
  color: var(--text-primary); text-decoration: none;
}
.user-pill:hover { background: var(--brand-soft); text-decoration: none; }
.user-pill .av {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand-primary);
  display: grid; place-items: center; font-weight: 700; font-size: 14px; overflow: hidden;
}
.user-pill .av img { display: block; width: 100%; height: 100%; object-fit: cover; }
.user-pill .nm { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; }
.user-pill .nm .n { font-weight: 700; font-size: 14px; color: var(--text-primary); }
.user-pill .nm .r { font-size: 12px; color: var(--text-secondary); }
.user-pill .chev { width: 16px; height: 16px; opacity: 0.6; margin-left: 4px; }
.hamburger {
  display: none; width: 44px; height: 44px; border-radius: var(--radius-pill);
  background: var(--surface-card); border: 1px solid var(--border-subtle);
  place-items: center; color: var(--text-primary);
}
.hamburger svg { width: 22px; height: 22px; }

/* ========== COMMON COMPONENTS ========== */
.page-head { display: grid; grid-template-columns: 1fr auto; align-items: start; gap: 24px; margin-bottom: 24px; }
.page-head h1 { font-size: 44px; font-weight: 800; line-height: 1; letter-spacing: -0.02em; }
.page-head .sub { font-size: 18px; color: var(--text-secondary); margin-top: 10px; }

.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--brand-primary); color: #fff; border: 0;
  border-radius: var(--radius-pill); padding: 12px 24px;
  font-size: 15px; font-weight: 700; font-family: inherit;
  min-height: 48px; cursor: pointer; text-decoration: none;
  transition: background 120ms ease-out;
}
.btn-primary:hover { background: var(--brand-hover); text-decoration: none; }
.btn-primary:active { background: var(--brand-pressed); }
.btn-primary:disabled { background: var(--border-control); cursor: not-allowed; }
.btn-primary svg { width: 18px; height: 18px; stroke-width: 2; }

.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--surface-card); color: var(--text-primary);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-pill);
  padding: 12px 22px; font-size: 15px; font-weight: 700; font-family: inherit;
  min-height: 44px; text-decoration: none;
}
.btn-ghost:hover { background: var(--brand-soft); text-decoration: none; }
.btn-ghost svg { width: 18px; height: 18px; stroke-width: 1.75; }

/* Form fields */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 14px; font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.field label .req { color: var(--pink-strong); margin-left: 2px; }
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 12px 16px;
  font: inherit; font-size: 15px;
  color: var(--text-primary);
  background: var(--surface-card);
  border: 1px solid var(--border-control);
  border-radius: var(--radius-control);
  min-height: 48px;
  outline: none;
  transition: border-color 120ms ease-out;
}
.field input::placeholder { color: var(--text-faint); }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(0, 127, 139, 0.12);
}
.field .error { color: var(--danger); font-size: 13px; margin-top: 4px; font-weight: 600; }

.form-card {
  background: var(--surface-card); border-radius: var(--radius-card);
  padding: 32px; box-shadow: var(--shadow-card);
}

.alert {
  padding: 14px 18px;
  border-radius: var(--radius-control);
  font-size: 14.5px;
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 10px;
}
.alert.success { background: #E3F3EC; color: var(--success); }
.alert.error { background: #FFE5EB; color: var(--danger); }
.alert.info { background: var(--brand-soft); color: var(--brand-primary); }
.alert.warning { background: #FFF3DC; color: var(--warning); }
.alert svg { width: 20px; height: 20px; stroke-width: 2; flex-shrink: 0; }

/* ========== MOBILE ========== */
.mobile-botnav { display: none; }

@media (max-width: 899px) {
  .layout { display: block; }
  aside.sidebar {
    position: fixed; left: -100%; top: 0;
    height: 100vh; width: 280px; flex: none; z-index: 200;
    transition: left 180ms ease-out;
  }
  aside.sidebar.open { left: 0; box-shadow: var(--shadow-elevated); }
  .scrim { display: none; position: fixed; inset: 0; background: rgba(8, 75, 92, 0.4); z-index: 150; }
  aside.sidebar.open ~ .scrim { display: block; }

  .hamburger { display: grid; }
  main.main { padding: 16px 16px calc(72px + env(safe-area-inset-bottom, 0px)); }

  .topbar { grid-template-columns: auto 1fr auto; gap: 10px; margin-bottom: 16px; }
  .topbar-search { padding: 6px 14px; grid-template-columns: 18px 1fr; }
  .topbar-search input { font-size: 14px; }
  .user-wrap { gap: 8px; }
  .user-pill { padding: 4px; }
  .user-pill .nm, .user-pill .chev { display: none; }

  .page-head { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 28px; }
  .page-head .sub { font-size: 15px; }

  .mobile-botnav {
    display: grid; position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--surface-card); border-top: 1px solid var(--border-subtle);
    padding: 8px env(safe-area-inset-right, 0) calc(8px + env(safe-area-inset-bottom, 0)) env(safe-area-inset-left, 0);
    grid-template-columns: repeat(4, 1fr); z-index: 100;
  }
  .mobile-botnav a {
    display: grid; place-items: center;
    padding: 8px 4px; color: var(--text-secondary);
    font-size: 11px; font-weight: 600; gap: 4px; text-decoration: none;
  }
  .mobile-botnav a.on { color: var(--brand-primary); }
  .mobile-botnav svg { width: 22px; height: 22px; stroke-width: 1.75; }
}

/* ========== PUBLIC LAYOUT (nav + hero) ========== */
.public-nav {
  background: var(--surface-card);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky; top: 0; z-index: 100;
}
.public-nav .nav-inner {
  max-width: 1280px; margin: 0 auto;
  padding: 16px 32px;
  display: grid; grid-template-columns: auto 1fr auto;
  align-items: center; gap: 32px;
}
.public-nav .logo-img { height: 44px; width: auto; display: block; }
.public-nav .nav-links {
  list-style: none; padding: 0; margin: 0;
  display: flex; gap: 28px; justify-content: center;
}
.public-nav .nav-links a {
  color: var(--text-primary); font-size: 15px; font-weight: 600;
  padding: 8px 2px;
}
.public-nav .nav-right { display: flex; gap: 12px; align-items: center; }

@media (max-width: 767px) {
  .public-nav .nav-links { display: none; }
  .public-nav .nav-inner { grid-template-columns: auto auto; padding: 12px 16px; }
  .public-nav .logo-img { height: 36px; }
}

.public-footer {
  margin-top: 64px;
  padding: 48px 32px 24px;
  background: var(--text-primary);
  color: var(--surface-canvas);
}
.public-footer .footer-wrap {
  max-width: 1280px; margin: 0 auto;
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 48px;
}
.public-footer h4 {
  font-size: 13px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: #fff; margin-bottom: 16px;
}
.public-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.public-footer ul a { color: #B8D4DA; font-size: 14px; font-weight: 400; }
.public-footer ul a:hover { color: #fff; }
.public-footer .intro { font-size: 14px; color: #B8D4DA; line-height: 1.6; margin-top: 12px; max-width: 36ch; }
.public-footer .legal {
  max-width: 1280px; margin: 32px auto 0;
  padding-top: 24px; border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 12.5px; color: #8FA7AF;
  display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap;
}
@media (max-width: 767px) {
  .public-footer { padding: 32px 16px 16px; }
  .public-footer .footer-wrap { grid-template-columns: 1fr; gap: 32px; }
  .public-footer .legal { flex-direction: column; gap: 8px; }
}
