/* ==========================================================================
   MedRapid VIR - alap stílus
   Színek: #FFFFFF, #383E43, #FE8100
   Mobil-first: alsó navigáció, nagy érintőfelületek, sticky fejléc
   ========================================================================== */

:root {
  --mr-white:  #FFFFFF;
  --mr-dark:   #383E43;
  --mr-orange: #FE8100;

  --mr-bg:       #F4F5F6;
  --mr-line:     #E3E6E8;
  --mr-muted:    #7A8288;
  --mr-dark-2:   #4B5259;
  --mr-orange-d: #E57400;
  --mr-orange-l: #FFF2E5;

  --mr-ok:    #198754;
  --mr-warn:  #F0A202;
  --mr-err:   #DC3545;
  --mr-info:  #0D6EFD;

  --mr-radius: 14px;
  --mr-shadow: 0 1px 3px rgba(56,62,67,.08), 0 6px 20px rgba(56,62,67,.06);

  --mr-topbar-h: 56px;
  --mr-bottom-h: 62px;
  --mr-sidebar-w: 248px;

  --bs-body-font-family: 'Barlow', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { -webkit-tap-highlight-color: transparent; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--bs-body-font-family);
  background: var(--mr-bg);
  color: var(--mr-dark);
  font-size: 15px;
  padding-top: var(--mr-topbar-h);
  padding-bottom: calc(var(--mr-bottom-h) + env(safe-area-inset-bottom));
  overscroll-behavior-y: none;
}

h1,h2,h3,h4,h5 { font-weight: 600; letter-spacing: -.01em; }

a { color: var(--mr-dark); }
a:hover { color: var(--mr-orange); }

/* ------------------------------------------------------------- felső sáv */
.mr-topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1030;
  background: var(--mr-dark);
  color: #fff;
  padding-top: env(safe-area-inset-top);
  box-shadow: 0 1px 0 rgba(0,0,0,.08);
}
.mr-topbar-inner {
  height: var(--mr-topbar-h);
  display: flex; align-items: center; gap: 8px;
  padding: 0 8px 0 12px;
}
.mr-brand { display: flex; align-items: center; flex: 0 0 auto; text-decoration: none; }
.mr-brand img { max-height: 30px; max-width: 130px; display: block; }
.mr-wordmark {
  font-family: 'Barlow Condensed','Barlow',sans-serif;
  font-weight: 700; font-size: 1.35rem; color: #fff; letter-spacing: .01em; line-height: 1;
}
.mr-wordmark em { color: var(--mr-orange); font-style: normal; }

.mr-title {
  flex: 1 1 auto; min-width: 0;
  font-size: 1.02rem; font-weight: 600; margin: 0; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-align: center;
}
.mr-topbar-actions { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }

.mr-icon-btn {
  width: 40px; height: 40px; border-radius: 10px; border: 0; background: transparent;
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.15rem; text-decoration: none;
}
.mr-icon-btn:hover, .mr-icon-btn:focus { background: rgba(255,255,255,.12); color: #fff; }

.mr-badge-dot {
  position: absolute; top: 4px; right: 4px;
  background: var(--mr-orange); color: #fff;
  font-size: .62rem; font-weight: 700; line-height: 1;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
}

.mr-avatar-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 2px solid rgba(255,255,255,.25);
  background: var(--mr-orange); color: #fff; padding: 0; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .78rem; font-weight: 700; margin-left: 4px;
}
.mr-avatar-btn img { width: 100%; height: 100%; object-fit: cover; }

.mr-topbar-sub {
  padding: 0 12px 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}

.mr-dropdown { border: 0; border-radius: 12px; box-shadow: var(--mr-shadow); min-width: 230px; }
.mr-dropdown .dropdown-item { padding: .6rem 1rem; border-radius: 8px; }
.mr-dropdown .dropdown-item:active { background: var(--mr-orange); }

/* ------------------------------------------------------------ tartalom */
.mr-main { min-height: calc(100vh - var(--mr-topbar-h)); }
.mr-container { max-width: 980px; margin: 0 auto; padding: 14px 12px 24px; }
.mr-flash { border: 0; border-radius: 12px; }

/* --------------------------------------------------------- alsó menüsáv */
.mr-bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 1030;
  display: flex; background: #fff; border-top: 1px solid var(--mr-line);
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -2px 12px rgba(56,62,67,.06);
}
.mr-bottomnav > a, .mr-bottomnav > button {
  flex: 1 1 0; min-width: 0; border: 0; background: none;
  height: var(--mr-bottom-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--mr-muted); text-decoration: none; font-size: .68rem; font-weight: 500;
  padding: 0 2px;
}
.mr-bottomnav i { font-size: 1.25rem; line-height: 1; }
.mr-bottomnav span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.mr-bottomnav .active { color: var(--mr-orange); }
.mr-bottomnav .active i { transform: translateY(-1px); }

