/* ═══════════════════════════════════════════
   REALCE — Admin Panel
   Navy #043566 · Green #3F6320 · Gold #BF9440
   ═══════════════════════════════════════════ */

:root {
  --navy:    #043566;
  --green:   #3F6320;
  --gold:    #BF9440;
  --gold-d:  #9e7932;
  --ink:     #1A1A1A;
  --mid:     #555;
  --muted:   #999;
  --bg:      #F4F6F9;
  --white:   #ffffff;
  --border:  #e2e8f0;
  --danger:  #dc2626;
  --success: #16a34a;
  --radius:  12px;
  --font:    'Inter', system-ui, sans-serif;
  --shadow:  0 4px 20px -8px rgba(4,53,102,0.14);
}

*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
[hidden] { display:none !important; }
html { font-size: 15px; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); min-height: 100vh; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font-family: var(--font); cursor: pointer; }
input, textarea, select { font-family: var(--font); font-size: 0.95rem; }

/* ── Auth overlay ── */
.auth-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: var(--navy);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.auth-box {
  background: var(--white); border-radius: 20px;
  padding: 48px 40px; width: 100%; max-width: 380px;
  text-align: center; box-shadow: 0 32px 80px -16px rgba(0,0,0,0.4);
}
.auth-logo { height: 100px; width: auto; margin: 0 auto 24px; }
.auth-box h1 { font-size: 1.3rem; color: var(--navy); margin-bottom: 6px; }
.auth-box > p { color: var(--muted); font-size: 0.88rem; margin-bottom: 28px; }
#authForm { display: flex; flex-direction: column; gap: 12px; }
#passInput {
  width: 100%; padding: 13px 16px; border: 1.5px solid var(--border);
  border-radius: var(--radius); font-size: 1rem; text-align: center;
  letter-spacing: 0.15em; transition: border-color 0.2s, box-shadow 0.2s;
}
#passInput:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(4,53,102,0.1); }
#authForm button {
  background: var(--navy); color: #fff; border: 0;
  padding: 13px; border-radius: var(--radius); font-size: 1rem; font-weight: 600;
  transition: background 0.2s, transform 0.15s;
}
#authForm button:hover { background: #032a52; transform: translateY(-1px); }
.auth-err { color: var(--danger); font-size: 0.82rem; margin-top: 10px; min-height: 18px; }

/* ── Layout ── */
.admin-wrap { display: flex; flex-direction: column; min-height: 100vh; }

/* ── Header ── */
.admin-header {
  background: var(--navy); height: 58px;
  display: flex; align-items: center; gap: 14px;
  padding: 0 24px; position: sticky; top: 0; z-index: 40;
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}
.admin-logo { height: 30px; width: auto; filter: brightness(0) invert(1); opacity: 0.9; }
.admin-badge {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  background: var(--gold); color: #fff; padding: 3px 10px; border-radius: 100px;
}
.admin-header-right { display: flex; align-items: center; gap: 16px; margin-left: auto; }
.header-link { color: rgba(255,255,255,0.65); font-size: 0.84rem; font-weight: 500; transition: color 0.2s; }
.header-link:hover { color: #fff; }
.logout-btn {
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.25);
  color: rgba(255,255,255,0.8); padding: 7px 16px; border-radius: 100px;
  font-size: 0.82rem; font-weight: 600; transition: background 0.2s;
}
.logout-btn:hover { background: rgba(255,255,255,0.2); color: #fff; }

/* ── Tabs ── */
.admin-tabs {
  display: flex; gap: 0; background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}
.atab {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 20px; font-size: 0.9rem; font-weight: 600;
  color: var(--muted); background: none; border: 0;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color 0.2s, border-color 0.2s;
}
.atab svg { opacity: 0.6; transition: opacity 0.2s; }
.atab:hover { color: var(--navy); }
.atab.active { color: var(--navy); border-bottom-color: var(--gold); }
.atab.active svg { opacity: 1; }

/* ── Main ── */
.admin-main { flex: 1; padding: 28px 24px; max-width: 860px; width: 100%; margin: 0 auto; }
.tab-panel { display: flex; flex-direction: column; gap: 24px; }
.tab-panel.hidden { display: none; }

/* ── Panel header ── */
.panel-header h2 { font-size: 1.3rem; color: var(--navy); margin-bottom: 4px; }
.panel-header p  { color: var(--muted); font-size: 0.88rem; }

/* ── Upload card ── */
.upload-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: 16px; overflow: hidden;
}
.drop-zone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 40px 24px; cursor: pointer;
  border: 2px dashed var(--border); border-radius: 16px; margin: 0;
  transition: border-color 0.2s, background 0.2s;
}
.drop-zone:hover, .drop-zone.dragging {
  border-color: var(--gold); background: rgba(191,148,64,0.04);
}
.drop-zone svg { color: var(--muted); }
.drop-label { font-size: 0.95rem; font-weight: 600; color: var(--navy); }
.drop-sub   { font-size: 0.82rem; color: var(--muted); }

