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

:root {
  --lime: #AEEA00;
  --lime-dark: #8BBB00;
  --black: #0a0a0a;
  --black2: #141414;
  --black3: #1e1e1e;
  --black4: #2a2a2a;
  --white: #ffffff;
  --white2: #cccccc;
  --white3: #888888;
}

body {
  font-family: 'Segoe UI', sans-serif;
  background: var(--black);
  color: var(--white);
  min-height: 100vh;
}

.hidden { display: none !important; }

/* ---- LOGIN ---- */
#screen-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--black);
}

.login-box {
  background: var(--black2);
  border: 1px solid var(--black4);
  border-radius: 12px;
  padding: 48px 40px;
  width: 340px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: center;
}

.login-logo-img {
  width: 240px;
  margin: 0 auto 4px;
}

.login-subtitle {
  color: var(--white3);
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.login-error {
  color: #ff4444;
  font-size: 0.85rem;
}

/* ---- HEADER ---- */
header {
  background: var(--black2);
  border-bottom: 2px solid var(--lime);
  padding: 10px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-logo-img {
  height: 40px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-operator {
  color: var(--lime);
  font-weight: 600;
  font-size: 0.9rem;
}

.header-clock {
  color: var(--white2);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  min-width: 70px;
}

/* ---- BARIJERA BAR ---- */
.barrier-bar {
  background: var(--black2);
  border-bottom: 1px solid var(--black4);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-barrier {
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 8px 28px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  background: var(--black4);
  color: var(--white);
  border: 1px solid #444;
}

.btn-barrier:hover {
  background: var(--black3);
  border-color: var(--lime);
  color: var(--lime);
}

.barrier-label {
  color: var(--white3);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  margin-right: 4px;
}

.barrier-status {
  font-size: 0.85rem;
  color: var(--lime);
  font-weight: 600;
  margin-left: 8px;
}

/* ---- MAIN LAYOUT ---- */
#screen-main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.panel {
  background: var(--black2);
  border: 1px solid var(--black4);
  border-radius: 8px;
  padding: 20px 22px;
  margin: 12px 16px 0;
}

.panel-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--lime);
  margin-bottom: 16px;
}

.panel-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.panel-title-row .panel-title { margin-bottom: 0; }

/* ---- MODE BUTTONS ---- */
.mode-btns {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.mode-btn {
  padding: 8px 20px;
  border-radius: 5px;
  border: 1px solid var(--black4);
  background: transparent;
  color: var(--white3);
  cursor: pointer;
  font-size: 0.88rem;
  transition: all 0.15s;
}

.mode-btn.active {
  background: var(--lime);
  border-color: var(--lime);
  color: var(--black);
  font-weight: 700;
}

.mode-btn:not(.active):hover { border-color: var(--lime); color: var(--lime); }

/* ---- INPUTS ---- */
input[type="text"],
input[type="password"],
select {
  width: 100%;
  background: var(--black3);
  border: 1px solid var(--black4);
  border-radius: 6px;
  color: var(--white);
  padding: 12px 14px;
  font-size: 0.95rem;
  margin-bottom: 10px;
  outline: none;
  transition: border 0.15s;
}

input[type="text"]:focus,
input[type="password"]:focus,
select:focus { border-color: var(--lime); }

input::placeholder { color: var(--white3); }
select option { background: var(--black3); }

/* ---- BUTTONS ---- */
.btn-lime {
  background: var(--lime);
  color: var(--black);
  border: none;
  padding: 11px 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  transition: background 0.15s;
  width: 100%;
}

.btn-lime:hover { background: var(--lime-dark); }

.btn-outline {
  background: transparent;
  color: var(--white2);
  border: 1px solid var(--black4);
  padding: 11px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.88rem;
  transition: all 0.15s;
}

.btn-outline:hover { border-color: var(--lime); color: var(--lime); }

.btn-outline-sm {
  background: transparent;
  color: var(--white3);
  border: 1px solid var(--black4);
  padding: 5px 12px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.15s;
}

.btn-outline-sm:hover { border-color: var(--lime); color: var(--lime); }

.btn-logout {
  background: transparent;
  color: var(--white3);
  border: 1px solid var(--black4);
  padding: 5px 12px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.15s;
}

.btn-logout:hover { border-color: #ff4444; color: #ff4444; }

.btn-danger {
  background: transparent;
  color: #ff4444;
  border: 1px solid #ff4444;
  padding: 5px 12px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.82rem;
  transition: all 0.15s;
}

.btn-danger:hover { background: #ff4444; color: white; }

/* ---- ACTION BTNS ROW ---- */
.action-btns {
  display: flex;
  gap: 10px;
  margin-top: 2px;
}

.action-btns .btn-lime { width: auto; flex: 1; }

/* ---- RESULT ---- */
.result {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 6px;
  font-size: 0.9rem;
  line-height: 1.8;
}

.result.success { background: #0d1f0a; border-left: 3px solid var(--lime); }
.result.error   { background: #1f0a0a; border-left: 3px solid #ff4444; }
.result.warning { background: #1f1800; border-left: 3px solid #ffe066; }
.result-name    { font-size: 1.05rem; font-weight: 700; margin-bottom: 4px; color: var(--white); }
.result-detail  { color: var(--white2); }

/* ---- BOTTOM GRID ---- */
.bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.bottom-grid .panel { margin: 12px 8px 0; }
.bottom-grid .panel:first-child { margin-left: 16px; }
.bottom-grid .panel:last-child  { margin-right: 16px; }

/* ---- ČLAN DETALJI ---- */
.clan-top {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.clan-foto {
  width: 120px;
  height: 150px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid var(--lime);
  flex-shrink: 0;
}

.clan-name {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--white);
  display: flex;
  align-items: center;
  gap: 10px;
}

.clan-info { font-size: 0.88rem; color: var(--white2); }

.clan-row {
  display: flex;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--black4);
  align-items: center;
  flex-wrap: wrap;
}
.clan-row:last-child { border-bottom: none; }

.clan-lbl {
  color: var(--white3);
  font-size: 0.78rem;
  min-width: 90px;
  flex-shrink: 0;
}

.rfid-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rfid-val { color: var(--lime); font-family: monospace; font-size: 0.9rem; }

.rfid-scan-box {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px;
  background: var(--black3);
  border-radius: 6px;
  border: 1px solid var(--lime);
}

.rfid-scan-box input {
  flex: 1;
  min-width: 180px;
  margin-bottom: 0;
}

.btn-lime-sm {
  background: var(--lime);
  color: var(--black);
  border: none;
  padding: 5px 14px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  transition: background 0.15s;
}
.btn-lime-sm:hover { background: var(--lime-dark); }

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-active   { background: #0d1f0a; color: var(--lime); border: 1px solid var(--lime); }
.badge-inactive { background: #1f0a0a; color: #ff4444; border: 1px solid #ff4444; }

/* ---- POSJET REDAK ---- */
.posjet-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--black4);
}

.posjet-row:last-child { border-bottom: none; }
.posjet-naziv { font-weight: 600; font-size: 0.9rem; color: var(--white); }
.posjet-meta  { font-size: 0.8rem; color: var(--white3); margin-top: 2px; }
.posjet-time  { color: var(--lime); font-size: 0.85rem; font-variant-numeric: tabular-nums; }

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

#screen-main > .panel:last-child { margin-bottom: 20px; }

/* ---- PHOTO VERIFY ---- */
.photo-verify-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.photo-verify-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.photo-verify-name {
  font-size: 2rem;
  font-weight: 700;
  color: var(--lime);
  letter-spacing: 0.06em;
  text-align: center;
}
.photo-verify-img {
  width: 500px;
  height: 700px;
  object-fit: cover;
  border-radius: 12px;
  border: 3px solid var(--lime);
}
.photo-verify-no-photo {
  width: 500px;
  height: 700px;
  border-radius: 12px;
  border: 3px solid var(--black4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white3);
  font-size: 1.2rem;
  background: var(--black3);
}
.photo-verify-hint {
  color: var(--white3);
  font-size: 0.85rem;
}

/* ---- GOLD MEMBER ---- */
.gold-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  cursor: pointer;
}

.gold-overlay.show { display: flex; }

.gold-crown {
  font-size: 8rem;
  animation: crownPulse 1s ease-in-out infinite alternate;
}

.gold-name {
  font-size: 2rem;
  font-weight: 900;
  color: #FFD700;
  text-align: center;
}

.gold-label {
  font-size: 1rem;
  color: #FFD700;
  letter-spacing: 0.2em;
  opacity: 0.8;
}

.gold-dismiss { color: #888; font-size: 0.85rem; margin-top: 8px; }

@keyframes crownPulse {
  from { transform: scale(1); filter: drop-shadow(0 0 20px #FFD700); }
  to   { transform: scale(1.08); filter: drop-shadow(0 0 40px #FFD700); }
}

.badge-gold {
  background: #2a1f00;
  color: #FFD700;
  border: 1px solid #FFD700;
}

/* ---- ADMIN ---- */
.admin-add-form { margin-top: 8px; display: flex; flex-direction: column; gap: 10px; max-width: 360px; }

.admin-tabs {
  display: flex;
  gap: 4px;
  padding: 16px 20px 0;
  border-bottom: 1px solid var(--black4);
}
.admin-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--white3);
  padding: 10px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: -1px;
}
.admin-tab:hover { color: var(--white2); }
.admin-tab.active { color: var(--lime); border-bottom-color: var(--lime); }
.admin-tab-content { padding: 0 20px; }

/* ---- RUČNA PRETRAGA ---- */
.search-results {
  margin-top: 8px;
  border: 1px solid var(--black4);
  border-radius: 6px;
  overflow: hidden;
  max-height: 220px;
  overflow-y: auto;
}

.search-row {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--black4);
  transition: background 0.12s;
}

.search-row:last-child { border-bottom: none; }
.search-row:hover { background: var(--black3); }

.search-name {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--white);
}

.search-meta {
  font-size: 0.78rem;
  color: var(--white3);
  margin-top: 2px;
}

/* ---- ZABORAVLJEN TOKEN ---- */
.forgotten-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--black4);
  flex-wrap: wrap;
}

.btn-forgotten {
  background: transparent;
  color: #ff6b35;
  border: 1px solid #ff6b35;
  padding: 9px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  transition: all 0.15s;
}

.btn-forgotten:hover:not(:disabled) {
  background: #ff6b35;
  color: var(--white);
}

.btn-forgotten:disabled {
  opacity: 0.7;
  cursor: default;
}

.forgotten-count {
  color: #ff6b35;
  font-size: 0.82rem;
  font-weight: 600;
}

/* ---- NOVI ČLAN GUMB ---- */
.btn-novi-clan {
  background: var(--lime);
  color: var(--black);
  border: none;
  padding: 6px 16px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
  transition: background 0.15s;
}
.btn-novi-clan:hover { background: var(--lime-dark); }

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-box {
  background: var(--black2);
  border: 1px solid var(--black4);
  border-radius: 10px;
  width: 100%;
  max-width: 700px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--black4);
  flex-shrink: 0;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--white3);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 4px;
  transition: color 0.15s;
}
.modal-close:hover { color: #ff4444; }

/* HELP button */
.btn-help {
  background: transparent;
  border: 2px solid var(--lime);
  color: var(--lime);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.btn-help:hover { background: var(--lime); color: #000; }

/* HELP overlay */
.help-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 1100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 12px;
  overflow-y: auto;
}
.help-overlay.hidden { display: none; }
.help-box {
  background: var(--black2);
  border: 1px solid var(--black4);
  border-radius: 10px;
  width: 100%;
  max-width: 820px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 48px);
}
.help-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--black4);
  flex-shrink: 0;
}
.help-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--lime);
  white-space: nowrap;
}
.help-search {
  flex: 1;
  background: var(--black3);
  border: 1px solid var(--black4);
  border-radius: 6px;
  color: var(--white1);
  font-size: 0.9rem;
  padding: 7px 12px;
}
.help-search::placeholder { color: var(--white3); }
.help-search:focus { outline: none; border-color: var(--lime); }
.help-body {
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.help-section { display: flex; flex-direction: column; gap: 10px; }
.help-section.hidden { display: none; }
.help-h1 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--lime);
  border-bottom: 1px solid var(--black4);
  padding-bottom: 6px;
}
.help-table { display: flex; flex-direction: column; gap: 4px; }
.help-tr { display: flex; gap: 8px; font-size: 0.88rem; }
.help-td-h { color: var(--white2); font-weight: 600; min-width: 140px; flex-shrink: 0; }
.help-td { color: var(--white3); }
.help-steps { display: flex; flex-direction: column; gap: 6px; }
.help-step {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 0.88rem;
  color: var(--white2);
}
.help-step-n {
  background: var(--lime);
  color: #000;
  font-weight: 700;
  font-size: 0.75rem;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.help-warn {
  background: rgba(255,80,80,0.12);
  border-left: 3px solid #f44;
  color: #ff8a8a;
  font-size: 0.85rem;
  padding: 8px 12px;
  border-radius: 0 6px 6px 0;
}
.help-tip {
  background: rgba(180,255,100,0.08);
  border-left: 3px solid var(--lime);
  color: var(--white2);
  font-size: 0.85rem;
  padding: 8px 12px;
  border-radius: 0 6px 6px 0;
}
.help-whatif {
  border: 1px solid var(--black4);
  border-radius: 6px;
  overflow: hidden;
}
.help-whatif-title {
  background: var(--black3);
  color: var(--white1);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 8px 14px;
}
.help-whatif-body {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.help-faq { padding: 8px 0; border-bottom: 1px solid var(--black4); }
.help-faq:last-child { border-bottom: none; }
.help-faq-q { color: var(--white1); font-size: 0.88rem; font-weight: 600; margin-bottom: 3px; }
.help-faq-a { color: var(--white3); font-size: 0.85rem; }
.help-highlight { background: rgba(180,255,100,0.2); border-radius: 2px; }

.btn-back {
  background: transparent;
  border: none;
  color: var(--lime);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  letter-spacing: 0.03em;
  transition: opacity 0.15s;
}
.btn-back:hover { opacity: 0.7; }

.modal-body {
  padding: 20px 22px;
  overflow-y: auto;
  display: flex;
  gap: 20px;
  flex: 1;
}

.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--black4);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.modal-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--lime);
  margin: 16px 0 10px;
}

.modal-fields {
  flex: 1;
  min-width: 0;
}

.field-row {
  display: flex;
  gap: 12px;
  margin-bottom: 4px;
}

.field-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field-group label {
  font-size: 0.75rem;
  color: var(--white3);
  margin-bottom: 2px;
}

.field-group input,
.field-group select {
  margin-bottom: 0;
}

/* ---- PHOTO UPLOAD ---- */
.photo-upload-area {
  width: 120px;
  flex-shrink: 0;
  height: 160px;
  border: 2px dashed var(--black4);
  border-radius: 8px;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s;
  align-self: flex-start;
}
.photo-upload-area:hover { border-color: var(--lime); }

.photo-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-placeholder {
  text-align: center;
  color: var(--white3);
  font-size: 0.75rem;
  padding: 10px;
  line-height: 1.6;
}

/* ---- MODAL ERROR ---- */
.modal-error {
  color: #ff4444;
  font-size: 0.85rem;
  flex: 1;
}

/* ---- EMERGENCY CONTACT ---- */
.emergency-row .emergency-val {
  color: #ff6b35;
  font-weight: 600;
  font-size: 0.88rem;
}

/* ---- CLAN ACTIONS ---- */
.clan-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--black4);
}