.mr-offcanvas { border-radius: 18px 18px 0 0; height: auto; max-height: 82vh; }
.mr-menu-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; padding-bottom: env(safe-area-inset-bottom); }
@media (min-width: 768px) { .mr-menu-grid { grid-template-columns: repeat(4,1fr); } }
@media (min-width: 992px) { .mr-menu-grid { grid-template-columns: repeat(6,1fr); } }
.mr-menu-tile {
  background: #fff; border: 1px solid var(--mr-line); border-radius: 12px; padding: 16px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  text-decoration: none; font-size: .8rem; font-weight: 500; text-align: center;
}
.mr-menu-tile:hover { border-color: var(--mr-orange); }
.offcanvas .mr-menu-tile { background: var(--mr-bg); border-color: transparent; }
/* a lebegő gomb ne takarja az utolsó sort */
.mr-main .mr-menu-grid:last-child { margin-bottom: 72px; }
@media (min-width: 992px) { .mr-main .mr-menu-grid:last-child { margin-bottom: 24px; } }
.mr-menu-tile i { font-size: 1.4rem; color: var(--mr-orange); }
.mr-menu-tile.text-danger i { color: var(--mr-err); }

/* ------------------------------------------------------ oldalsáv desktop */
.mr-sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--mr-sidebar-w);
  background: #fff; border-right: 1px solid var(--mr-line);
  flex-direction: column; z-index: 1040; padding: 14px 12px;
}
.mr-sidebar-brand { height: 42px; display: flex; align-items: center; padding: 0 8px; margin-bottom: 18px; text-decoration: none; }
.mr-sidebar-brand img { max-height: 34px; max-width: 170px; }
.mr-sidebar-brand .mr-wordmark { color: var(--mr-dark); font-size: 1.5rem; }
.mr-sidebar-nav { flex: 1 1 auto; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.mr-sidebar-foot { border-top: 1px solid var(--mr-line); padding-top: 8px; display: flex; flex-direction: column; gap: 2px; }
.mr-side-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 10px; text-decoration: none;
  color: var(--mr-dark-2); font-weight: 500; font-size: .95rem;
}
.mr-side-link i { font-size: 1.1rem; width: 20px; text-align: center; }
.mr-side-link:hover { background: var(--mr-bg); color: var(--mr-dark); }
.mr-side-link.active { background: var(--mr-orange-l); color: var(--mr-orange-d); font-weight: 600; }

@media (min-width: 992px) {
  body { padding-bottom: 24px; padding-left: var(--mr-sidebar-w); }
  .mr-topbar { left: var(--mr-sidebar-w); }
  .mr-topbar .mr-brand { display: none; }
  .mr-title { text-align: left; padding-left: 4px; }
  .mr-container { padding: 20px 22px 32px; max-width: 1180px; }
}

/* ---------------------------------------------------------------- kártya */
.mr-card {
  background: #fff; border: 1px solid var(--mr-line); border-radius: var(--mr-radius);
  box-shadow: var(--mr-shadow); margin-bottom: 14px; overflow: hidden;
}
.mr-card-head {
  padding: 13px 16px; border-bottom: 1px solid var(--mr-line);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-weight: 600;
}
.mr-card-head h2, .mr-card-head h3 { font-size: 1rem; margin: 0; }
.mr-card-body { padding: 16px; }
.mr-card-body.tight { padding: 10px 12px; }
.mr-card-foot { padding: 12px 16px; border-top: 1px solid var(--mr-line); background: #fafbfb; }

.mr-section-title {
  font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--mr-muted); margin: 20px 2px 8px;
}

