/* Hai Yong Admin — styling
   Matches the public site's navy/gold palette but optimized for forms and tables. */

:root {
  --navy:        #0a1628;
  --navy-2:      #14213d;
  --gold:        #c9a961;
  --gold-light:  #d4af6a;
  --text-body:   rgba(255,255,255,0.78);
  --text-mute:   rgba(255,255,255,0.55);
  --line:        rgba(255,255,255,0.12);
  --line-strong: rgba(255,255,255,0.22);
  --danger:      #d97757;
  --bg-card:     rgba(255,255,255,0.04);
  --bg-input:    rgba(255,255,255,0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-body);
  background: var(--navy);
  background-image: radial-gradient(at top right, var(--navy-2), var(--navy) 60%);
  min-height: 100vh;
}

a { color: var(--gold-light); text-decoration: none; }
a:hover { color: var(--gold); }

code { font-family: 'SF Mono', Menlo, Consolas, monospace; font-size: 0.9em; background: rgba(255,255,255,0.08); padding: 1px 4px; border-radius: 3px; }

/* ─── Header ─── */
.ah {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 32px;
  background: rgba(10,22,40,0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.ah-brand {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 18px;
  font-weight: 500;
  color: #fff;
  letter-spacing: 0.02em;
}
.ah-brand:hover { color: #fff; }
.ah-nav {
  display: flex;
  align-items: center;
  gap: 18px;
}
.ah-nav a {
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-mute);
}
.ah-nav a:hover { color: var(--gold-light); }
.ah-form { margin: 0; display: inline; }
.ah-link {
  background: transparent;
  border: 0;
  font: inherit;
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-mute);
  cursor: pointer;
  padding: 0;
}
.ah-link:hover { color: var(--gold-light); }
.ah-link-strong { color: var(--gold-light); }
.ah-link-strong:hover { color: #fff; }

.ah-flash {
  margin: 20px 32px 0;
  padding: 12px 18px;
  background: rgba(201,169,97,0.12);
  border: 1px solid rgba(201,169,97,0.3);
  border-radius: 4px;
  color: var(--gold-light);
}

/* ─── Main ─── */
.am {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px;
}

h1 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 400;
  font-size: 32px;
  color: #fff;
  margin: 0;
}

/* ─── Buttons ─── */
.ab {
  display: inline-block;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.5px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: transparent;
  color: var(--text-body);
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.ab:hover {
  border-color: var(--gold);
  color: var(--gold-light);
}
.ab-primary {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--navy);
}
.ab-primary:hover {
  background: var(--gold-light);
  border-color: var(--gold-light);
  color: var(--navy);
}
.ab-sm  { padding: 5px 10px; font-size: 11px; }
.ab-danger { color: var(--danger); border-color: rgba(217,119,87,0.3); }
.ab-danger:hover { color: #fff; background: var(--danger); border-color: var(--danger); }

/* ─── Article list ─── */
.al-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.al-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}
.al-table th,
.al-table td {
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.al-table th {
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-mute);
  background: rgba(255,255,255,0.02);
}
.al-table tr:last-child td { border-bottom: 0; }
.al-table strong { color: #fff; font-weight: 500; }
.al-slug { font-size: 11px; color: var(--text-mute); margin-top: 2px; }
.al-actions { white-space: nowrap; }
.al-actions .ab + .ab,
.al-actions .ab + form { margin-left: 6px; }
.al-empty { text-align: center; padding: 40px; color: var(--text-mute); }
.al-hint { font-size: 12px; color: var(--text-mute); margin-top: 18px; text-align: right; }

/* ─── Article form ─── */
.af { max-width: 920px; }
.af-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 24px;
  margin-top: 8px;
}
.af-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.af-field > span {
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-mute);
}
.af-field input,
.af-field select,
.af-field textarea {
  background: var(--bg-input);
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  color: #fff;
  padding: 9px 12px;
  font: inherit;
  font-size: 14px;
}
.af-field textarea {
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
  resize: vertical;
  min-height: 320px;
}
.af-field input:focus,
.af-field select:focus,
.af-field textarea:focus {
  outline: 0;
  border-color: var(--gold);
}
.af-wide  { grid-column: span 2; }
.af-full  { grid-column: 1 / -1; }
.af-hint  { font-size: 11px; color: var(--text-mute); font-style: normal; margin-top: 2px; }

.af-radio-group { display: flex; gap: 14px; margin-top: 4px; }
.af-radio {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text-body);
  cursor: pointer;
}
.af-radio input[type="radio"] { accent-color: var(--gold); }

.af-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

