/* =====================================================================
   ADMIN PANEL STYLES
   ===================================================================== */

:root {
  --sidebar-bg: #c0272d;
  --sidebar-text: rgba(255, 255, 255, 0.85);
  --sidebar-hover: rgba(255, 255, 255, 0.12);
  --sidebar-active-border: #ffffff;
  --accent: #c0272d;
  --accent-dark: #9b1e23;
  --bg: #f0f2f5;
  --white: #ffffff;
  --border: #d8dce3;
  --text: #1a1a2e;
  --text-muted: #6b7280;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #d97706;
  --radius: 6px;
  --shadow: 0 2px 8px rgba(0,0,0,0.10);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.14);
}

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
}

/* ── LOGIN SCREEN ────────────────────────────────────────────────── */

#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}

.login-card {
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 48px 40px;
  width: 360px;
  text-align: center;
}

.login-card .journal-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--sidebar-bg);
  margin-bottom: 4px;
}

.login-card .login-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 32px;
}

.login-card h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 24px;
  color: var(--text);
}

.google-signin-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.google-signin-btn:hover {
  background: #f8f9fa;
  border-color: #adb5bd;
}

.google-signin-btn svg {
  flex-shrink: 0;
}

#login-error {
  margin-top: 16px;
  padding: 10px 14px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  color: var(--danger);
  font-size: 13px;
  display: none;
}

/* ── ADMIN SHELL ─────────────────────────────────────────────────── */

#admin-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── SIDEBAR ─────────────────────────────────────────────────────── */

.admin-sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
  line-height: 1.3;
}

.sidebar-brand-sub {
  font-size: 11px;
  color: rgba(255,255,255,0.45);
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  color: var(--sidebar-text);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: background 0.12s;
  user-select: none;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--white);
}

.nav-item.active {
  background: rgba(181, 18, 27, 0.15);
  border-left-color: var(--sidebar-active-border);
  color: var(--white);
}

.nav-item .nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.sidebar-bottom {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-user-email {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  margin-bottom: 10px;
  word-break: break-all;
}

.btn-signout {
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius);
  color: rgba(255,255,255,0.7);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.12s;
}
.btn-signout:hover {
  background: rgba(255,255,255,0.08);
  color: var(--white);
}

/* ── CONTENT AREA ────────────────────────────────────────────────── */

.admin-content {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
  background: var(--bg);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── PAGE HEADERS ────────────────────────────────────────────────── */

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.panel-header h1 {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
  color: var(--text);
}

/* ── CARDS ───────────────────────────────────────────────────────── */

.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 24px;
}

/* ── TABLES ──────────────────────────────────────────────────────── */

.table-wrapper {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

table.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table thead tr {
  background: #f8f9fa;
  border-bottom: 2px solid var(--border);
}

.admin-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.admin-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.admin-table tbody tr:last-child td {
  border-bottom: none;
}

.admin-table tbody tr:nth-child(even) td {
  background: #fafafa;
}

.admin-table tbody tr:hover td {
  background: #f0f4ff;
}

.table-title {
  font-weight: 600;
  color: var(--text);
  max-width: 320px;
}

.table-title small {
  display: block;
  font-weight: 400;
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 2px;
}

/* ── BADGES / PILLS ──────────────────────────────────────────────── */

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
}

.badge-green  { background: #dcfce7; color: #15803d; }
.badge-gray   { background: #f1f5f9; color: #64748b; }
.badge-red    { background: #fee2e2; color: #b91c1c; }
.badge-yellow { background: #fef9c3; color: #92400e; }
.badge-blue   { background: #dbeafe; color: #1d4ed8; }

/* ── ACTION BUTTONS ──────────────────────────────────────────────── */

.action-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  text-decoration: none;
}

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

.btn-secondary {
  background: var(--white);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: #f1f5f9; }

.btn-danger {
  background: var(--white);
  color: var(--danger);
  border: 1px solid #fca5a5;
}
.btn-danger:hover { background: #fee2e2; }

.btn-success {
  background: var(--white);
  color: var(--success);
  border: 1px solid #86efac;
}
.btn-success:hover { background: #dcfce7; }

/* Small pill buttons for table rows */
.btn-sm {
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 4px;
}

/* ── FORMS ───────────────────────────────────────────────────────── */

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="url"],
.form-group input[type="file"],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text);
  background: var(--white);
  transition: border-color 0.12s, box-shadow 0.12s;
  font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(181, 18, 27, 0.12);
}

.form-group input[type="file"] {
  padding: 6px;
  cursor: pointer;
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.form-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.form-check label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
}

.form-actions {
  display: flex;
  gap: 10px;
  padding-top: 8px;
}

/* ── QUILL EDITOR OVERRIDES ──────────────────────────────────────── */

#editor-container {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 400px;
}

.ql-toolbar {
  border-top-left-radius: var(--radius);
  border-top-right-radius: var(--radius);
  border-color: var(--border) !important;
}

.ql-container {
  border-bottom-left-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
  border-color: var(--border) !important;
  font-family: Georgia, serif;
  font-size: 16px;
}

/* ── IMAGE PREVIEW ───────────────────────────────────────────────── */

#image-preview-wrap {
  margin-top: 8px;
}

#image-preview {
  max-width: 240px;
  max-height: 160px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

/* ── ADMIN LIST ──────────────────────────────────────────────────── */

.admin-email-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.admin-email-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.admin-email-item:last-child {
  border-bottom: none;
}

.admin-email-addr {
  font-size: 13px;
  color: var(--text);
}

/* ── NOTICES ─────────────────────────────────────────────────────── */

.notice {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
}

.notice-warning {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  color: #92400e;
}

.notice-info {
  background: #eff6ff;
  border: 1px solid #93c5fd;
  color: #1e40af;
}

/* ── TOAST ───────────────────────────────────────────────────────── */

#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--text);
  color: var(--white);
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  transform: translateY(80px);
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
  pointer-events: none;
}

#toast.show {
  transform: translateY(0);
  opacity: 1;
}

#toast.toast-success { background: var(--success); }
#toast.toast-error   { background: var(--danger); }

/* ── LOADING SPINNER ─────────────────────────────────────────────── */

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(0,0,0,0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
