:root {
  --bg-main: #1e1e1e;
  --bg-panel: #2b2b2b;
  --bg-hover: #3c3c3c;
  --btn-default: #3a3a3a;
  --btn-active: #149d8b;
  --text-main: #ddd;
  --text-muted: #999;
  --border: #444;
  --accent: #34bdab;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Test */
body {
  font-family: Verdana, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  margin: 0;
  padding: 0;
  height: 100vh;
  overflow: hidden;
  scrollbar-gutter: stable;
}

/* Menüsáv */
.topmenu-flex-container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 100px;
  background-color: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  padding: 10px;
  overflow-x: auto;
  white-space: nowrap;
}

#image-options {
  position: sticky;
  top: 0;
  z-index: 50;
}

.topmenu-flex-form {
  display: flex;
  flex-wrap: wrap; /* vagy nowrap, ha inkább scrollt engedünk */
  justify-content: space-between;
  width: 100%;
  gap: 0px;
}

.topbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  white-space: nowrap;
}

.topbar-group label {
  font-weight: bold;
  font-size: 90%;
  color: var(--text-muted);
}

/* Gombok */
button {
  background-color: var(--btn-default);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 4px 10px;
  cursor: pointer;
  border-radius: 3px;
  transition: background-color 0.2s ease;
}

button:hover {
  background-color: var(--bg-hover);
}

button.active {
  background-color: var(--btn-active);
  color: #fff;
  border-color: var(--btn-active);
}

/* Input / Select */
input, select {
  background-color: #222;
  color: var(--text-main);
  border: 1px solid var(--border);
  padding: 4px 6px;
  border-radius: 3px;
}

/* Fő konténer */
#main-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 70px);
  overflow: hidden;
}

#text-list {
  height: 33%;
  overflow-y: scroll;
  border-bottom: 2px solid var(--border);
  background-color: var(--bg-panel);
  scrollbar-gutter: stable;
}

#divider {
  height: 5px;
  background-color: var(--btn-active);
  cursor: row-resize;
  user-select: none;
}

#image-list {
  flex: 1;
  overflow-y: scroll;
  background-color: var(--bg-main);
  scrollbar-gutter: stable;
}

/* Táblázat */
.fixed-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 90%;
  background-color: var(--bg-panel);
}

.fixed-table th {
  background-color: #333;
  color: var(--text-main);
  position: sticky;
  top: 0;
  z-index: 900;
  text-align: left;
  padding: 5px;
  border-bottom: 1px solid var(--border);
}

.fixed-table td {
  padding: 5px;
  border-bottom: 1px solid #2a2a2a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fixed-table tr:nth-child(even) {
  background-color: #252525;
}

/* Galéria */


#image-gallery {
  width: 100%;
  box-sizing: border-box;
}

.image-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 15px;
  padding: 20px;
  width: 100%;
  box-sizing: border-box;
}

.image-cell {
  overflow: hidden;
  word-break: break-word;
  background-color: #1a1a1a;
  border: 1px solid var(--border);
  padding: 5px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.image-cell img {
  width: 100%;
  max-width: 250px;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background-color: #000;
  border: 1px solid #333;
  box-sizing: border-box;
/*  padding: 4px; /* opcionális */
}

.kep-alatt {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

/* Scrollbar */
::-webkit-scrollbar {
  height: 8px;
  width: 8px;
}
::-webkit-scrollbar-thumb {
  background-color: #555;
  border-radius: 4px;
}
::-webkit-scrollbar-track {
  background: #1e1e1e;
}

/* --- Menü + Logó szekció --- */
#header-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 8px;
  position: relative;
}

#menu-logo-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

#menu-toggle {
  font-size: 22px;
  padding: 2px 10px;
  background-color: var(--btn-default);
  border: 1px solid var(--border);
  color: var(--text-main);
  border-radius: 3px;
  cursor: pointer;
}

#logo-placeholder {
  height: 64px;
  width: auto;
  object-fit: contain;
  opacity: 0.9;
}

.hidden {
  display: none;
}

/* TOPBAR teljes sorban, helytakarékos */
#topbar {
  display: flex;
  align-items: center;
  flex-wrap: nowrap; /* ez a kulcs! */
  gap: 20px;
  padding: 10px;
  background-color: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  white-space: nowrap;
}

