/* ============================================================
   Vincelléri Napló — admin page styles
   Illuminated-manuscript voice. Companions to the public style.css.
   ============================================================ */

:root {
  --gold:        #b89958;
  --gold-deep:   #8a7034;
  --gold-soft:   #d8c89a;
  --ink:         #3a2f22;
  --ink-soft:    #6b5840;
  --parchment:   #fdf8ec;
  --parchment-2: #f6eed8;
  --burgundy:    #6a1c1c;
}

html, body { margin: 0; padding: 0; }

.admin-body {
  font-family: 'Cormorant Garamond', serif;
  background:
    radial-gradient(circle at 15% 10%, rgba(184,153,88,0.08), transparent 50%),
    radial-gradient(circle at 85% 30%, rgba(184,153,88,0.06), transparent 60%),
    radial-gradient(circle at 50% 90%, rgba(140,90,40,0.05), transparent 70%),
    var(--parchment);
  color: var(--ink);
  min-height: 100vh;
  padding: 0 0 4rem;
}

/* ---------- Hero ---------- */
.admin-hero {
  position: relative;
  margin: 0 auto;
  padding: 0;
  max-width: 1280px;
  overflow: hidden;
  isolation: isolate;
}
.admin-hero img {
  display: block;
  width: 100%;
  height: auto;
  min-height: 320px;
  max-height: 520px;
  object-fit: cover;
  object-position: center 40%;
}
/* Vignette + bottom darken — gives the title scroll a calm base */
.admin-hero-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, rgba(0,0,0,0) 50%, rgba(58,47,34,0.45) 100%),
    linear-gradient(180deg,
      rgba(58, 47, 34, 0.2) 0%,
      rgba(58, 47, 34, 0.0) 30%,
      rgba(58, 47, 34, 0.0) 60%,
      rgba(58, 47, 34, 0.35) 100%);
}
/* The cartouche — a floating illuminated title scroll, centered over the image */
.admin-cartouche {
  position: absolute;
  left: 50%;
  bottom: 6%;
  transform: translateX(-50%);
  width: min(620px, calc(100% - 2.4rem));
  padding: 1.5rem 2rem 1.7rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(253, 246, 223, 0.97), rgba(245, 234, 200, 0.94));
  border: 1px solid var(--gold);
  border-radius: 2px;
  box-shadow:
    inset 0 0 0 4px rgba(253, 246, 223, 0.9),
    inset 0 0 0 5px var(--gold-soft),
    0 10px 30px rgba(58, 47, 34, 0.35),
    0 2px 4px rgba(58, 47, 34, 0.2);
  color: var(--ink);
}
.admin-cartouche::before,
.admin-cartouche::after {
  content: "❦";
  position: absolute;
  color: var(--gold);
  font-size: 1.1rem;
  opacity: 0.9;
}
.admin-cartouche::before { top: 0.55rem; left: 0.85rem; }
.admin-cartouche::after { top: 0.55rem; right: 0.85rem; }
.admin-cartouche-eyebrow,
.admin-cartouche-subtitle {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: clamp(0.85rem, 1.4vw, 1rem);
  color: var(--ink-soft);
  letter-spacing: 0.22em;
  text-transform: lowercase;
}
.admin-cartouche h1 {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-style: italic;
  font-size: clamp(2.2rem, 5.6vw, 3.6rem);
  margin: 0.1rem 0;
  color: var(--ink);
  letter-spacing: 0.03em;
  line-height: 1.05;
}
.admin-cartouche-rule {
  margin-top: 0.3rem;
  color: var(--gold);
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}
.admin-cartouche-rule::before,
.admin-cartouche-rule::after {
  content: "";
  display: inline-block;
  width: 3rem;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--gold), transparent);
}

