/* Sotet tema (alapertelmezett - a Lukittu vizualis nyelvet koveti) */
:root, :root[data-theme="dark"] {
  --bg: #0a0a0f;
  --sidebar-bg: #0c0c12;
  --surface: #131318;
  --surface-2: #1a1a22;
  --border: #24242e;
  --text: #f2f2f5;
  --muted: #8b8b98;
  --primary: #6d6df6;
  --primary-hover: #5a5af0;
  --primary-soft: rgba(109, 109, 246, 0.14);
  --danger: #f0555a;
  --danger-bg: rgba(240, 85, 90, 0.14);
  --success: #2ecc85;
  --success-bg: rgba(46, 204, 133, 0.14);
  --radius: 8px;
  --radius-full: 999px;
}

:root[data-theme="light"] {
  --bg: #f5f6f8;
  --sidebar-bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f0f1f4;
  --border: #e2e5ea;
  --text: #1a1d23;
  --muted: #6b7280;
  --primary: #5b5bf0;
  --primary-hover: #4747d8;
  --primary-soft: rgba(91, 91, 240, 0.1);
  --danger: #d33a3a;
  --danger-bg: #fdecec;
  --success: #1b8a5a;
  --success-bg: #e8f8f0;
  --radius: 8px;
  --radius-full: 999px;
}

* { box-sizing: border-box; }

/* A [hidden] attributumnak mindig felul kell irnia barmilyen display:flex/grid
   osztalyt, kulonben a JS-es el.hidden=true nem tunteti el tenylegesen az
   elemet (pl. a .center-screen display:flex-je specificitasban egyenlo a
   bongeszo [hidden] szabalyaval, de az author stylesheet nyer). */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

h1, h2 { margin: 0; }
h1.page-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 1rem; }
h2 { font-size: 1.05rem; font-weight: 600; }

.muted { color: var(--muted); font-size: 0.9rem; }

.error-text {
  color: var(--danger);
  background: var(--danger-bg);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
}

button {
  font: inherit;
  cursor: pointer;
  border: none;
  border-radius: var(--radius);
  padding: 0.55rem 1rem;
  background: var(--primary);
  color: white;
  transition: background 0.15s;
}
button:hover { background: var(--primary-hover); }
button:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface-2); }

.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #c73f43; }

.icon-btn {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  width: 2.2rem;
  height: 2.2rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

input, select, textarea {
  font: inherit;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--primary);
  outline-offset: -1px;
}

.pill-input {
  border-radius: var(--radius-full);
  padding: 0.5rem 1rem;
  width: auto;
}

label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; color: var(--muted); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.1rem;
}
.card-header-title { display: flex; align-items: center; gap: 0.6rem; }

.quota-badge {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  color: var(--muted);
}
.quota-badge.quota-full { background: var(--danger-bg); color: var(--danger); }

.center-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.login-card {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.1rem;
  padding: 1.1rem 1.2rem;
}
.brand-center { justify-content: center; padding: 0 0 0.3rem; }

.btn-oauth {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.65rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.92rem;
}
.btn-oauth:hover { background: var(--surface-2); }
.btn-oauth-discord:hover { color: #5865f2; }
.brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius);
  background: var(--primary-soft);
  font-size: 1.1rem;
}

/* ---------- Alkalmazas layout ---------- */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 250px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: width 0.15s, margin-left 0.15s;
}

.app-shell.sidebar-collapsed .sidebar {
  width: 0;
  overflow: hidden;
  border-right: none;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.5rem;
}

.side-nav-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius);
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
}
.side-nav-item:hover { background: var(--surface-2); color: var(--text); }
.side-nav-item.active { background: var(--primary-soft); color: var(--primary); }
.side-nav-icon { display: inline-flex; align-items: center; color: var(--muted); }
.side-nav-item.active .side-nav-icon { color: var(--primary); }

.sidebar-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.9rem 1rem;
  border-top: 1px solid var(--border);
}
.user-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.user-footer-text { display: flex; flex-direction: column; min-width: 0; }
.user-footer-name {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.spacer { flex: 1; }

.content {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 1.75rem;
}

.toolbar {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1rem;
}
.toolbar .pill-input { max-width: 320px; }
.toolbar select.pill-input { max-width: 200px; }

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
}

table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { text-align: left; padding: 0.75rem 0.9rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.02em; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }

.license-key { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
}
.badge-active { background: var(--success-bg); color: var(--success); }
.badge-inactive { background: var(--danger-bg); color: var(--danger); }

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1rem;
}
.pagination { display: flex; gap: 0.4rem; }

dialog {
  border: none;
  border-radius: 12px;
  padding: 1.5rem;
  background: var(--surface);
  color: var(--text);
  width: 100%;
  max-width: 560px;
}
dialog::backdrop { background: rgba(0, 0, 0, 0.55); }

#license-form { display: flex; flex-direction: column; gap: 0.8rem; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}
.form-grid-full { grid-column: 1 / -1; }
@media (max-width: 480px) {
  .form-grid { grid-template-columns: 1fr; }
}

.field-group { display: flex; flex-direction: column; gap: 0.4rem; }
.field-label { font-size: 0.85rem; color: var(--muted); }

.input-with-action { display: flex; gap: 0.4rem; }
.input-with-action input { flex: 1; }

.toggle-group { display: flex; gap: 0.5rem; }
.toggle-option {
  flex: 1;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.55rem 0.6rem;
  font-size: 0.86rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}
.toggle-option:hover { background: var(--surface-2); }
.toggle-option.active {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

/* Kapcsolo (toggle switch) a checkbox-ok helyett, pl. "Suspended" */
.switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.switch-slider {
  position: absolute;
  inset: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.switch-slider::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  top: 2px;
  background: var(--muted);
  border-radius: 50%;
  transition: transform 0.15s, background 0.15s;
}
.switch input:checked + .switch-slider {
  background: var(--primary-soft);
  border-color: var(--primary);
}
.switch input:checked + .switch-slider::before {
  transform: translateX(18px);
  background: var(--primary);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.key-display {
  display: block;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  margin: 0.75rem 0;
  font-size: 0.95rem;
  word-break: break-all;
}

/* ---------- Soronkenti muveletmenu ---------- */

.row-menu-trigger {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  padding: 0.3rem 0.55rem;
}
.row-menu-trigger:hover { background: var(--surface-2); color: var(--text); }

.row-menu {
  position: fixed;
  z-index: 50;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  padding: 0.35rem;
  min-width: 150px;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.row-menu-item {
  background: transparent;
  color: var(--text);
  border: none;
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-radius: 6px;
  font-size: 0.88rem;
}
.row-menu-item:hover { background: var(--surface-2); }
.row-menu-danger { color: var(--danger); }
.row-menu-danger:hover { background: var(--danger-bg); }

/* ---------- Docs oldal ---------- */

.docs-card { max-width: 780px; display: flex; flex-direction: column; gap: 0.6rem; }
.docs-card h2 { margin-bottom: 0.2rem; }
.docs-card h3 { font-size: 0.95rem; margin: 1.1rem 0 0.2rem; }
.docs-card p { margin: 0; line-height: 1.55; }
.docs-card code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--surface-2);
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
  font-size: 0.85em;
}
.docs-card pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  overflow-x: auto;
  margin: 0;
}
.docs-card pre code { background: none; padding: 0; font-size: 0.85rem; line-height: 1.5; }
.docs-tab-label { font-weight: 600; margin-top: 0.6rem; }

.docs-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.docs-table th, .docs-table td {
  text-align: left;
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--border);
  white-space: normal;
}
.docs-table th { color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; }
