/* ============================================================
   File:        admin-styles.css
   Purpose:     Styles for the Pendleton Plantation admin page.
                Consistent with the main site palette.
   ============================================================ */

:root {
  --forest:     #2c3d2e;
  --moss:       #4a6741;
  --gold:       #c9a84c;
  --cream:      #f5f0e8;
  --parchment:  #ede5d0;
  --warm-white: #faf8f3;
  --ink:        #1e2620;
  --muted:      #7a7060;
  --blush:      #d4b896;
  --danger:     #c0392b;
  --success:    #27ae60;
  --warning:    #e67e22;
  --info:       #2980b9;
}

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

body {
  font-family: 'Jost', 'Segoe UI', sans-serif;
  background: var(--warm-white);
  color: var(--ink);
  font-size: 15px;
  min-height: 100vh;
}

/* ── LOGIN SCREEN ─────────────────────────────────────────── */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--forest);
  padding: 20px;
}

.login-card {
  background: var(--cream);
  border-radius: 16px;
  padding: 48px 40px 40px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-logo { font-size: 2.4rem; margin-bottom: 12px; }

.login-card h1 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.8rem;
  color: var(--forest);
  margin-bottom: 4px;
}

.login-card p { color: var(--muted); font-size: 0.88rem; margin-bottom: 28px; }

.login-field { position: relative; margin-bottom: 16px; }

.login-field input {
  width: 100%;
  padding: 13px 16px;
  border: 2px solid var(--parchment);
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
  transition: border-color 0.2s;
  color: var(--ink);
}

.login-field input:focus { outline: none; border-color: var(--gold); }

.login-btn {
  width: 100%;
  padding: 14px;
  background: var(--forest);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}
.login-btn:hover { background: var(--moss); }

.login-error {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 10px;
  min-height: 18px;
}

.login-card.shake { animation: shake 0.35s ease; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-8px); }
  40%      { transform: translateX(8px); }
  60%      { transform: translateX(-6px); }
  80%      { transform: translateX(6px); }
}

/* ── ADMIN LAYOUT ─────────────────────────────────────────── */
#admin-ui { display: none; }

.admin-header {
  background: var(--forest);
  color: #fff;
  padding: 0 28px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.admin-header-brand {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.2rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}
.admin-header-brand span { color: var(--gold); }

.admin-header-right { display: flex; align-items: center; gap: 16px; }

.admin-header-right a {
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 0.85rem;
}
.admin-header-right a:hover { color: #fff; }

.logout-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
}
.logout-btn:hover { background: rgba(255,255,255,0.25); }

/* ── SIDEBAR + CONTENT ────────────────────────────────────── */
.admin-body {
  display: flex;
  min-height: calc(100vh - 60px);
}

.admin-sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--cream);
  border-right: 1px solid var(--parchment);
  padding: 20px 0;
}

.sidebar-section-label {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 14px 20px 6px;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--ink);
  border-left: 3px solid transparent;
  transition: background 0.15s, border-color 0.15s;
  user-select: none;
}
.sidebar-nav-item:hover  { background: var(--parchment); }
.sidebar-nav-item.active {
  background: var(--parchment);
  border-left-color: var(--forest);
  font-weight: 500;
  color: var(--forest);
}
.sidebar-nav-item .nav-icon { font-size: 1.1rem; }

.admin-content {
  flex: 1;
  padding: 32px;
  max-width: 1100px;
}

/* ── PAGE HEADERS ─────────────────────────────────────────── */
.admin-page-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.9rem;
  font-weight: 600;
  color: var(--forest);
  margin-bottom: 6px;
}
.admin-page-subtitle {
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 28px;
}

/* ── PANELS ───────────────────────────────────────────────── */
.admin-panel { display: none; }
.admin-panel.active { display: block; }

/* ── DATA TABLES ──────────────────────────────────────────── */
.admin-table-wrap {
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--parchment);
  overflow: hidden;
  margin-bottom: 24px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.admin-table th {
  background: var(--cream);
  padding: 11px 14px;
  text-align: left;
  font-weight: 500;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--parchment);
}

.admin-table td {
  padding: 11px 14px;
  border-bottom: 1px solid #f0ece4;
  vertical-align: middle;
}

.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: #faf7f2; }

