/* ---------- Palette & Fonts ---------- */
:root{
  --font-head:"Marcellus",serif;
  --font-body:"Manrope",sans-serif;

  --bg:#F7F3ED;        /* Fantasy */
  --surface:#EFD8D6;   /* Vanilla Ice */
  --muted:#C2C6B9;     /* Silver Sand */
  --accent:#DBA1A2;    /* Rose */
  --ink:#422B23;       /* Tobago */
}

/* ---------- Base Reset ---------- */
*{box-sizing:border-box;margin:0;padding:0}
html{scroll-behavior:smooth}
body{
  font-family:var(--font-body);
  background:var(--bg);
  color:var(--ink);
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
}
button{font:inherit}

/* Focus styles */
:focus-visible{
  outline:3px solid rgba(219,161,162,.6);
  outline-offset:2px;
  border-radius:8px;
}

/* ---------- Header ---------- */
.admin-header{
  background:var(--ink);
  color:var(--bg);
  padding:20px 40px;
  display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;
  box-shadow:0 2px 8px rgba(66,43,35,.15);
}
.admin-header h1{
  font-family:var(--font-head);
  font-size:28px; letter-spacing:.2px;
}

/* Logout button: light on dark header */
.logout-btn{
  background:var(--bg);
  color:var(--ink);
  border:1px solid color-mix(in oklab, var(--bg) 70%, var(--ink));
  padding:10px 18px;border-radius:10px;
  font-weight:700;cursor:pointer;
  transition:background-color .2s,border-color .2s,box-shadow .2s,transform .05s;
  margin-top:10px;
}
.logout-btn:hover{
  background:color-mix(in oklab, var(--bg) 85%, white);
  border-color:var(--accent);
  box-shadow:0 0 0 3px rgba(219,161,162,.35);
}
.logout-btn:active{ transform:scale(.99) }

/* ---------- Container ---------- */
.admin-container{ padding:40px }

/* ---------- Nav (section tabs) ---------- */
nav{
  margin-left:10px;margin-bottom:40px;
  display:flex;flex-wrap:wrap;gap:10px;justify-content:flex-start;
}
.admin-link{
  background:var(--surface);
  color:var(--ink);
  border:1px solid var(--muted);
  padding:10px 16px;border-radius:10px;font-weight:600;
  transition:background-color .2s,color .2s,border-color .2s,box-shadow .2s;
  text-decoration:none; display:inline-block; cursor:pointer;
}
.admin-link:hover{
  background:var(--bg);
  border-color:var(--accent);
  box-shadow:0 0 0 3px rgba(219,161,162,.25);
}
.admin-link.active{
  background:var(--ink);
  color:var(--bg);
  border-color:var(--ink);
}

/* ---------- Section ---------- */
.admin-section{ margin-left:10px }
.admin-section h2{
  margin-bottom:20px;
  font-family:var(--font-head);
  color:var(--ink);
  position:relative;
}
.admin-section h2::after{
  content:"";
  display:block;width:56px;height:3px;margin-top:8px;
  background:var(--accent);border-radius:2px;
}

/* ---------- Table ---------- */
.admin-table-wrap{
  overflow-x:auto; -webkit-overflow-scrolling:touch;
  border:1px solid var(--muted);
  border-radius:12px;
  background:#fff;
  box-shadow:0 2px 8px rgba(66,43,35,.06);
}
.admin-table{
  width:100%;
  border-collapse:collapse;
  min-width:720px; /* triggers horizontal scroll on small screens */
}
.admin-table th, .admin-table td{
  text-align:left; padding:14px 18px; border-bottom:1px solid var(--muted);
}
.admin-table thead{ background:var(--surface) }
.admin-table thead th{ position:sticky; top:0; z-index:1 }
.admin-table tbody tr:hover{ background:var(--bg) }

/* ---------- Toast ---------- */
.toast-message{
  position:fixed; bottom:30px; right:30px;
  background:var(--ink); color:var(--bg);
  padding:12px 18px; border-radius:10px; opacity:0;
  transition:opacity .3s ease-in-out, transform .2s;
  box-shadow:0 6px 18px rgba(66,43,35,.18);
}
.toast-message.show{ opacity:1; transform:translateY(-4px) }
.toast-message.error{ background:var(--accent); color:var(--ink) }
.toast-message.info{ background:var(--muted); color:var(--ink) }

/* ===========================
   Mobile enhancements ≤ 786px
   =========================== */
@media (max-width: 786px){

  /* Layout & spacing */
  .admin-container{ padding:16px }
  .admin-section{ margin-left:0 }
  .admin-header{
    flex-direction:column; align-items:flex-start; gap:10px;
    padding:16px 16px 12px;
  }
  .admin-header h1{ font-size:22px; line-height:1.2 }
  .logout-btn{ align-self:stretch; padding:12px 14px; border-radius:12px }

  /* Tabs / nav: scrollable chips */
  nav{
    margin-left:0; margin-bottom:20px;
    overflow-x:auto; -webkit-overflow-scrolling:touch;
    gap:8px; padding:4px 2px; scroll-snap-type:x proximity;
  }
  nav::-webkit-scrollbar{ display:none }
  .admin-link{
    white-space:nowrap; scroll-snap-align:start;
    padding:10px 14px; border-radius:999px; /* chip */
    display:inline-flex; align-items:center; gap:8px;
  }
  .admin-link.active{ box-shadow:0 0 0 3px rgba(219,161,162,.25) }

  /* Table: horizontal scroll + denser */
  .admin-table{ font-size:14px }
  .admin-table th, .admin-table td{ padding:12px 14px }

  /* Toast: centered */
  .toast-message{
    left:50%; right:auto; bottom:20px; top:auto;
    transform:translateX(-50%); max-width:92vw; text-align:center;
    padding:12px 16px; font-size:14px;
  }
}

/* ==========================================
   OPTIONAL: Stacked card table for phones
   Add class="stack" to .admin-table and
   data-label="Column Name" on each <td>.
   ========================================== */
@media (max-width: 786px){
  .admin-table.stack{ min-width:0 } /* allow stacking */
  .admin-table.stack thead{ display:none }
  .admin-table.stack,
  .admin-table.stack tbody,
  .admin-table.stack tr,
  .admin-table.stack td{ display:block; width:100% }

  .admin-table.stack tr{
    margin:0 0 12px; background:#fff;
    border:1px solid var(--muted); border-radius:12px;
    box-shadow:0 2px 8px rgba(66,43,35,.06); overflow:hidden;
  }
  .admin-table.stack td{
    border-bottom:1px solid var(--muted);
    padding:10px 14px;
  }
  .admin-table.stack tr td:last-child{ border-bottom:none }

  .admin-table.stack td::before{
    content:attr(data-label);
    display:block; margin-bottom:4px;
    font-size:.72rem; color:var(--muted);
    text-transform:uppercase; letter-spacing:.04em;
  }
}

/* Tiny phones ≤ 480px */
@media (max-width: 480px){
  .admin-header h1{ font-size:20px }
  .admin-link{ padding:8px 12px; font-size:.9rem ;border-radius: 8px;}
  .logout-btn{ padding:8px 12px; font-size:.9rem ;max-width: 30%; margin-left: 14rem; border-radius: 8px; }
  .admin-table{ font-size:13px;border-radius:48px; }
}
