/* ─── Custom Properties ─────────────────────────────────────────────────── */
:root {
  --blue:       #4A8EC2;
  --blue-dark:  #2F6A9A;
  --green:      #4CAF82;
  --green-dark: #2E8B60;
  --gold:       #F5A623;
  --red:        #E53E3E;
  --text:       #2C3A4A;
  --text-muted: #6B7A8D;
  --border:     #E4EAF0;
  --surface:    #F7F9FC;
  --white:      #FFFFFF;
  --sidebar-w:  230px;
  --topbar-h:   60px;
  --shadow-sm:  0 2px 8px rgba(0,0,0,.06);
  --shadow:     0 4px 20px rgba(0,0,0,.09);
  --radius:     12px;
  --radius-sm:  8px;
}

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

body {
  font-family: 'Open Sans', sans-serif;
  background: var(--surface);
  color: var(--text);
  line-height: 1.65;
}

/* ─── Login ──────────────────────────────────────────────────────────────── */
.login-overlay {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
  padding: 2rem;
}

.login-card {
  background: var(--white);
  border-radius: 20px;
  padding: 3rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,.18);
  text-align: center;
}

.login-emoji { font-size: 3.25rem; margin-bottom: .9rem; line-height: 1; }

.login-card h1 {
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 1.65rem;
  margin-bottom: .4rem;
}

.login-sub { color: var(--text-muted); margin-bottom: 1.75rem; font-size: .9rem; }

.back-link {
  display: block;
  margin-top: 1.5rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: .85rem;
  transition: color .15s;
}

.back-link:hover { color: var(--blue); }

/* ─── Form elements ──────────────────────────────────────────────────────── */
.fg { display: flex; flex-direction: column; }

.fg label {
  font-weight: 600;
  font-size: .82rem;
  margin-bottom: .4rem;
  color: var(--text);
  text-align: left;
}

.fg input,
.fg textarea {
  width: 100%;
  padding: .7rem .95rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Open Sans', sans-serif;
  font-size: .88rem;
  color: var(--text);
  background: var(--white);
  transition: border-color .18s, box-shadow .18s;
  resize: vertical;
}

.fg input:focus,
.fg textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(74,142,194,.15);
}

.field-hint {
  font-size: .76rem;
  color: var(--text-muted);
  margin-top: .3rem;
  margin-bottom: .4rem;
  display: block;
}

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .65rem 1.4rem;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: .88rem;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, transform .15s;
}

.btn-primary { background: var(--blue); color: var(--white); }
.btn-primary:hover { background: var(--blue-dark); }

.btn-block { width: 100%; margin-top: .5rem; }

.btn-save { background: var(--green); color: var(--white); padding: .55rem 1.4rem; }
.btn-save:hover { background: var(--green-dark); }

/* ─── Alert ──────────────────────────────────────────────────────────────── */
.alert {
  border-radius: var(--radius-sm);
  padding: .7rem 1rem;
  font-size: .85rem;
  margin-bottom: .75rem;
  text-align: left;
}