.upload-fields { padding: 20px 24px 24px; display: flex; flex-direction: column; gap: 16px; }
.file-preview {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; background: var(--bg); border-radius: 10px;
  font-size: 0.88rem; color: var(--navy); font-weight: 500;
}
.file-preview svg { color: var(--gold); flex-shrink: 0; }

/* ── Form fields ── */
.field-group { display: flex; flex-direction: column; gap: 6px; }
.field-group label {
  font-size: 0.78rem; font-weight: 600; color: var(--mid);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.field-group label span { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--muted); }
.field-group input[type=text],
.field-group input[type=number],
.field-group input[type=password],
.field-group textarea {
  padding: 11px 14px; border: 1.5px solid var(--border); border-radius: 10px;
  font-size: 0.95rem; color: var(--ink); background: var(--white);
  transition: border-color 0.2s, box-shadow 0.2s; resize: vertical;
}
.field-group input:focus,
.field-group textarea:focus {
  outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(191,148,64,0.12);
}
.field-row { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: start; }
.field-check { flex-direction: row; align-items: center; gap: 10px; }
.field-check label { text-transform: none; letter-spacing: 0; font-size: 0.9rem; font-weight: 500; color: var(--ink); }
.field-check input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--navy); cursor: pointer; }

/* ── Upload actions ── */
.upload-actions { display: flex; gap: 10px; justify-content: flex-end; }
.btn-cancel {
  padding: 10px 20px; border-radius: 100px; border: 1.5px solid var(--border);
  background: none; color: var(--mid); font-size: 0.88rem; font-weight: 600;
  transition: border-color 0.2s, color 0.2s;
}
.btn-cancel:hover { border-color: var(--ink); color: var(--ink); }
.btn-primary-admin {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 22px; border-radius: 100px; border: 0;
  background: var(--navy); color: #fff; font-size: 0.9rem; font-weight: 600;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 6px 18px -6px rgba(4,53,102,0.45);
}
.btn-primary-admin:hover { background: #032a52; transform: translateY(-1px); box-shadow: 0 10px 24px -6px rgba(4,53,102,0.55); }
.btn-primary-admin:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-primary-admin.full { width: 100%; justify-content: center; }

/* ── Progress ── */
.progress-wrap { display: flex; flex-direction: column; gap: 8px; }
.progress-bar { height: 6px; background: var(--border); border-radius: 100px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--gold); border-radius: 100px; transition: width 0.3s; }
.progress-label { font-size: 0.8rem; color: var(--mid); text-align: center; }

/* ── List header ── */
.list-header h3 { font-size: 1rem; color: var(--navy); font-weight: 700; }
.count {
  display: inline-block; background: var(--bg); border: 1px solid var(--border);
  color: var(--mid); font-size: 0.72rem; font-weight: 700; padding: 2px 8px;
  border-radius: 100px; margin-left: 8px; vertical-align: middle;
}
.list-empty { color: var(--muted); font-size: 0.9rem; padding: 20px 0; }

