/* ── Ubuntu Fonts ────────────────────────────────── */
@font-face { font-family: "Ubuntu"; src: url('/public/fonts/Ubuntu-Regular.ttf') format('truetype'); font-weight: 400; font-style: normal; }
@font-face { font-family: "Ubuntu"; src: url('/public/fonts/Ubuntu-Italic.ttf') format('truetype'); font-weight: 400; font-style: italic; }
@font-face { font-family: "Ubuntu"; src: url('/public/fonts/Ubuntu-Light.ttf') format('truetype'); font-weight: 300; font-style: normal; }
@font-face { font-family: "Ubuntu"; src: url('/public/fonts/Ubuntu-LightItalic.ttf') format('truetype'); font-weight: 300; font-style: italic; }
@font-face { font-family: "Ubuntu"; src: url('/public/fonts/Ubuntu-Medium.ttf') format('truetype'); font-weight: 500; font-style: normal; }
@font-face { font-family: "Ubuntu"; src: url('/public/fonts/Ubuntu-MediumItalic.ttf') format('truetype'); font-weight: 500; font-style: italic; }
@font-face { font-family: "Ubuntu"; src: url('/public/fonts/Ubuntu-Bold.ttf') format('truetype'); font-weight: 700; font-style: normal; }
@font-face { font-family: "Ubuntu"; src: url('/public/fonts/Ubuntu-BoldItalic.ttf') format('truetype'); font-weight: 700; font-style: italic; }

:root {
  --gold:        #A68444;
  --gold-light:  #BF9969;
  --crimson:     #8C1E14;
  --deep-red:    #260101;
  --dark-teal:   #121C1D;
  --black:       #0D0D0D;

  --ink:         #E8D9B8;
  --surface:     rgba(18, 28, 29, 0.88);
  --surface-alt: rgba(13, 13, 13, 0.80);
  --line:        #A68444;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  background-color: var(--black);
  background-image: url('/public/images/bg.png');
  background-repeat: repeat;
  background-attachment: fixed;
  background-size: 490px 490px;
  font-family: "Ubuntu", "Segoe UI", sans-serif;
  color: var(--ink);
}

/* ── Header ─────────────────────────────────────── */
.site-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 1.2rem;
  background: rgba(13, 13, 13, 0.95);
  border-bottom: 2px solid var(--gold);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-logo {
  height: 56px;
  width: auto;
  display: block;
}

nav {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

nav a,
button {
  border: 1px solid var(--gold);
  background: transparent;
  color: var(--gold-light);
  padding: 0.4rem 0.8rem;
  text-decoration: none;
  border-radius: 0.3rem;
  cursor: pointer;
  font-size: 0.9rem;
  letter-spacing: 0.03em;
  transition: background 0.15s, color 0.15s;
}

nav a:hover,
button:hover {
  background: var(--gold);
  color: var(--black);
}

.inline-form {
  display: inline;
}

/* ── Icon button (logout) ────────────────────────── */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  border: 1px solid var(--gold);
  border-radius: 0.3rem;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-icon img {
  width: 1.2rem;
  height: 1.2rem;
  display: block;
  filter: invert(80%) sepia(20%) saturate(400%) hue-rotate(5deg);
}

.btn-icon:hover {
  background: var(--crimson);
}

/* ── User avatar ─────────────────────────────────── */
.user-menu-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.user-avatar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  border: 2px solid var(--gold);
  border-radius: 50%;
  overflow: hidden;
  background: var(--deep-red);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.user-avatar-btn:hover {
  background: var(--crimson);
  border-color: var(--gold-light);
}

.avatar-initials {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--gold-light);
  letter-spacing: 0;
  pointer-events: none;
}

.avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  pointer-events: none;
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  min-width: 160px;
  background: rgba(13, 13, 13, 0.97);
  border: 1px solid var(--gold);
  border-radius: 0.4rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}

.user-dropdown[hidden] { display: none; }

.user-dropdown-name {
  padding: 0.5rem 0.8rem;
  color: var(--gold);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(166,132,68,0.3);
}

.user-dropdown a {
  padding: 0.55rem 0.8rem;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.9rem;
  border: none;
  border-radius: 0;
  background: transparent;
  display: block;
  transition: background 0.12s;
}

.user-dropdown a:hover {
  background: rgba(166,132,68,0.15);
  color: var(--gold-light);
}

/* ── Mobile nav toggle ───────────────────────────── */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 2.1rem;
  height: 2.1rem;
  padding: 0.35rem 0.3rem;
  border: 1px solid var(--gold);
  border-radius: 0.3rem;
  background: transparent;
  cursor: pointer;
  margin-left: auto;
}

.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--gold-light);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}

.nav-toggle:hover {
  background: rgba(166,132,68,0.1);
}