/* ── BADGE PILLS ──────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 0.76rem;
  font-weight: 500;
  text-transform: capitalize;
}
.badge-open        { background: #d4edda; color: #155724; }
.badge-soon        { background: #fff3cd; color: #856404; }
.badge-voting      { background: #cce5ff; color: #004085; }
.badge-deliberating{ background: #fdebd0; color: #784212; }
.badge-awarded     { background: #e2e3e5; color: #383d41; }
.badge-confirmed   { background: #d4edda; color: #155724; }
.badge-tentative   { background: #fff3cd; color: #856404; }
.badge-approved    { background: #d4edda; color: #155724; }
.badge-received    { background: #d4edda; color: #155724; }
.badge-pending     { background: #fff3cd; color: #856404; }
.badge-published   { background: #d4edda; color: #155724; }
.badge-draft       { background: #e2e3e5; color: #383d41; }

/* ── ACTION BUTTONS ───────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  border: none;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  text-decoration: none;
}
.btn:active { transform: scale(0.97); }

.btn-primary   { background: var(--forest); color: #fff; }
.btn-secondary { background: var(--parchment); color: var(--ink); }
.btn-success   { background: var(--success); color: #fff; }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-warning   { background: var(--warning); color: #fff; }
.btn-info      { background: var(--info); color: #fff; }
.btn-sm        { padding: 4px 10px; font-size: 0.78rem; border-radius: 6px; }

.btn:hover { opacity: 0.88; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  align-items: center;
}

/* ── FORMS ────────────────────────────────────────────────── */
.admin-form {
  background: #fff;
  border: 1px solid var(--parchment);
  border-radius: 12px;
  padding: 28px;
  margin-bottom: 24px;
}

.admin-form h3 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.25rem;
  margin-bottom: 20px;
  color: var(--forest);
  border-bottom: 1px solid var(--parchment);
  padding-bottom: 12px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}
.form-full { grid-column: 1 / -1; }

.form-field { display: flex; flex-direction: column; gap: 5px; }

.form-field label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-field input,
.form-field select,
.form-field textarea {
  padding: 9px 12px;
  border: 1.5px solid var(--parchment);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--ink);
  background: #fff;
  transition: border-color 0.2s;
  resize: vertical;
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--gold);
}
.form-field textarea { min-height: 80px; }
.form-field textarea.tall { min-height: 160px; }

.form-field .help {
  font-size: 0.78rem;
  color: var(--muted);
}

/* ── DYNAMIC ROWS (volunteer roles, donation items) ───────── */
.dynamic-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }

.dynamic-row {
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--cream);
  padding: 10px 14px;
  border-radius: 8px;
}
.dynamic-row input {
  flex: 1;
  padding: 7px 10px;
  border: 1.5px solid var(--parchment);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.88rem;
}
.dynamic-row input:focus { outline: none; border-color: var(--gold); }

.dynamic-row .remove-btn {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0 4px;
  line-height: 1;
  flex-shrink: 0;
}

.category-block {
  border: 1px solid var(--parchment);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 14px;
  background: var(--cream);
}
.category-block-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.category-block-header input {
  flex: 1;
  padding: 7px 10px;
  border: 1.5px solid var(--parchment);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
}

/* ── MODAL / CONFIRMATION ─────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-overlay.hidden { display: none; }

.modal-card {
  background: #fff;
  border-radius: 16px;
  padding: 36px 32px 28px;
  max-width: 460px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  text-align: center;
}
.modal-icon    { font-size: 2.4rem; margin-bottom: 14px; }
.modal-title   { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 1.5rem; color: var(--forest); margin-bottom: 10px; }
.modal-body    { color: var(--muted); font-size: 0.9rem; margin-bottom: 24px; line-height: 1.6; }
.modal-actions { display: flex; gap: 12px; justify-content: center; }

/* ── TOAST NOTIFICATIONS ──────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  background: var(--forest);
  color: #fff;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 0.88rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  animation: slideInRight 0.25s ease;
  max-width: 320px;
}
.toast.error   { background: var(--danger); }
.toast.success { background: var(--success); }
.toast.warning { background: var(--warning); }
@keyframes slideInRight {
  from { transform: translateX(80px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── THUMBNAIL GRID ───────────────────────────────────────── */
.thumb-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}
.thumb-grid img {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: 6px;
  border: 2px solid var(--parchment);
}

/* ── SETTINGS ─────────────────────────────────────────────── */
.settings-card {
  background: #fff;
  border: 1px solid var(--parchment);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
}
.settings-card h3 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.1rem;
  color: var(--forest);
  margin-bottom: 16px;
  border-bottom: 1px solid var(--parchment);
  padding-bottom: 10px;
}