/* ── Video list ── */
.video-list { display: flex; flex-direction: column; gap: 10px; }
.video-item {
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; align-items: center; gap: 16px; padding: 14px 16px;
  transition: border-color 0.2s;
}
.video-item:hover { border-color: rgba(4,53,102,0.25); }
.video-thumb {
  width: 80px; height: 52px; border-radius: 8px; background: var(--navy);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; overflow: hidden;
}
.video-thumb video { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.video-thumb svg { color: rgba(255,255,255,0.5); }
.video-info { flex: 1; min-width: 0; }
.video-name { font-size: 0.92rem; font-weight: 600; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.video-url  { font-size: 0.75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.video-order-badge {
  font-size: 0.72rem; font-weight: 700; color: var(--mid);
  background: var(--bg); border: 1px solid var(--border);
  padding: 2px 8px; border-radius: 100px; flex-shrink: 0;
}
.item-del {
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border);
  background: none; color: var(--muted); display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, color 0.2s, border-color 0.2s; flex-shrink: 0;
}
.item-del:hover { background: #fee2e2; border-color: #fca5a5; color: var(--danger); }

/* ── Review form card ── */
.review-form-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: 16px; padding: 24px;
}
.review-form-card h3 { font-size: 1rem; color: var(--navy); margin-bottom: 20px; font-weight: 700; }
#reviewForm { display: flex; flex-direction: column; gap: 16px; }

/* ── Star picker ── */
.star-picker { display: flex; gap: 4px; }
.star-btn {
  font-size: 1.8rem; background: none; border: 0; color: var(--border);
  line-height: 1; padding: 2px; transition: color 0.15s, transform 0.1s;
}
.star-btn:hover, .star-btn.active { color: var(--gold); }
.star-btn:active { transform: scale(0.9); }

/* ── Review list ── */
.review-list { display: flex; flex-direction: column; gap: 10px; }
.review-item {
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; display: flex; gap: 14px; transition: border-color 0.2s;
}
.review-item:hover { border-color: rgba(4,53,102,0.25); }
.review-item-body { flex: 1; min-width: 0; }
.review-item-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.review-item-name { font-size: 0.9rem; font-weight: 700; color: var(--navy); }
.review-item-date { font-size: 0.78rem; color: var(--muted); }
.review-item-stars { color: var(--gold); font-size: 0.85rem; letter-spacing: 2px; margin-bottom: 6px; }
.review-item-text { font-size: 0.88rem; color: var(--mid); line-height: 1.6; }
.featured-badge {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  background: rgba(63,99,32,0.12); color: var(--green); border: 1px solid rgba(63,99,32,0.3);
  padding: 2px 8px; border-radius: 100px;
}
.review-item-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; flex-shrink: 0; }
.toggle-featured {
  font-size: 0.72rem; font-weight: 600; border: 1px solid var(--border);
  background: none; color: var(--mid); padding: 5px 12px; border-radius: 100px;
  transition: all 0.2s; white-space: nowrap;
}
.toggle-featured:hover { border-color: var(--green); color: var(--green); }
.toggle-featured.active { background: rgba(63,99,32,0.08); border-color: rgba(63,99,32,0.4); color: var(--green); }

/* ── Content editor ── */
.cs-block {
  background: var(--white); border: 1px solid var(--border);
  border-radius: 16px; overflow: hidden; margin-bottom: 18px;
}
.cs-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  background: #fbfcfe;
}
.cs-head h3 { font-size: 0.98rem; color: var(--navy); font-weight: 700; }
.btn-save-sec {
  padding: 8px 18px; border-radius: 100px; border: 0;
  background: var(--navy); color: #fff; font-size: 0.82rem; font-weight: 600;
  transition: background 0.2s, transform 0.15s;
}
.btn-save-sec:hover { background: #032a52; transform: translateY(-1px); }
.btn-save-sec:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.cs-fields { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.cs-card {
  border: 1px solid var(--border); border-radius: 12px; padding: 16px;
  display: flex; flex-direction: column; gap: 12px; background: #fcfdff;
}
.cs-card-label {
  font-size: 0.78rem; font-weight: 700; color: var(--gold-d);
  text-transform: uppercase; letter-spacing: 0.06em;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.cs-fields textarea, .cs-fields input[type=text] {
  padding: 10px 13px; border: 1.5px solid var(--border); border-radius: 9px;
  font-size: 0.92rem; color: var(--ink); background: var(--white);
  transition: border-color 0.2s, box-shadow 0.2s; resize: vertical; width: 100%;
}
.cs-fields textarea:focus, .cs-fields input:focus {
  outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(191,148,64,0.12);
}

/* ── Toast notification ── */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: var(--ink); color: #fff; padding: 12px 24px; border-radius: 100px;
  font-size: 0.88rem; font-weight: 500; white-space: nowrap;
  transition: transform 0.35s cubic-bezier(.34,1.56,.64,1), opacity 0.35s;
  opacity: 0; pointer-events: none; z-index: 99;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }

/* ── Responsive ── */
* { -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
@media (max-width: 600px) {
  .admin-main { padding: 20px 16px; }
  .admin-header { padding: 0 16px; gap: 10px; }
  .admin-logo { height: 26px; }
  .header-link { display: none; }
  .admin-tabs  { padding: 0 16px; }
  .atab { padding: 12px 14px; font-size: 0.84rem; }
  .auth-box { padding: 36px 24px; }
  .upload-fields { padding: 16px; }
  .field-row { grid-template-columns: 1fr; }
  .video-item { flex-wrap: wrap; }
  .video-thumb { width: 100%; height: 120px; }
  .review-item { flex-direction: column; }
  .review-item-actions { flex-direction: row; }
  /* 16px inputs prevent iOS zoom on focus */
  .field-group input, .field-group textarea, .field-group select,
  .cs-fields input, .cs-fields textarea, #passInput { font-size: 16px; }
  /* Stack section save buttons under their heading */
  .cs-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .btn-save-sec { width: 100%; }
}