/* Bal oldal: ikon + logó */
.topbar-left {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

/* Popup menü MOST már globális (body szintű) */
#popup-menu {
  position: fixed;
  top: 62px;
  left: 10px;
  background-color: var(--bg-panel);
  border: 1px solid #149d8b;
  padding: 10px;
  z-index: 9999;
  box-shadow: 0 2px 6px rgba(0,0,0,0.6);
  min-width: 180px;
}

/* Fix: popup ne tördelje a body-t */
#popup-menu ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

#popup-menu li {
  margin-bottom: 8px;
}

#popup-menu a {
  color: var(--text-main);
  text-decoration: none;
}

#popup-menu a:hover {
  color: var(--btn-active);
}

.hover-popup {
  position: absolute;
  background-color: #2a2a2a;
  color: #eee;
  border: 1px solid #149d8b;
  padding: 12px 16px;
  max-width: 600px;
  font-size: 12px;
  z-index: 10000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.6);
  border-radius: 6px;
  pointer-events: none;
  white-space: normal;
  line-height: 1.45;
}
.hover-popup.hidden {
  display: none;
}

.hover-popup b {
  color: #23c2ae;
  font-weight: bold;
  margin-right: 6px;
  display: inline;
}

.hover-popup div {
  margin-bottom: 10px;
}

.hover-popup .szoveg-mezo {
  display: -webkit-box;
  -webkit-line-clamp: 5;     /* max 5 sor */
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  max-height: 7.5em;         /* kb. 5 sor @ 1.5 line-height */
  line-height: 1.5;
  white-space: normal;
  font-size: 13px;
  position: relative;
}

.truncation-hint {
  color: var(--text-muted);
  font-style: italic;
  margin-left: 5px;
  font-size: 90%;
}

.zoom-img-wrapper {
  position: relative;
  width: 250px;
  height: 250px;
  overflow: hidden;
  margin: 0 auto;
  background-color: #000;
  border: 1px solid #333;
  box-sizing: border-box;
}

.zoom-img {
  position: absolute;
  left: 0;
  top: 0;
  object-fit: contain;
  transition: width 0.2s ease, height 0.2s ease, left 0.1s ease, top 0.1s ease;
  cursor: zoom-in;
  max-width: none !important;
  max-height: none !important;
  padding: 0 !important;
}

#open-column-settings {
  background-color: var(--btn-default);
  border: 1px solid var(--border);
  color: var(--text-main);
  font-size: 18px;
  cursor: pointer;
  border-radius: 4px;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background-color: #2b2b2b;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text-main);
  max-height: 80vh;
  overflow-y: auto;
  min-width: 300px;
}

.modal-content label {
  display: block;
  margin: 8px 0;
  font-size: 90%;
}

.modal-actions {
  text-align: right;
  margin-top: 20px;
}

.modal-actions button {
  margin-left: 10px;
}

.autocomplete-suggestions {
  position: fixed !important;
  z-index: 99999 !important;
  background-color: rgb(40, 60, 50);
  color: rgb(206, 228, 217);
  border: 1px solid #ccc;
  max-height: 300px;
  overflow-y: auto;
  list-style: none;
  font-size: 14px;
  white-space: nowrap;
  min-width: 300px;
  max-width: 95vw;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}


.status-buttons {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 8px;
}

.status-btn {
  font-size: 18px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  background-color: var(--btn-default);
  color: #ccc;
  border-radius: 4px;
  cursor: pointer;
}

.status-btn:hover {
  background-color: var(--bg-hover);
}

.status-btn.active {
  background-color: var(--btn-active);
  border-color: var(--btn-active);
  color: white;
}

.modal-content.login-box {
  max-width: 350px;
  width: 90%;
  background-color: #2a2a2a;
  padding: 20px 25px;
  border-radius: 6px;
  border: 1px solid #444;
  color: #ddd;
  box-shadow: 0 0 20px rgba(0,0,0,0.7);
}

.modal-content.login-box h3 {
  margin-top: 0;
  font-size: 20px;
  margin-bottom: 15px;
  color: #fff;
}

.modal-content.login-box label {
  display: block;
  margin-top: 10px;
  margin-bottom: 4px;
  font-size: 90%;
  color: #aaa;
}

.modal-content.login-box input[type="text"],
.modal-content.login-box input[type="password"] {
  width: 100%;
  padding: 6px;
  border: 1px solid #555;
  background-color: #1e1e1e;
  color: #eee;
  border-radius: 4px;
}