/* Logged-in chip — discrete icon in top-right of hero */
.admin-who {
  position: absolute;
  top: 0.9rem;
  right: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.4rem 0.85rem;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 0.95rem;
  background: rgba(58, 47, 34, 0.7);
  color: #fdf6df;
  border: 1px solid rgba(216, 200, 154, 0.5);
  border-radius: 999px;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
  z-index: 2;
}
.who-greet { opacity: 0.85; }
#logout-btn {
  background: transparent;
  color: #fdf6df;
  border: 1px solid rgba(253, 246, 223, 0.6);
  border-radius: 999px;
  padding: 0;
  width: 28px;
  height: 28px;
  min-height: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: serif;
  font-size: 0.9rem;
  letter-spacing: 0;
  transition: background 200ms ease, transform 200ms ease;
}
#logout-btn:hover {
  background: rgba(253, 246, 223, 0.2);
  border-color: rgba(253, 246, 223, 0.95);
  transform: rotate(-10deg);
}

/* ---------- Page width wrapper ---------- */
main,
.admin-footer {
  max-width: 920px;
  margin-left: auto;
  margin-right: auto;
}
main {
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

/* ---------- Main ---------- */
main { margin-top: 1.6rem; }
section { margin-bottom: 2rem; }

.section-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.7rem;
  color: var(--ink);
  margin: 0 0 0.5rem;
  letter-spacing: 0.03em;
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 0.15em;
}
.section-title-dropcap {
  font-family: 'UnifrakturMaguntia', 'Playfair Display', serif;
  color: var(--gold-deep);
  font-size: 2.4em;
  line-height: 0.85;
  margin-right: 0.05em;
  vertical-align: -0.15em;
  text-shadow: 1px 1px 0 rgba(253, 246, 223, 0.9);
  display: inline-block;
  transform: translateY(0.12em);
}
.lede-dropcap {
  font-family: 'UnifrakturMaguntia', 'Playfair Display', serif;
  color: var(--gold-deep);
  font-size: 3em;
  line-height: 0.85;
  float: left;
  padding: 0.15em 0.15em 0 0;
  margin-top: 0.1em;
}
.lede {
  font-style: italic;
  color: var(--ink-soft);
  margin: 0 0 1rem;
  font-size: 1rem;
}

/* ---------- Parchment card (used by login + each details) ---------- */
.parchment {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255, 250, 235, 0.85), rgba(246, 238, 216, 0.65));
  border: 1px solid var(--gold-soft);
  border-radius: 4px;
  padding: 1.4rem 1.4rem;
  margin-bottom: 1.4rem;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.5) inset,
    0 8px 24px rgba(140,100,40,0.06);
}
.parchment-corner {
  position: absolute;
  font-size: 0.95rem;
  color: var(--gold);
  opacity: 0.7;
  pointer-events: none;
}
.parchment-corner-tl { top: 0.5rem; left: 0.7rem; }
.parchment-corner-tr { top: 0.5rem; right: 0.7rem; }
.parchment-corner-bl { bottom: 0.5rem; left: 0.7rem; }
.parchment-corner-br { bottom: 0.5rem; right: 0.7rem; }

/* ---------- Details/summary (collapsible parchment) ---------- */
details.parchment { padding: 0.4rem 1.4rem; }
details.parchment[open] { padding-bottom: 1.4rem; }
summary {
  cursor: pointer;
  list-style: none;
  font-family: 'Playfair Display', serif;
  font-size: 1.25rem;
  color: var(--ink);
  padding: 0.8rem 0;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  letter-spacing: 0.02em;
}
summary::-webkit-details-marker { display: none; }
summary::after {
  content: "›";
  margin-left: auto;
  font-size: 1.4rem;
  color: var(--gold);
  transition: transform 200ms ease;
}
details[open] summary::after { transform: rotate(90deg); }
.summary-glyph {
  color: var(--gold);
  font-size: 1.1rem;
}

/* ---------- Grape divider ---------- */
.grape-divider {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.6rem;
  margin: 1.8rem 0 1.8rem;
  position: relative;
}
.grape-divider::before,
.grape-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--gold-soft), transparent);
}
.grape-divider img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 0.4rem;
  box-shadow: 0 0 0 1px var(--gold-soft), 0 6px 18px rgba(140,100,40,0.18);
}
.grape-divider-label {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 0.95rem;
  color: var(--ink-soft);
  letter-spacing: 0.06em;
  white-space: nowrap;
}

