/* ============================================================
   NDIT22 Kft. Raktárnyilvántartó - stíluslap
   ============================================================ */

:root {
  --bg:           #f4f6f9;
  --bg-elev:      #ffffff;
  --bg-hover:     #f1f5f9;
  --text:         #1f2937;
  --text-muted:   #64748b;
  --border:       #e2e8f0;
  --primary:      #2563eb;
  --primary-h:    #1d4ed8;
  --primary-bg:   #eff6ff;
  --success:      #16a34a;
  --success-bg:   #dcfce7;
  --danger:       #dc2626;
  --danger-bg:    #fee2e2;
  --warning:      #ea580c;
  --warning-bg:   #fff7ed;
  --shadow-sm:    0 1px 2px rgba(0,0,0,.05);
  --shadow:       0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-lg:    0 10px 25px rgba(0,0,0,.08), 0 4px 10px rgba(0,0,0,.04);
  --radius:       8px;
  --radius-sm:    6px;
}

[data-theme="dark"] {
  --bg:         #0f172a;
  --bg-elev:    #1e293b;
  --bg-hover:   #334155;
  --text:       #f1f5f9;
  --text-muted: #94a3b8;
  --border:     #334155;
  --primary:    #3b82f6;
  --primary-h:  #60a5fa;
  --primary-bg: #1e3a8a;
  --success:    #22c55e;
  --success-bg: #14532d;
  --danger:     #ef4444;
  --danger-bg:  #7f1d1d;
  --warning:    #f97316;
  --warning-bg: #7c2d12;
  --shadow-sm:  0 1px 2px rgba(0,0,0,.3);
  --shadow:     0 1px 3px rgba(0,0,0,.4);
  --shadow-lg:  0 10px 25px rgba(0,0,0,.5);
}

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

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  transition: background .25s, color .25s;
  -webkit-font-smoothing: antialiased;
}

/* ===== LOGIN ===== */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
}
[data-theme="dark"] .login-screen {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}
.login-box {
  background: var(--bg-elev);
  padding: 36px 32px;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 400px;
}
.login-logo {
  width: 64px; height: 64px;
  margin: 0 auto 18px;
  background: var(--primary);
  color: #fff;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -1px;
}
.login-box h1 { font-size: 22px; text-align: center; margin-bottom: 4px; }
.login-box .subtitle {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 24px;
  font-size: 13px;
}

/* ===== APP LAYOUT ===== */
.app { display: none; min-height: 100vh; }
.app.active { display: block; }