.modal-content.login-box .modal-actions {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.status-placeholder {
  margin-top: 10px;
  font-size: 20px;
  color: #666;
  opacity: 0.6;
  text-align: center;
  cursor: default;
}

.selected {
  outline: 2px solid #23c2ae;
  background-color: rgba(20, 157, 139, 0.1);
}

.context-menu {
  position: absolute;
  background: #222;
  color: #fff;
  border: 1px solid #555;
  border-radius: 4px;
  min-width: 180px;
  z-index: 9999;
  font-family: sans-serif;
  font-size: 14px;
  padding: 4px 0;
  box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

.context-menu.hidden {
  display: none;
}

.context-menu li {
  list-style: none;
  padding: 8px 12px;
  cursor: pointer;
  white-space: nowrap;
}

.context-menu li:hover {
  background: #444;
}

.record-warning {
  background-color: #ff4444;
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0px #ff4444; }
  50% { box-shadow: 0 0 10px #ff4444; }
  100% { box-shadow: 0 0 0px #ff4444; }
}

th {
  position: relative;
}

.col-resizer {
  width: 5px;
  height: 100%;
  position: absolute;
  top: 0;
  right: 0;
  cursor: col-resize;
  user-select: none;
  z-index: 10;
}

/* Hide by default */
.app-modal-hidden {
  display: none !important;
}

/* Fullscreen background with dark transparency */
.app-modal-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0,0,0,0.6);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;

  /* ✨ kritikus: kiléptetjük bármely szülő gridből */
  inset: 0;
  margin: 0;
  padding: 0;
  pointer-events: all;
}


/* Themed modal content box */
.about-modal-box {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-main);
  box-shadow: 0 0 15px rgba(0,0,0,0.5);
  font-family: Verdana, sans-serif;

  width: min(90vw, 850px);
  height: 90vh;
  max-height: 90vh;

  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 0;

  overflow: hidden; /* csak a body görgessen */
}

.stat-modal-box {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-main);
  box-shadow: 0 0 15px rgba(0,0,0,0.5);
  font-family: Verdana, sans-serif;

  width: min(90vw, max(50vw, 400px));
  height: 90vh;
  max-height: 90vh;

  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 0;

  overflow: hidden; /* csak a body görgessen */
}

.help-modal-box {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-main);
  box-shadow: 0 0 15px rgba(0,0,0,0.5);
  font-family: Verdana, sans-serif;

  width: min(90vw, 1560px);
  height: 90vh;
  max-height: 90vh;

  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 0;

  overflow: hidden; /* csak a body görgessen */
}

/* Cím fixen felül */
.stat-modal-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  background-color: var(--bg-panel);
  text-align: center;
}

/* Tartalom scrollozható */
.stat-modal-body {
  overflow-y: auto;
  padding: 16px;
}

.about-modal-body {
  overflow-y: auto;
  padding: 16px;
}

.about-modal-body p {
  text-align: left;
}

.about-modal-body p > strong:only-child {
  display: block;
  text-align: center;
  font-weight: bold;
  margin: 1.5em 0 0.5em;
  font-size: 1.1em;
}



/* Bezáró gomb fixen alul */
.stat-modal-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
  text-align: center;
  background-color: var(--bg-panel);
}

.stats-highlight {
  color: var(--accent);
  font-weight: bold;
}

.modal-close-btn {
  padding: 10px 20px;
  background-color: var(--btn-default);
  color: var(--text-main);
  border: 1px solid var(--border);
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.2s ease-in-out;
}

.modal-close-btn:hover {
  background-color: var(--btn-active);
  color: #fff;
  border-color: var(--btn-active);
}

.modal-close-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(30%);
}

.stats-table {
  width: 100%;
  table-layout: fixed; /* 💡 fix layout */
  border-collapse: collapse;
  margin-top: 15px;
  color: var(--text-main);
  font-size: 14px;
}