/* ---------- Forms ---------- */
.inline-form {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.8rem;
  flex-wrap: wrap;
}
.stacked-form {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin-top: 0.8rem;
}
.stacked-form label {
  display: flex;
  flex-direction: column;
  font-size: 0.95rem;
  gap: 0.25rem;
  color: var(--ink-soft);
  font-style: italic;
  letter-spacing: 0.03em;
}
input, select, textarea, button {
  font-family: inherit;
  font-size: 1rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--gold-soft);
  border-radius: 3px;
  background: rgba(255,255,255,0.85);
  color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(184,153,88,0.18);
  background: white;
}
textarea { resize: vertical; }
button {
  background: var(--gold);
  color: white;
  cursor: pointer;
  border: none;
  font-family: 'Playfair Display', serif;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  padding: 0.55rem 1rem;
}
button:hover { background: var(--gold-deep); }
.hint { font-style: italic; color: var(--ink-soft); font-size: 0.9rem; margin-top: 0.2rem; }
.msg { padding: 0.6rem 0.9rem; border-radius: 3px; margin-top: 0.6rem; font-style: italic; }
.msg.ok { background: #e8f0d8; color: #2c4a16; }
.msg.error { background: #f4d4d4; color: #6a1c1c; }

/* ---------- Records ---------- */
.records-section { padding: 1.4rem 1.4rem 1.6rem; }
.records-table-wrap { overflow-x: auto; }
.records-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.6rem;
  font-family: 'Cormorant Garamond', serif;
}
.records-table th {
  text-align: left;
  font-family: 'Playfair Display', serif;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--gold);
  color: var(--ink-soft);
}
.records-table td {
  padding: 0.5rem 0.7rem;
  border-bottom: 1px dotted rgba(184, 153, 88, 0.4);
  color: var(--ink);
  font-size: 1rem;
}
.records-table tr:hover td { background: rgba(184,153,88,0.05); }
.records-table button.del {
  background: transparent;
  color: var(--burgundy);
  border: 1px solid var(--burgundy);
  padding: 0.25rem 0.6rem;
  font-size: 0.85rem;
  font-family: inherit;
  letter-spacing: 0;
}
.records-table button.del:hover { background: var(--burgundy); color: white; }

/* Empty state */
.records-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 1.8rem 1rem 1rem;
  text-align: center;
}
.records-empty img {
  max-width: min(560px, 100%);
  width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow:
    0 0 0 1px var(--gold-soft),
    inset 0 0 0 3px rgba(253, 246, 223, 0.85),
    0 10px 28px rgba(140, 100, 40, 0.2);
}
.records-empty-text {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  color: var(--ink-soft);
  font-size: 1.15rem;
  line-height: 1.5;
  margin: 0;
}
.records-empty-cta {
  margin-top: 0.6rem;
  background: transparent;
  color: var(--gold-deep);
  border: 1px solid var(--gold);
  padding: 0.55rem 1.3rem;
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 1rem;
  letter-spacing: 0.05em;
  border-radius: 999px;
  cursor: pointer;
  transition: background 200ms ease, color 200ms ease;
}
.records-empty-cta:hover { background: var(--gold); color: #fbf3dc; }

/* ---------- Blocks list ---------- */
#blocks-list { list-style: none; padding: 0; margin: 0.4rem 0 0; }
#blocks-list li {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px dotted rgba(184,153,88,0.3);
  color: var(--ink);
  font-size: 1.05rem;
}
#blocks-list li:last-child { border-bottom: 0; }
#blocks-list li::before {
  content: "❦";
  color: var(--gold);
  font-size: 0.9rem;
  opacity: 0.85;
  margin-right: 0.1rem;
}
.block-name {
  font-family: 'Playfair Display', serif;
  font-weight: 600;
}
.block-meta {
  font-style: italic;
  color: var(--ink-soft);
  font-size: 0.95rem;
}
#blocks-list .retire-btn {
  background: transparent;
  color: var(--burgundy);
  border: 1px solid var(--burgundy);
  padding: 0.25rem 0.7rem;
  font-size: 0.85rem;
  font-family: inherit;
  margin-left: auto;
  border-radius: 999px;
  font-style: italic;
}
#blocks-list .retire-btn:hover { background: var(--burgundy); color: white; }

