/* ===================== FONT GOLDEN GATE (URW DIN) ===================== */
@font-face {
  font-family: "URW DIN";
  src: url("fonts/URWDIN-Light.otf") format("opentype");
  font-weight: 300; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "URW DIN";
  src: url("fonts/URWDIN-Regular.otf") format("opentype");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "URW DIN";
  src: url("fonts/URWDIN-Medium.otf") format("opentype");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "URW DIN";
  src: url("fonts/URWDIN-Demi.otf") format("opentype");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "URW DIN";
  src: url("fonts/URWDIN-Bold.otf") format("opentype");
  font-weight: 700; font-style: normal; font-display: swap;
}

/* ===================== BẢNG MÀU THƯƠNG HIỆU ===================== */
:root {
  --gg-gold:        #8C6E1F;   /* nâu vàng logo */
  --gg-gold-dark:   #6F561596;
  --gg-gold-deep:   #5E4910;
  --gg-cream:       #F6F1E7;   /* nền kem */
  --gg-cream-soft:  #FBF8F1;
  --gg-ink:         #2B2417;   /* chữ đậm */
  --gg-muted:       #8A8167;
  --gg-line:        #E4DAC4;
  --gg-error:       #B4231F;
  --gg-bg-gold:     #D8A732;   /* nền vàng theo brand guideline */
  --gg-bg-gold-dk:  #CC9C2B;   /* gold đậm hơn cho gradient đáy */
  --shadow:         0 14px 36px rgba(94, 73, 16, 0.22);
}

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

/* Đảm bảo thuộc tính [hidden] luôn ẩn, kể cả khi .screen đặt display:flex */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  font-family: "URW DIN", "Segoe UI", system-ui, sans-serif;
  color: var(--gg-ink);
  background:
    url("assets/symbol-watermark.png") -6% 118% / min(72vh, 600px) no-repeat,
    linear-gradient(180deg, #DDAE38 0%, var(--gg-bg-gold) 45%, var(--gg-bg-gold-dk) 100%);
  background-attachment: fixed, fixed;
  background-color: var(--gg-bg-gold);
  -webkit-font-smoothing: antialiased;
}

.screen {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.page-foot {
  margin-top: auto;
  padding: 18px;
  text-align: center;
  font-size: 13px;
  letter-spacing: .04em;
  color: rgba(255, 255, 255, 0.8);
}

/* ===================== MÀN ĐĂNG NHẬP ===================== */
#login-screen {
  align-items: center;
  justify-content: center;
}