@media (max-width: 767px) {
  .nav-toggle {
    display: flex;
  }

  #site-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
    padding: 0.5rem 0;
    border-top: 1px solid rgba(166,132,68,0.3);
    order: 3;
  }

  #site-nav.nav-open {
    display: flex;
  }

  #site-nav > a,
  #site-nav > .inline-form,
  #site-nav > .user-menu-wrap {
    width: 100%;
  }

  #site-nav > a {
    padding: 0.55rem 0.6rem;
  }

  .user-menu-wrap {
    flex-direction: column;
    align-items: flex-start;
  }

  .user-avatar-btn {
    width: 100%;
    border-radius: 0.3rem;
    height: 2.2rem;
    justify-content: flex-start;
    padding: 0 0.6rem;
    gap: 0.5rem;
  }

  .user-avatar-btn .avatar-initials,
  .user-avatar-btn .avatar-img {
    width: 1.5rem;
    height: 1.5rem;
  }

  .user-dropdown {
    position: static;
    box-shadow: none;
    border: none;
    border-top: 1px solid rgba(166,132,68,0.2);
    border-radius: 0;
    background: rgba(166,132,68,0.05);
  }

  .btn-icon {
    width: 100%;
    height: 2.2rem;
    border-radius: 0.3rem;
    justify-content: flex-start;
    padding: 0 0.6rem;
    gap: 0.5rem;
  }

  .btn-icon::after {
    content: "Logout";
    color: var(--gold-light);
    font-size: 0.9rem;
  }

  .site-header {
    flex-wrap: wrap;
  }
}

/* ── Layout ─────────────────────────────────────── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.2rem;
  display: grid;
  gap: 1rem;
}

/* ── Cards ───────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--gold);
  border-radius: 0.5rem;
  padding: 1.2rem;
  backdrop-filter: blur(2px);
}

.card h2, .card h3 {
  margin-top: 0;
  color: var(--gold-light);
  border-bottom: 1px solid var(--crimson);
  padding-bottom: 0.4rem;
  margin-bottom: 0.8rem;
}

/* ── Forms ───────────────────────────────────────── */
.stack {
  display: grid;
  gap: 0.75rem;
}

label {
  display: grid;
  gap: 0.35rem;
  color: var(--gold-light);
  font-size: 0.9rem;
  letter-spacing: 0.03em;
}

input,
textarea,
select {
  width: 100%;
  padding: 0.55rem;
  border: 1px solid var(--gold);
  border-radius: 0.35rem;
  background: rgba(13, 13, 13, 0.85);
  color: var(--ink);
  font-family: inherit;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--gold-light);
  box-shadow: 0 0 0 2px rgba(166, 132, 68, 0.25);
}

body button[type="submit"],
body .card button {
  background: var(--crimson);
  color: var(--ink);
  border: 1px solid var(--gold);
  padding: 0.5rem 1.1rem;
  font-size: 0.95rem;
  cursor: pointer;
  border-radius: 0.35rem;
  transition: background 0.15s;
}

body button[type="submit"]:hover,
body .card button:hover {
  background: #a0241a;
}

/* ── Utilities ───────────────────────────────────── */
.error {
  background: rgba(140, 30, 20, 0.3);
  border: 1px solid var(--crimson);
  padding: 0.7rem;
  border-radius: 0.4rem;
  color: #f5a9a4;
}

.entry {
  border-top: 1px dashed var(--gold);
  padding-top: 0.75rem;
  margin-top: 0.75rem;
}

.meta {
  color: var(--gold);
  font-size: 0.85rem;
}

.grid-two {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  background: rgba(38, 1, 1, 0.6);
  color: var(--gold-light);
  padding: 0.5rem;
  text-align: left;
  border-bottom: 1px solid var(--gold);
}

td {
  border-bottom: 1px solid rgba(166, 132, 68, 0.2);
  padding: 0.45rem 0.5rem;
  color: var(--ink);
}

tr:hover td {
  background: rgba(166, 132, 68, 0.07);
}

ul {
  padding-left: 1.2rem;
}

ul li {
  margin-bottom: 0.3rem;
}

ul a {
  color: var(--gold-light);
  text-decoration: none;
}

ul a:hover {
  color: var(--gold);
  text-decoration: underline;
}

@media (min-width: 768px) {
  .grid-two {
    grid-template-columns: 1fr 1fr;
  }

  .site-logo {
    height: 68px;
  }
}

/* ── Profile avatar ──────────────────────────────── */
.profile-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--gold);
  flex-shrink: 0;
}

.profile-avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--deep-red);
  color: var(--gold-light);
  font-size: 1.6rem;
  font-weight: 700;
}

.profile-avatar-row {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  flex-wrap: wrap;
}

/* ── File input label ────────────────────────────── */
.file-label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  color: var(--gold-light);
  font-size: 0.9rem;
  cursor: pointer;
}

.file-label input[type="file"] {
  width: auto;
  padding: 0.3rem 0;
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 0.85rem;
}

/* ── Form actions row ────────────────────────────── */
.form-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}

/* ── Text link button ────────────────────────────── */
.btn-link {
  color: var(--gold-light);
  text-decoration: underline;
  font-size: 0.9rem;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

.btn-link:hover {
  color: var(--gold);
}

/* ── Small table button ──────────────────────────── */
.btn-sm {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--gold);
  border-radius: 0.3rem;
  color: var(--gold-light);
  text-decoration: none;
  font-size: 0.8rem;
  transition: background 0.12s;
  white-space: nowrap;
}