/* ---------- Footer ---------- */
.admin-footer {
  text-align: center;
  color: var(--ink-soft);
  font-style: italic;
  margin-top: 3rem;
  padding-top: 1.5rem;
}
.admin-footer .vine-divider {
  width: 200px;
  height: 20px;
  color: var(--gold);
  margin-bottom: 0.5rem;
}
.admin-footer p { margin: 0; }

/* ============================================================
   Mobile
   ============================================================ */
@media (max-width: 768px) {
  .admin-hero img { min-height: 280px; max-height: 380px; }
  .admin-cartouche {
    width: calc(100% - 1.6rem);
    padding: 1.1rem 1.2rem 1.3rem;
    bottom: 1rem;
  }
  .admin-cartouche::before,
  .admin-cartouche::after { font-size: 0.95rem; }
  .admin-cartouche h1 { font-size: clamp(1.8rem, 9vw, 2.6rem); }
  .admin-cartouche-eyebrow,
  .admin-cartouche-subtitle { font-size: 0.78rem; letter-spacing: 0.16em; }
  .admin-cartouche-rule::before,
  .admin-cartouche-rule::after { width: 1.8rem; }
  .admin-who { top: 0.6rem; right: 0.6rem; padding: 0.25rem 0.55rem; font-size: 0.85rem; gap: 0.4rem; }
  #logout-btn { width: 22px; height: 22px; font-size: 0.75rem; }

  main { padding-left: 1rem; padding-right: 1rem; }

  .parchment, .records-section { padding: 1.1rem 1rem; }
  details.parchment { padding: 0.2rem 1rem; }
  details.parchment[open] { padding-bottom: 1.1rem; }

  .section-title { font-size: 1.35rem; }
  summary { font-size: 1.1rem; padding: 0.6rem 0; }
  .grape-divider img { width: 64px; height: 64px; margin: 0 0.3rem; }
  .grape-divider-label { font-size: 0.85rem; }

  /* Stack the block-add row vertically so the inputs don't squeeze */
  .inline-form { flex-direction: column; gap: 0.4rem; }
  .inline-form input,
  .inline-form button { width: 100%; }

  /* Tap targets */
  input, select, textarea, button { font-size: 1rem; min-height: 44px; }
  textarea { min-height: 80px; }
  button { padding: 0.65rem 0.9rem; }

  /* Records table */
  .records-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .records-table { min-width: 540px; }
  .records-table th, .records-table td { padding: 0.5rem 0.55rem; font-size: 0.95rem; }
  .records-table button.del { padding: 0.35rem 0.6rem; min-height: 36px; }

  /* Blocks list — retire button below name */
  #blocks-list li { flex-direction: column; align-items: flex-start; gap: 0.3rem; padding: 0.55rem 0; }
  #blocks-list .retire-btn { margin-left: 0; padding: 0.3rem 0.6rem; min-height: 36px; }
}

@media (max-width: 420px) {
  .admin-hero img { min-height: 220px; max-height: 280px; }
  .admin-cartouche h1 { font-size: 1.8rem; }
  .admin-cartouche-eyebrow,
  .admin-cartouche-subtitle { font-size: 0.75rem; letter-spacing: 0.12em; }
  .parchment, .records-section { padding: 1rem 0.85rem; }
  .records-empty img { max-width: 100%; }
  .records-empty-text { font-size: 1rem; }
  /* Hide the side labels on the divider — keep just the cluster */
  .grape-divider-label { display: none; }
}

/* Subtle entrance */
@media (prefers-reduced-motion: no-preference) {
  .admin-hero,
  .parchment,
  .grape-divider,
  .records-empty {
    animation: adminFadeUp 800ms ease-out both;
  }
  @keyframes adminFadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
  }
}