.login-card {
  width: min(380px, 92vw);
  margin: auto;
  background: var(--gg-cream-soft);
  border: 1px solid var(--gg-line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 38px 32px 32px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.login-logo {
  width: 96px;
  height: auto;
  align-self: center;
  margin-bottom: 18px;
}

.login-title {
  text-align: center;
  font-weight: 700;
  font-size: 26px;
  letter-spacing: .06em;
  color: var(--gg-gold-deep);
  text-transform: uppercase;
}

.login-sub {
  text-align: center;
  color: var(--gg-muted);
  font-size: 14px;
  margin: 6px 0 26px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.field > span {
  font-size: 13px;
  font-weight: 500;
  color: var(--gg-gold-deep);
  letter-spacing: .02em;
}

.field input {
  font-family: inherit;
  font-size: 15px;
  padding: 12px 14px;
  border: 1.5px solid var(--gg-line);
  border-radius: 10px;
  background: #fff;
  color: var(--gg-ink);
  transition: border-color .15s, box-shadow .15s;
}

.field input:focus {
  outline: none;
  border-color: var(--gg-gold);
  box-shadow: 0 0 0 3px rgba(140, 110, 31, 0.15);
}

.login-error {
  background: #fbe9e7;
  border: 1px solid #f0c4c0;
  color: var(--gg-error);
  font-size: 13.5px;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 14px;
}

/* ===================== NÚT ===================== */
.btn-primary {
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .04em;
  color: #fff;
  background: linear-gradient(180deg, var(--gg-gold) 0%, var(--gg-gold-deep) 100%);
  border: none;
  border-radius: 10px;
  padding: 13px 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: filter .15s, transform .05s;
}
.btn-primary:hover { filter: brightness(1.07); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: .6; cursor: default; }

.btn-ghost {
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  background: transparent;
  border: 1.5px solid rgba(255, 255, 255, 0.7);
  border-radius: 8px;
  padding: 8px 16px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.btn-ghost:hover { background: #fff; color: var(--gg-gold-deep); border-color: #fff; }

.spinner {
  width: 16px; height: 16px;
  border: 2.5px solid rgba(255,255,255,.5);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===================== MÀN DANH SÁCH ===================== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 28px;
  background: var(--gg-gold-deep);
  border-bottom: 1px solid rgba(255, 255, 255, 0.28);
}
.topbar-logo { height: 38px; width: auto; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.hello-user { font-size: 14px; color: rgba(255, 255, 255, 0.92); }

.content {
  width: min(720px, 92vw);
  margin: 40px auto 20px;
  flex: 1;
}
/* Máy tính: rộng hơn để chứa 2 cột danh sách */
@media (min-width: 721px) {
  .content { width: min(980px, 92vw); }
}
.content-title {
  font-weight: 800;
  font-size: 28px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: #fff;
}
.content-sub {
  color: rgba(255, 255, 255, 0.85);
  margin: 6px 0 24px;
  font-size: 15px;
}

.assistant-list {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr;   /* điện thoại: 1 cột dọc */
  gap: 12px;
  counter-reset: item;
}

/* Máy tính: cột trái 7 hướng dẫn (1-7), cột phải 6 sổ tay (8-13) */
@media (min-width: 721px) {
  .assistant-list {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: repeat(7, auto);
    grid-auto-flow: column;
    gap: 12px 20px;
  }
}

.assistant-row {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--gg-cream-soft);
  border: 1px solid var(--gg-line);
  border-radius: 12px;
  padding: 14px 18px;
  transition: box-shadow .15s, border-color .15s, transform .05s;
}
.assistant-row:hover {
  border-color: var(--gg-gold);
  box-shadow: var(--shadow);
}

.assistant-num {
  flex: 0 0 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  background: linear-gradient(180deg, var(--gg-gold) 0%, var(--gg-gold-deep) 100%);
}

.assistant-name {
  flex: 1;
  font-size: 16.5px;
  font-weight: 500;
  color: var(--gg-ink);
}

.btn-open {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .03em;
  color: #fff;
  background: var(--gg-gold);
  border: none;
  border-radius: 8px;
  padding: 9px 18px;
  cursor: pointer;
  white-space: nowrap;
  transition: filter .15s, transform .05s;
}
.btn-open:hover { filter: brightness(1.08); }
.btn-open:active { transform: translateY(1px); }
.btn-open.disabled {
  background: #cfc3a3;
  cursor: not-allowed;
}

/* ===================== BẢNG CHỈNH SỬA LINK (ADMIN) ===================== */
.edit-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(43, 36, 23, 0.55);
}

.edit-modal {
  width: min(640px, 96vw);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--gg-cream-soft);
  border: 1px solid var(--gg-line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 26px 26px 22px;
}

.edit-title {
  font-weight: 700;
  font-size: 21px;
  letter-spacing: .03em;
  color: var(--gg-gold-deep);
  margin-bottom: 8px;
}

.edit-note {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--gg-muted);
  margin-bottom: 18px;
}

.edit-rows {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.edit-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.edit-row > span {
  font-size: 13px;
  font-weight: 500;
  color: var(--gg-gold-deep);
}

.edit-row input {
  font-family: inherit;
  font-size: 14px;
  padding: 10px 12px;
  border: 1.5px solid var(--gg-line);
  border-radius: 9px;
  background: #fff;
  color: var(--gg-ink);
  transition: border-color .15s, box-shadow .15s;
}
.edit-row input:focus {
  outline: none;
  border-color: var(--gg-gold);
  box-shadow: 0 0 0 3px rgba(140, 110, 31, 0.15);
}

.edit-msg {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  background: #eef5e7;
  border: 1px solid #cfe1bd;
  color: #3f6021;
}
.edit-msg.edit-msg-error {
  background: #fbe9e7;
  border-color: #f0c4c0;
  color: var(--gg-error);
}

.assistant-loading {
  list-style: none;
  color: rgba(255, 255, 255, 0.9);
  font-size: 15px;
  padding: 8px 2px;
}

.edit-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}
.edit-actions-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-secondary {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .03em;
  color: var(--gg-gold-deep);
  background: #fff;
  border: 1.5px solid var(--gg-gold);
  border-radius: 9px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background .15s, filter .15s, transform .05s;
}
.btn-secondary:hover { background: var(--gg-cream); }
.btn-secondary:active { transform: translateY(1px); }

.btn-ghost-dark {
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--gg-gold-deep);
  background: transparent;
  border: 1.5px solid var(--gg-line);
  border-radius: 9px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn-ghost-dark:hover { background: var(--gg-cream); border-color: var(--gg-gold); }

/* Nút Lưu/Tải dùng .btn-primary nhưng cần cỡ vừa trong modal */
.edit-actions .btn-primary { padding: 10px 18px; font-size: 14px; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 520px) {
  .topbar { padding: 12px 16px; }
  .topbar-logo { height: 30px; }
  .assistant-row { padding: 12px 14px; gap: 12px; }
  .assistant-name { font-size: 15px; }
  .btn-open { padding: 8px 14px; }
  .edit-actions, .edit-actions-right { flex-direction: column; align-items: stretch; }
  .edit-actions-right > button, .edit-reset { width: 100%; }
}