.header {
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
  gap: 12px;
}
.header-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.header-logo {
  width: 36px; height: 36px;
  background: var(--primary);
  color: white;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.header-title {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-right { display: flex; align-items: center; gap: 8px; }
.user-info { font-size: 13px; color: var(--text-muted); }
.user-info strong { color: var(--text); }

/* ===== TABS ===== */
.tabs {
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  display: flex;
  overflow-x: auto;
  scrollbar-width: thin;
  position: sticky;
  top: 57px;
  z-index: 40;
}
.tabs::-webkit-scrollbar { height: 3px; }
.tabs::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.tab {
  padding: 12px 18px;
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 13px;
  transition: all .15s;
  font-family: inherit;
}
.tab:hover { color: var(--text); background: var(--bg-hover); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab.admin-only { display: none; }
body[data-role="admin"] .tab.admin-only { display: inline-block; }

/* ===== CONTENT ===== */
.content {
  padding: 20px;
  max-width: 1400px;
  margin: 0 auto;
}
.tab-pane { display: none; }
.tab-pane.active { display: block; animation: fadeIn .2s; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 12px;
}
.section-title {
  font-size: 18px;
  font-weight: 600;
}

/* ===== BUTTONS ===== */
.btn {
  padding: 8px 14px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  transition: all .15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  line-height: 1.2;
}
.btn:hover { background: var(--bg-hover); border-color: var(--primary); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary  { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover  { background: var(--primary-h); border-color: var(--primary-h); }
.btn-success  { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover  { opacity: .92; }
.btn-danger   { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover   { opacity: .92; }
.btn-ghost { border-color: transparent; }
.btn-ghost:hover { background: var(--bg-hover); border-color: transparent; }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 6px 8px; }

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.theme-toggle:hover { background: var(--bg-hover); }

/* ===== FORM ELEMENTS ===== */
.form-row {
  margin-bottom: 14px;
}
.form-row label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.form-row label .req { color: var(--danger); }

input[type=text], input[type=password], input[type=email],
input[type=number], input[type=date], select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
input[readonly] {
  background: var(--bg);
  color: var(--text-muted);
  cursor: not-allowed;
}
textarea { resize: vertical; min-height: 70px; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}
.form-row.full { grid-column: 1 / -1; }

@media (max-width: 640px) {
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
}

/* ===== AUTOCOMPLETE (típus mező) ===== */
.autocomplete {
  position: relative;
}
.autocomplete-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 20;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  max-height: 200px;
  overflow-y: auto;
  box-shadow: var(--shadow);
  display: none;
}
.autocomplete-list.open { display: block; }
.autocomplete-item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover,
.autocomplete-item.highlighted { background: var(--primary-bg); color: var(--primary); }

/* ===== SEARCH BAR ===== */
.search-box {
  position: relative;
  margin-bottom: 14px;
  max-width: 500px;
}
.search-box input {
  padding-left: 38px;
}
.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 16px;
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  align-items: center;
}
.toolbar .search-box { margin-bottom: 0; flex: 1 1 240px; }
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 6px 12px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  border-radius: 16px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-muted);
  font-weight: 500;
}
.chip.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ===== TABLE ===== */
.table-wrap {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.table-scroll { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead th {
  background: var(--bg);
  text-align: left;
  padding: 10px 12px;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .3px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }
tbody tr.clickable-row { cursor: pointer; }
tbody tr.clickable-row:active { background: var(--primary-bg); }
.row-actions-cell { cursor: default; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.nowrap { white-space: nowrap; }
.text-muted { color: var(--text-muted); }
.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 32px; margin-bottom: 8px; opacity: .5; }

/* ===== STATUS BADGE ===== */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warn    { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg); color: var(--danger); }
.badge-info    { background: var(--primary-bg); color: var(--primary); }

/* ===== ROW ACTIONS ===== */
.row-actions {
  display: flex;
  gap: 4px;
  flex-wrap: nowrap;
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  display: none;
  align-items: flex-start;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  overflow-y: auto;
  backdrop-filter: blur(2px);
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg-elev);
  border-radius: 12px;
  width: 100%;
  max-width: 640px;
  margin: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn .2s ease-out;
}
.modal.modal-sm { max-width: 460px; }
.modal.modal-lg { max-width: 820px; }

@keyframes modalIn {
  from { opacity: 0; transform: scale(.96); }
  to   { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

/* ===== ALERT / TOAST ===== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: 400px;
}
.toast {
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--bg-elev);
  border-left: 4px solid var(--primary);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  pointer-events: auto;
  animation: toastIn .25s;
}
.toast-success { border-left-color: var(--success); }
.toast-error   { border-left-color: var(--danger); }
.toast-info    { border-left-color: var(--primary); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ===== ALERT ===== */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 14px;
  border-left: 3px solid;
}
.alert-error { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }
.alert-info  { background: var(--primary-bg); color: var(--primary); border-color: var(--primary); }

/* ===== LOADER ===== */
.loader {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

.page-loader {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.page-loader .loader { width: 36px; height: 36px; border-width: 3px; }

/* ===== MOBILBARÁT táblázat (kártyás megjelenítés mobilon) ===== */
@media (max-width: 768px) {
  .header { padding: 10px 12px; }
  .header-title { font-size: 14px; }
  .user-info { display: none; }
  .content { padding: 14px; }
  .section-title { font-size: 16px; }
  .tab { padding: 11px 14px; font-size: 12px; }

  /* A felelős táblázat - csak a fontos oszlopok mobilon */
  .table-mobile-hide { display: none; }

  thead th, tbody td { padding: 8px 10px; font-size: 12px; }
  .row-actions .btn { padding: 4px 6px; font-size: 11px; }
  .modal { border-radius: 12px 12px 0 0; max-height: 95vh; overflow-y: auto; }
}

/* Számformátum a táblázatban */
.num { font-variant-numeric: tabular-nums; }