/* ----------------------------------------------------------- lista elemek */
.mr-list { display: flex; flex-direction: column; }
.mr-list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--mr-line);
  text-decoration: none; color: inherit; background: #fff;
}
.mr-list-item:last-child { border-bottom: 0; }
.mr-list-item:active { background: var(--mr-bg); }
.mr-list-item .mr-li-main { flex: 1 1 auto; min-width: 0; }
.mr-li-title { font-weight: 600; font-size: .96rem; line-height: 1.3; }
.mr-li-sub { font-size: .82rem; color: var(--mr-muted); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mr-li-end { flex: 0 0 auto; text-align: right; display: flex; align-items: center; gap: 8px; }
.mr-chevron { color: #C3C8CC; font-size: 1.1rem; }

.mr-avatar {
  width: 42px; height: 42px; border-radius: 50%; flex: 0 0 auto; overflow: hidden;
  background: var(--mr-orange-l); color: var(--mr-orange-d);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem;
}
.mr-avatar img { width: 100%; height: 100%; object-fit: cover; }
.mr-avatar.lg { width: 84px; height: 84px; font-size: 1.5rem; }
.mr-avatar.sm { width: 30px; height: 30px; font-size: .68rem; }

.mr-empty { text-align: center; padding: 42px 20px; color: var(--mr-muted); }
.mr-empty i { font-size: 2.4rem; display: block; margin-bottom: 10px; color: #C3C8CC; }

/* --------------------------------------------------------------- gombok */
.btn { border-radius: 10px; font-weight: 600; }
.btn-lg, .btn-mr-block { min-height: 48px; }
.btn-mr {
  background: var(--mr-orange); border-color: var(--mr-orange); color: #fff;
}
.btn-mr:hover, .btn-mr:focus, .btn-mr:active {
  background: var(--mr-orange-d) !important; border-color: var(--mr-orange-d) !important; color: #fff !important;
}
.btn-mr-dark { background: var(--mr-dark); border-color: var(--mr-dark); color: #fff; }
.btn-mr-dark:hover, .btn-mr-dark:focus { background: #2c3136; border-color: #2c3136; color: #fff; }
.btn-mr-outline { border: 1.5px solid var(--mr-line); background: #fff; color: var(--mr-dark); }
.btn-mr-outline:hover { border-color: var(--mr-orange); color: var(--mr-orange-d); }
.btn-soft { background: var(--mr-orange-l); color: var(--mr-orange-d); border: 0; }
.btn-soft:hover { background: #ffe6cc; color: var(--mr-orange-d); }

/* lebegő "+" gomb mobilon */
.mr-fab {
  position: fixed; right: 16px; z-index: 1029;
  bottom: calc(var(--mr-bottom-h) + 14px + env(safe-area-inset-bottom));
  width: 56px; height: 56px; border-radius: 50%; border: 0;
  background: var(--mr-orange); color: #fff; font-size: 1.6rem;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 18px rgba(254,129,0,.4); text-decoration: none;
}
.mr-fab:hover, .mr-fab:focus { background: var(--mr-orange-d); color: #fff; }
@media (min-width: 992px) { .mr-fab { bottom: 24px; right: 28px; } }

/* --------------------------------------------------------------- űrlapok */
.form-label { font-weight: 600; font-size: .86rem; margin-bottom: .3rem; color: var(--mr-dark-2); }
.form-control, .form-select {
  border-radius: 10px; border: 1.5px solid var(--mr-line);
  padding: .62rem .8rem; font-size: 16px; /* iOS zoom elkerülése */
  color: var(--mr-dark); background-color: #fff;
}
.form-control:focus, .form-select:focus {
  border-color: var(--mr-orange); box-shadow: 0 0 0 3px rgba(254,129,0,.14); color: var(--mr-dark);
}
.form-control::placeholder { color: #AFB5B9; }
textarea.form-control { min-height: 92px; }
.form-text { font-size: .8rem; color: var(--mr-muted); }
.form-check-input:checked { background-color: var(--mr-orange); border-color: var(--mr-orange); }
.form-check-input:focus { box-shadow: 0 0 0 3px rgba(254,129,0,.14); border-color: var(--mr-orange); }
.form-switch { padding-left: 3.4em; min-height: 1.6em; }
.form-switch .form-check-input { width: 2.6em; height: 1.4em; margin-left: -3.4em; }
.form-check-label { line-height: 1.45; }
.form-check-input { width: 1.15em; height: 1.15em; }
.input-group-text { background: var(--mr-bg); border: 1.5px solid var(--mr-line); border-radius: 10px; font-size: .88rem; }
.was-validated .form-control:invalid, .form-control.is-invalid { border-color: var(--mr-err); }

.mr-field { margin-bottom: 14px; }
.mr-field-row { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
@media (min-width: 576px) { .mr-field-row.cols-2 { grid-template-columns: 1fr 1fr; } }

/* ---------------------------------------------------------------- badge */
.badge { font-weight: 600; padding: .38em .6em; border-radius: 7px; font-size: .74rem; }
.bg-mr-orange { background: var(--mr-orange) !important; color: #fff; }
.bg-mr-dark   { background: var(--mr-dark) !important; color: #fff; }
.bg-mr-soft   { background: var(--mr-orange-l) !important; color: var(--mr-orange-d); }
.badge-status { display: inline-flex; align-items: center; gap: 5px; }
.badge-status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-rogzitve    { background: #EEF1F3 !important; color: #5B646B; }
.st-folyamatban { background: #FFF2E5 !important; color: #C96500; }
.st-teljesitve  { background: #E7F5EC !important; color: #157347; }
.st-lemondva    { background: #FBE9EA !important; color: #B02A37; }

/* --------------------------------------------------------------- táblák */
.mr-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { margin: 0; font-size: .9rem; }
.table > :not(caption) > * > * { padding: .68rem .75rem; }
.table thead th {
  background: #fafbfb; border-bottom: 1px solid var(--mr-line);
  font-size: .74rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--mr-muted); font-weight: 700; white-space: nowrap;
}
.table tbody tr:hover { background: #fafbfb; }

/* ------------------------------------------------------------ statisztika */
.mr-stats { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; margin-bottom: 6px; }
@media (min-width: 768px) { .mr-stats { grid-template-columns: repeat(4,1fr); } }
.mr-stat {
  background: #fff; border: 1px solid var(--mr-line); border-radius: var(--mr-radius);
  padding: 14px; box-shadow: var(--mr-shadow); text-decoration: none; color: inherit; display: block;
}
.mr-stat .lbl { font-size: .76rem; color: var(--mr-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.mr-stat .val { font-size: 1.7rem; font-weight: 700; line-height: 1.15; margin-top: 3px; }
.mr-stat .val small { font-size: .82rem; font-weight: 600; color: var(--mr-muted); }
.mr-stat.accent .val { color: var(--mr-orange); }

/* ---------------------------------------------------------------- egyéb */
.mr-chip-row { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 8px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.mr-chip-row::-webkit-scrollbar { display: none; }
.mr-chip {
  flex: 0 0 auto; padding: 7px 13px; border-radius: 20px; border: 1.5px solid var(--mr-line);
  background: #fff; font-size: .84rem; font-weight: 600; color: var(--mr-dark-2); text-decoration: none;
  white-space: nowrap;
}
.mr-chip.active { background: var(--mr-dark); border-color: var(--mr-dark); color: #fff; }
.mr-chip.active.orange { background: var(--mr-orange); border-color: var(--mr-orange); }

.mr-divider { height: 1px; background: var(--mr-line); margin: 16px 0; border: 0; }
.text-muted { color: var(--mr-muted) !important; }
.mr-mono { font-variant-numeric: tabular-nums; }
.mr-nowrap { white-space: nowrap; }

.mr-kv { display: grid; grid-template-columns: 40% 60%; gap: 0; font-size: .92rem; }
.mr-kv dt { padding: 9px 0; color: var(--mr-muted); font-weight: 500; border-bottom: 1px solid var(--mr-line); }
.mr-kv dd { padding: 9px 0; margin: 0; font-weight: 600; border-bottom: 1px solid var(--mr-line); text-align: right; }
.mr-kv dt:last-of-type, .mr-kv dd:last-of-type { border-bottom: 0; }

/* -------------------------------------------------------------- belépés */
.mr-login-wrap {
  min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  padding: 24px 16px; background: var(--mr-bg);
}
.mr-login-card { width: 100%; max-width: 400px; }
.mr-login-brand { text-align: center; margin-bottom: 22px; }
.mr-login-brand img { max-height: 62px; max-width: 220px; }
.mr-login-brand .mr-wordmark { color: var(--mr-dark); font-size: 2rem; }
.mr-login-brand p { color: var(--mr-muted); font-size: .88rem; margin: 6px 0 0; }
body.mr-login { padding: 0; }

.mr-pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: 0; background: none; color: var(--mr-muted); width: 38px; height: 38px; border-radius: 8px;
}

/* -------------------------------------------------------- fájl feltöltés */
.mr-drop {
  border: 2px dashed var(--mr-line); border-radius: 12px; padding: 20px; text-align: center;
  background: #fafbfb; cursor: pointer;
}
.mr-drop:hover { border-color: var(--mr-orange); background: var(--mr-orange-l); }
.mr-drop i { font-size: 1.8rem; color: var(--mr-orange); display: block; margin-bottom: 6px; }
.mr-drop input[type=file] { display: none; }

.mr-logo-preview {
  background: var(--mr-dark); border-radius: 12px; padding: 18px; text-align: center; margin-bottom: 12px;
}
.mr-logo-preview img { max-height: 60px; max-width: 100%; }

/* --------------------------------------------------------------- nyomtatás */
@media print {
  .mr-topbar, .mr-bottomnav, .mr-sidebar, .mr-fab, .btn, .offcanvas { display: none !important; }
  body { padding: 0; background: #fff; }
  .mr-card { box-shadow: none; border: 1px solid #ddd; }
}

/* SweetAlert2 igazítás */
.swal2-popup { border-radius: 14px !important; font-family: var(--bs-body-font-family) !important; }
.swal2-styled.swal2-confirm { background: var(--mr-orange) !important; border-radius: 10px !important; font-weight: 600; }
.swal2-styled.swal2-cancel  { background: #8a9199 !important; border-radius: 10px !important; font-weight: 600; }
.swal2-title { color: var(--mr-dark) !important; font-size: 1.15rem !important; }