.alert-error { background: #FEE2E2; color: #991B1B; }

/* ─── Admin shell layout ─────────────────────────────────────────────────── */
.admin-shell {
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: #1E2E14;   /* dark Hundred Acre Wood forest */
  color: rgba(255,255,255,.8);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sb-header {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: 1.4rem 1.2rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.sb-emoji { font-size: 1.5rem; line-height: 1; }

.sb-title {
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: .9rem;
  color: var(--white);
  line-height: 1.2;
}

.sb-sub { font-size: .68rem; opacity: .55; }

.sb-nav {
  flex: 1;
  padding: .75rem 0;
  display: flex;
  flex-direction: column;
  gap: .2rem;
}

.sb-item {
  display: flex;
  align-items: center;
  gap: .65rem;
  width: 100%;
  padding: .72rem 1.2rem;
  background: none;
  border: none;
  color: rgba(255,255,255,.6);
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: .88rem;
  cursor: pointer;
  text-align: left;
  border-left: 3px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
}

.sb-item:hover {
  background: rgba(255,255,255,.07);
  color: var(--white);
}

.sb-item.active {
  background: rgba(74,142,194,.25);
  color: var(--white);
  border-left-color: var(--blue);
}

.sb-footer {
  padding: 1.2rem;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

.sb-view-btn {
  display: block;
  text-align: center;
  padding: .55rem;
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.85);
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: .82rem;
  transition: background .15s;
}

.sb-view-btn:hover { background: rgba(255,255,255,.18); }

.sb-logout-btn {
  width: 100%;
  padding: .55rem;
  background: none;
  border: 1px solid rgba(255,255,255,.2);
  color: rgba(255,255,255,.5);
  border-radius: var(--radius-sm);
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: .82rem;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.sb-logout-btn:hover { background: rgba(255,255,255,.08); color: rgba(255,255,255,.8); }

/* ─── Main area ──────────────────────────────────────────────────────────── */
.admin-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  height: var(--topbar-h);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
}

.topbar h2 {
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 1.15rem;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.save-status {
  font-size: .82rem;
  font-weight: 600;
  min-width: 120px;
  text-align: right;
  transition: color .2s;
}

.save-status.saving { color: var(--text-muted); }
.save-status.success { color: var(--green); }
.save-status.error   { color: var(--red); }

/* ─── Editor wrap ────────────────────────────────────────────────────────── */
.editor-wrap {
  flex: 1;
  padding: 2rem;
  max-width: 860px;
}

.editor-section { display: none; }
.editor-section.active { display: block; }

/* Groups */
.group {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.group h3 {
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: .95rem;
  color: var(--text);
  padding-bottom: .75rem;
  margin-bottom: 1.2rem;
  border-bottom: 2px solid var(--surface);
}

.group-dashed {
  border: 2px dashed var(--border);
  background: var(--surface);
}

.hint {
  font-size: .82rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 1rem;
}

/* Two-column field grid */
.field-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* Comparison fields */
.compare-fields {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1rem;
  align-items: start;
}

.compare-divider {
  font-size: 1.5rem;
  color: var(--gold);
  font-weight: 900;
  padding-top: 2rem;
  text-align: center;
}

/* Multimedia tabs */
.media-tabs {
  display: flex;
  gap: .4rem;
  margin-bottom: 1rem;
}

.mtab {
  padding: .42rem 1.1rem;
  border: 2px solid var(--border);
  background: var(--white);
  border-radius: 50px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: .8rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s;
}

.mtab.active {
  background: var(--blue);
  border-color: var(--blue);
  color: var(--white);
}

.mpanel { display: none; }
.mpanel.active { display: block; }

/* Code block */
.code-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  font-family: 'Courier New', monospace;
  font-size: .85rem;
  color: var(--text);
  margin-top: .75rem;
  word-break: break-all;
}

code {
  background: var(--border);
  padding: .1em .35em;
  border-radius: 3px;
  font-size: .85em;
  font-family: 'Courier New', monospace;
}

/* ─── Photo upload ───────────────────────────────────────────────────────── */
.photo-upload-area {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

.photo-preview-ring {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  border: 3px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  cursor: pointer;
  background: var(--surface);
  font-size: 2.75rem;
  transition: border-color .18s, box-shadow .18s;
}

.photo-preview-ring:hover {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(74,142,194,.12);
}

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

.photo-upload-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .6rem;
}

.btn-upload-photo {
  background: var(--blue);
  color: var(--white);
}

.btn-upload-photo:hover { background: var(--blue-dark); }

.btn-remove-photo {
  background: none;
  border: 1.5px solid #E53E3E;
  color: #E53E3E;
  font-size: .82rem;
  padding: .4rem 1rem;
}

.btn-remove-photo:hover { background: #FEE2E2; }

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
  }

  .admin-main { margin-left: 0; }

  .admin-shell {
    flex-direction: column;
    min-height: auto;
  }

  .field-grid-2,
  .compare-fields {
    grid-template-columns: 1fr;
  }

  .compare-divider { display: none; }

  .editor-wrap { padding: 1rem; }
  .topbar { padding: 0 1rem; }
}