.stats-table th,
.stats-table td {
  padding: 8px 12px;
  border: 1px solid var(--border);
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 🎯 Egységes oszlopszélesség (4 oszlopos layoutra) */
.stats-table thead th:nth-child(1) { width: 30%; }  /* Év / Évtized */
.stats-table thead th:nth-child(2) { width: 20%; }  /* Összes */
.stats-table thead th:nth-child(3) { width: 25%; }  /* HU */
.stats-table thead th:nth-child(4) { width: 25%; }  /* Int */

.stats-table th {
  background-color: var(--bg-hover);
  color: var(--text-main);
}

.stats-table tr:nth-child(even) {
  background-color: #242424;
}

.adatlap-modal-box {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-main);
  box-shadow: 0 0 15px rgba(0,0,0,0.5);
  font-family: Verdana, sans-serif;
  width: 95vw;
  max-width: 2200px;
  height: 90vh;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  overflow: hidden;
}

#adatlap-modal-body {
  display: grid;
  grid-template-columns: minmax(200px, 800px) minmax(300px, 1fr) minmax(200px, 800px);
  gap: 20px;
  padding: 20px;
  overflow-y: auto;
  align-items: start;
  box-sizing: border-box;
  max-height: 100%;
}

.adatlap-img-wrapper {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}

.adatlap-img-wrapper img {
  max-width: 100%;
  max-height: 100%;
  height: auto;
  width: auto;
  object-fit: contain;
  border: 1px solid var(--border);
  background-color: #000;
  padding: 4px;
}

.adatlap-info-panel {
  font-size: 14px;
  line-height: 1;
  overflow-y: auto;
  max-height: 100%;
}

.adatlap-info-panel b {
  color: var(--accent);
}

.adatlap-stats {
  margin-top: 20px;
  font-weight: bold;
  color: var(--text-muted);
}

.card-details {
  flex-grow: 1;
  max-width: 100%;
}

.card-details-row {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  white-space: normal;
}

.card-details-row b {
  display: block;
  font-weight: bold;
  color: var(--accent);
  margin-bottom: 4px;
}

.card-details-row .value-block {
  display: block;
  word-break: break-word;
  white-space: pre-wrap;
  color: var(--text-main);
}

#adatlap-statusbar {
  padding: 20px;
}

#collectionVisibilityBlock > div {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 14px;
}

.password-modal-box {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-main);
  box-shadow: 0 0 15px rgba(0,0,0,0.5);
  font-family: Verdana, sans-serif;

  width: min(90vw, 500px);
  height: auto;
  max-height: 80vh;

  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}

.profile-grid {
  display: grid;
  grid-template-rows: auto auto;
  gap: 20px;
}

.profile-grid-top {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 20px;
}

.profile-form-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.profile-picture-column {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 250px;
  border: 1px dashed var(--border);
  background-color: #1e1e1e;
}

.profile-picture-placeholder {
  color: var(--text-muted);
  font-size: 15px;
  text-align: center;
  opacity: 0.6;
}

.profile-grid-bottom {
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.profile-form-column hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 10px 0;
  width: 100%;
}

.flash-once { animation: flashBg 1s ease-out; }
@keyframes flashBg { from { background-color: #FFA500; } to { background-color: inherit; } }

/* ========== ÚJ TOPBAR2 STÍLUSOK ========== */

.topbar2-container {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 100px;
  background-color: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  padding: 10px;
  min-height: 64px;
}

.topbar2-left {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 10px;
}

#logo-placeholder {
  height: 64px;
  width: auto;
  object-fit: contain;
  opacity: 0.9;
}

/* KÖZÉPSŐ BLOKK */

.topbar2-center {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  gap: 6px;
  min-width: 300px;
}

.topbar2-search-form {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.topbar2-search-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 12px;
  width: 100%;
}


.topbar2-controls-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
  justify-content: center;
}

/* JOBB OLDAL */

.topbar2-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 6px;
  flex-shrink: 0;
  white-space: nowrap;
}

/* Gombok közti minimális távolság */
.topbar-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  white-space: nowrap;
}

.topbar2-search-fieldgroup,
.topbar2-search-inputgroup {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.topbar2-search-inputgroup {
  flex-grow: 1;
  max-width: 600px;
}

#searchText {
  flex: 1 1 auto;
  min-width: 150px;
}

.topbar2-controls-row .topbar-group {
  margin-right: 40px;
}

.topbar2-controls-row .topbar-group:last-child {
  margin-right: 0;
}

/* STATISZTIKAI BLOKK */
.topbar2-stats {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  white-space: nowrap;
  gap: 2px;
  flex-shrink: 0;
}


.topbar2-stats-line {
  font-size: 90%;
  color: var(--text-muted);
}

/* FOGASKERÉK BLOKK */
.topbar2-settings {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding-left: 12px;
}