/* ── ARCHIVE CARD ─────────────────────────────────────────── */
.archive-card {
  background: #fff;
  border: 2px solid #fdebd0;
  border-radius: 12px;
  padding: 28px;
  margin-bottom: 24px;
}
.archive-card h3 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.2rem;
  color: var(--warning);
  margin-bottom: 10px;
}

/* ── EMPTY STATE ──────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
}
.empty-state .empty-icon { font-size: 2.8rem; margin-bottom: 14px; }
.empty-state p { font-size: 0.9rem; }

/* ── LOADING ──────────────────────────────────────────────── */
.admin-loading {
  text-align: center;
  padding: 40px;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ── TOGGLE SWITCH ────────────────────────────────────────── */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}
.toggle {
  position: relative;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--parchment);
  border-radius: 26px;
  cursor: pointer;
  transition: background 0.2s;
}
.toggle-slider::before {
  content: "";
  position: absolute;
  left: 3px; top: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.toggle input:checked + .toggle-slider { background: var(--moss); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }
.toggle-label { font-size: 0.88rem; color: var(--ink); }

/* ── SUBTABS ──────────────────────────────────────────────── */
.subtab-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: var(--parchment);
  padding: 4px;
  border-radius: 10px;
  width: fit-content;
}
.subtab {
  padding: 7px 18px;
  border: none;
  background: transparent;
  border-radius: 7px;
  font-family: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  color: var(--muted);
  transition: background 0.15s, color 0.15s;
}
.subtab.active { background: #fff; color: var(--forest); font-weight: 500; }

/* ── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 900px) {
  .admin-sidebar { display: none; }
  .admin-content { padding: 20px; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .admin-content { padding: 16px; }
  .admin-form { padding: 18px; }
  .modal-card { padding: 24px 20px; }
  .btn-row { flex-direction: column; }
}


/* ── QUILL RICH TEXT EDITOR ───────────────────────────────── */
.rich-toolbar.ql-toolbar.ql-snow {
  border: 1px solid rgba(44,61,46,0.22);
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  background: #f5f2ec;
  padding: 6px 8px;
}
.rich-editor-area.ql-container.ql-snow {
  border: 1px solid rgba(44,61,46,0.22);
  border-radius: 0 0 4px 4px;
  background: #fff;
  min-height: 130px;
  font-family: 'Jost', sans-serif;
  font-size: 0.9rem;
  color: #2c2c2c;
}
.rich-editor-area .ql-editor { min-height: 120px; padding: 10px 12px; }
.rich-editor-area .ql-editor.ql-blank::before { color: #aaa; font-style: italic; }

/* Toolbar icon colors — forest green */
.rich-toolbar .ql-stroke { stroke: #2c3d2e; }
.rich-toolbar .ql-fill   { fill:   #2c3d2e; }
.rich-toolbar .ql-picker  { color:  #2c3d2e; }
.rich-toolbar button:hover .ql-stroke,
.rich-toolbar .ql-picker-label:hover .ql-stroke { stroke: #c9a84c; }
.rich-toolbar button:hover .ql-fill { fill: #c9a84c; }
.rich-toolbar button.ql-active .ql-stroke { stroke: #c9a84c; }
.rich-toolbar button.ql-active .ql-fill   { fill:   #c9a84c; }
.rich-toolbar button.ql-active            { color:  #c9a84c; }

/* Emoji button in toolbar */
.rich-toolbar .ql-emoji-btn {
  font-size: 1rem;
  line-height: 1;
  padding: 2px 5px;
  cursor: pointer;
  border: none;
  background: none;
  border-radius: 3px;
  transition: background 0.15s;
  vertical-align: middle;
}
.rich-toolbar .ql-emoji-btn:hover { background: rgba(201,168,76,0.15); }

/* Emoji picker panel */
#emoji-picker-panel {
  position: absolute;
  z-index: 9999;
  background: #fff;
  border: 1px solid rgba(201,168,76,0.35);
  border-radius: 8px;
  padding: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.13);
  display: none;
  width: 292px;
  max-height: 230px;
  overflow-y: auto;
}
#emoji-picker-panel .ep-label {
  font-size: 0.62rem;
  color: #aaa;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 6px;
  padding: 0 2px;
}
#emoji-picker-panel .ep-btn {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 3px 4px;
  border-radius: 4px;
  transition: background 0.12s;
  line-height: 1;
}
#emoji-picker-panel .ep-btn:hover { background: rgba(201,168,76,0.18); }