.btn-sm:hover {
  background: var(--gold);
  color: var(--black);
}

/* ── Table avatar ────────────────────────────────── */
.tbl-avatar {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
  border: 1px solid var(--gold);
  display: block;
  overflow: hidden;
}

.tbl-avatar-init {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--deep-red);
  color: var(--gold-light);
  font-size: 0.65rem;
  font-weight: 700;
}

.inline-lang-flag {
  vertical-align: middle;
  margin-right: 0.35rem;
}

/* Users table alignment */
.admin-users-table tbody tr {
  height: 50px;
}

.admin-users-table td,
.admin-users-table th {
  height: 50px;
  vertical-align: middle;
}

.admin-users-table .tbl-avatar,
.admin-users-table .inline-lang-flag {
  vertical-align: middle;
}

.admin-users-table .tbl-avatar.tbl-avatar-active {
  border-color: #39ff14;
}

.users-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.users-delete-form {
  display: inline-flex;
  align-items: center;
  margin: 0;
}

.users-delete-btn {
  padding: 0 0;
  min-width: auto;
  width: 25px;
  height: 25px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.users-delete-btn:hover {
  opacity: 0.8;
}

/* ── Success banner ──────────────────────────────── */
.success-banner {
  background: rgba(20, 100, 40, 0.3);
  border: 1px solid #3a7a50;
  padding: 0.7rem;
  border-radius: 0.4rem;
  color: #a0eab8;
}

/* ── Language switcher (desktop only) ───────────── */
.lang-switcher {
  display: none;
}
@media (min-width: 768px) {
  .lang-switcher {
    display: block;
    position: fixed;
    bottom: 0.9rem;
    right: 0.9rem;
    z-index: 200;
  }
  .lang-switcher-btn {
    background: var(--surface);
    border: 1px solid var(--gold);
    border-radius: 0.35rem;
    width: 1.85rem;
    height: 1.35rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 1px;
    transition: border-color 0.15s;
  }
  .lang-switcher-btn:hover { border-color: var(--gold-light); }
  .lang-switcher-btn img { width: 20px; height: 13px; object-fit: cover; border-radius: 1px; }
  .lang-switcher-panel {
    position: absolute;
    bottom: 1.8rem;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--gold);
    border-radius: 0.5rem;
    padding: 0.4rem;
    min-width: 11rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.6);
  }
  .lang-switcher-search {
    width: 100%;
    margin-bottom: 0.3rem;
    padding: 0.3rem 0.45rem;
    font-size: 0.8rem;
  }
  .lang-switcher-items {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    max-height: 14rem;
    overflow-y: auto;
  }
  .lang-item { margin: 0; }
  .lang-option-btn {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    background: none;
    border: none;
    padding: 0.3rem 0.4rem;
    cursor: pointer;
    text-align: left;
    border-radius: 0.3rem;
    color: var(--ink);
    font-size: 0.82rem;
    transition: background 0.12s;
  }
  .lang-option-btn:hover { background: rgba(166,132,68,0.15); }
  .lang-option-btn img { width: 24px; height: 16px; object-fit: cover; border-radius: 1px; flex-shrink: 0; }
}

/* ── Floating back-to-top button ────────────────── */
.floating-top-btn {
  position: fixed;
  left: 0.9rem;
  bottom: 0.9rem;
  z-index: 190;
  background: var(--crimson);
  color: var(--ink);
  border: 1px solid var(--gold);
  border-radius: 0.35rem;
  padding: 0.4rem 0.7rem;
  text-decoration: none;
  font-size: 0.82rem;
}
.floating-top-btn:hover {
  background: #a0241a;
}
@media (max-width: 767px) {
  .floating-top-btn {
    left: 0.6rem;
    bottom: 0.6rem;
    font-size: 0.78rem;
    padding: 0.35rem 0.6rem;
  }
}

/* ── Translation nav bar ─────────────────────────── */
.trans-nav {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
  padding: 0.75rem 1rem;
}

/* ── btn-sm active state ─────────────────────────── */
.btn-sm-active {
  background: var(--gold);
  color: var(--black);
}

/* ── Translation edit sticky bar ─────────────────── */
.trans-sticky-bar {
  position: sticky;
  top: 70px;
  z-index: 99;
  background: var(--surface);
  border: 1px solid var(--gold);
  border-radius: 0.4rem;
  padding: 0.5rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
  backdrop-filter: blur(4px);
}

/* ── Translation table ───────────────────────────── */
.trans-table { width: 100%; border-collapse: collapse; }
.trans-table thead th {
  position: sticky;
  top: 120px;
  z-index: 98;
  background: rgba(38,1,1,0.95);
}
.trans-table th.sortable { cursor: pointer; user-select: none; }
.trans-table th.sortable:hover { color: var(--gold); }
.trans-table .sort-arrow { font-size: 0.75rem; }
.trans-table td:last-child input { width: 100%; }