/* Quill editor — restyle the default "snow" theme so it matches the dark admin */
.ql-toolbar.ql-snow {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line-strong);
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
}
.ql-toolbar.ql-snow .ql-stroke { stroke: var(--text-body); }
.ql-toolbar.ql-snow .ql-fill   { fill:   var(--text-body); }
.ql-toolbar.ql-snow .ql-picker-label,
.ql-toolbar.ql-snow .ql-picker-item { color: var(--text-body); }
.ql-toolbar.ql-snow button:hover .ql-stroke,
.ql-toolbar.ql-snow button.ql-active .ql-stroke,
.ql-toolbar.ql-snow .ql-picker-label:hover .ql-stroke { stroke: var(--gold-light); }
.ql-toolbar.ql-snow button:hover .ql-fill,
.ql-toolbar.ql-snow button.ql-active .ql-fill { fill: var(--gold-light); }
.ql-toolbar.ql-snow .ql-picker-options {
  background: var(--navy-2);
  border-color: var(--line-strong);
}

.ql-container.ql-snow {
  background: var(--bg-input);
  border: 1px solid var(--line-strong);
  border-radius: 0 0 3px 3px;
  color: #fff;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 16px;
  line-height: 1.55;
}
.ql-editor {
  min-height: 420px;
  padding: 18px 20px;
}
.ql-editor.ql-blank::before {
  color: var(--text-mute);
  font-style: italic;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
}
.ql-editor h2 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 22px;
  font-weight: 400;
  color: #fff;
  margin-top: 22px;
}
.ql-editor h3 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 18px;
  font-weight: 500;
  color: #fff;
  margin-top: 18px;
}
.ql-editor a { color: var(--gold-light); }
.ql-editor blockquote {
  border-left: 2px solid var(--gold);
  padding-left: 14px;
  color: var(--text-body);
  font-style: italic;
  margin: 14px 0;
}
.ql-snow .ql-tooltip { background: var(--navy-2); border-color: var(--line-strong); color: #fff; box-shadow: 0 4px 14px rgba(0,0,0,0.4); }
.ql-snow .ql-tooltip input[type=text] { background: var(--bg-input); border-color: var(--line-strong); color: #fff; }

.af-err {
  background: rgba(217,119,87,0.12);
  border: 1px solid rgba(217,119,87,0.3);
  padding: 14px 18px;
  margin-bottom: 18px;
  border-radius: 4px;
  color: var(--danger);
}
.af-err ul { margin: 6px 0 0 0; padding-left: 18px; }

/* Hero image upload */
.af-img-preview {
  margin-top: 6px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  max-width: 480px;
}
.af-img-preview img {
  display: block;
  width: 100%;
  height: auto;
}
.af-img-path {
  padding: 6px 10px;
  font-size: 11px;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  color: var(--text-mute);
  background: rgba(255,255,255,0.04);
  border-top: 1px solid var(--line);
  word-break: break-all;
}
.af-img-empty {
  margin-top: 6px;
  margin-bottom: 10px;
  padding: 14px 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 4px;
  color: var(--text-mute);
  font-size: 13px;
  text-align: center;
}
input[type="file"] {
  background: var(--bg-input);
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  color: var(--text-body);
  padding: 8px 12px;
  font: inherit;
  font-size: 13px;
}
input[type="file"]::file-selector-button {
  background: rgba(255,255,255,0.08);
  border: 0;
  color: var(--text-body);
  padding: 6px 12px;
  margin-right: 12px;
  border-radius: 3px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
}
input[type="file"]::file-selector-button:hover {
  background: rgba(201,169,97,0.2);
  color: var(--gold-light);
}

/* ─── Login ─── */
.al {
  max-width: 380px;
  margin: 120px auto;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 36px 32px;
}
.al h1 { font-size: 24px; margin-bottom: 18px; }
.al-form { display: flex; flex-direction: column; gap: 16px; margin-top: 18px; }
.al-form label { display: flex; flex-direction: column; gap: 6px; }
.al-form label span {
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-mute);
}
.al-form input {
  background: var(--bg-input);
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  color: #fff;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
}
.al-form input:focus { outline: 0; border-color: var(--gold); }
.al-err {
  background: rgba(217,119,87,0.12);
  border: 1px solid rgba(217,119,87,0.3);
  padding: 10px 14px;
  border-radius: 4px;
  color: var(--danger);
  font-size: 13px;
}
.al-info {
  font-size: 13px;
  color: var(--text-mute);
  line-height: 1.5;
  margin-top: 14px;
}
.al-info code {
  background: rgba(255,255,255,0.08);
  padding: 1px 6px;
  border-radius: 3px;
}
.al-forgot {
  margin-top: 18px;
  text-align: center;
  font-size: 12px;
}
.al-forgot a { color: var(--text-mute); }
.al-forgot a:hover { color: var(--gold-light); }

/* ─── Mobile ─── */
@media (max-width: 720px) {
  .ah { padding: 12px 18px; }
  .ah-nav { gap: 12px; }
  .am { padding: 20px 18px; }
  .af-grid { grid-template-columns: 1fr; padding: 18px; gap: 14px; }
  .af-wide, .af-full { grid-column: span 1; }
  .al-table th:nth-child(2),
  .al-table td:nth-child(2) { display: none; }
  .al-actions { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
  .al-actions .ab + .ab,
  .al-actions .ab + form { margin-left: 0; }
}
