/* ── Admin Panel CSS ───────────────────────────────────────────────────────── */

/* Inherits custom properties from safari.css */

/* ── Layout ── */

.admin-body {
  display: flex;
  min-height: 100vh;
  background: #f4f1eb;
}

/* ── Sidebar ── */

.admin-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--dusk);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  transition: transform 0.3s ease;
  z-index: 200;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0 1.5rem 1.5rem;
  color: var(--savanna);
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 700;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 0.5rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0;
}

.sidebar-nav a {
  padding: 0.75rem 1.5rem;
  color: var(--sand);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: background var(--transition), color var(--transition);
  border-left: 3px solid transparent;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--savanna);
  border-left-color: var(--savanna);
}

.sidebar-nav .logout-link {
  margin-top: auto;
  color: #e07070;
}

.sidebar-nav .logout-link:hover {
  background: rgba(220, 80, 80, 0.15);
  color: #f08080;
  border-left-color: #f08080;
}

/* ── Main content area ── */

.admin-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.admin-topbar {
  background: #fff;
  border-bottom: 1px solid #e0d8cc;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.admin-page-title {
  font-size: 1.3rem;
  color: var(--earth);
  font-family: 'Playfair Display', serif;
}

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--earth);
  padding: 0.2rem 0.4rem;
}

.admin-main {
  padding: 2rem;
  flex: 1;
}

/* ── Stats grid ── */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1.2rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 1.4rem 1.2rem;
  text-align: center;
  box-shadow: var(--shadow);
  border-top: 4px solid var(--sand);
  transition: transform var(--transition);
}

.stat-card:hover {
  transform: translateY(-3px);
}

.stat-card.highlight {
  border-top-color: var(--savanna);
}

.stat-icon {
  font-size: 1.8rem;
  margin-bottom: 0.4rem;
}

.stat-value {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--earth);
}

.stat-label {
  font-size: 0.8rem;
  color: #888;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 0.2rem;
}

/* ── Dashboard actions ── */

.dashboard-actions {
  margin-bottom: 1.5rem;
}

/* ── Table ── */

.admin-table-wrap {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

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

.admin-table thead {
  background: var(--dusk);
  color: var(--sand);
}

.admin-table th {
  padding: 0.9rem 1rem;
  text-align: left;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.admin-table tbody tr {
  border-bottom: 1px solid #f0ebe0;
  transition: background var(--transition);
}

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

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

.admin-table td {
  padding: 0.85rem 1rem;
  vertical-align: middle;
}

.row-claimed {
  opacity: 0.75;
}

.td-image {
  width: 64px;
}

.admin-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
}

.admin-thumb-placeholder {
  width: 56px;
  height: 56px;
  background: var(--sand);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.td-price {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  color: var(--clay);
  font-weight: 700;
}

.td-actions {
  white-space: nowrap;
}

/* ── Badges ── */

.badge {
  background: var(--sand);
  color: var(--earth);
  padding: 0.2rem 0.6rem;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 700;
}

.status-badge {
  display: inline-block;
  padding: 0.25rem 0.7rem;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-badge.claimed {
  background: #d4edda;
  color: #155724;
}

.status-badge.available {
  background: #fff3cd;
  color: #856404;
}

/* ── Small action buttons ── */

.btn-sm {
  padding: 0.35rem 0.8rem;
  font-size: 0.78rem;
  border-radius: 6px;
  margin-right: 0.25rem;
}

.btn-edit {
  background: var(--leaf);
  color: #fff;
}

.btn-edit:hover {
  background: var(--forest);
}

.btn-claim {
  background: var(--savanna);
  color: var(--night);
}

.btn-claim:hover {
  background: var(--clay);
  color: #fff;
}

.btn-unclaim {
  background: #f0ad4e;
  color: var(--night);
}

.btn-unclaim:hover {
  background: #e69500;
}

.btn-delete {
  background: #dc3545;
  color: #fff;
}

.btn-delete:hover {
  background: #b02a37;
}

/* ── Forms ── */

.form-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  max-width: 900px;
}

.form-card-narrow {
  max-width: 480px;
}

.item-form {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--earth);
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="password"],
.form-group textarea {
  padding: 0.65rem 0.9rem;
  border: 2px solid #e0d8cc;
  border-radius: 8px;
  font-family: 'Lato', sans-serif;
  font-size: 0.95rem;
  color: var(--night);
  background: #fdfaf5;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--savanna);
  box-shadow: 0 0 0 3px rgba(232, 169, 77, 0.2);
}

.form-group textarea {
  resize: vertical;
}

.file-input {
  padding: 0.5rem 0;
  font-family: 'Lato', sans-serif;
  font-size: 0.9rem;
  cursor: pointer;
}

.current-image-preview,
.image-preview-wrap {
  margin: 0.5rem 0;
}

.form-image-preview {
  max-width: 220px;
  max-height: 160px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid #e0d8cc;
  display: block;
  margin-bottom: 0.3rem;
}

.form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
}

.btn-full {
  width: 100%;
  justify-content: center;
  padding: 0.85rem;
  font-size: 1rem;
}

/* ── Login page ── */

.admin-login-body {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--dusk) 0%, var(--earth) 60%, var(--clay) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-container {
  width: 100%;
  max-width: 400px;
}

.login-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.big-icon {
  font-size: 3.5rem;
  display: block;
  margin-bottom: 0.5rem;
}

.login-logo h1 {
  font-size: 1.6rem;
  color: var(--earth);
}

.login-logo p {
  color: #888;
  font-size: 0.9rem;
  margin-top: 0.2rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.back-link {
  display: block;
  text-align: center;
  margin-top: 1.2rem;
  color: #888;
  font-size: 0.85rem;
  text-decoration: none;
}

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

/* ── Flash messages (admin) ── */

.flash-messages {
  margin-bottom: 1.5rem;
}

/* ── Text editor ── */

.text-editor-form {
  gap: 1.5rem;
}

.text-editor-intro,
.text-editor-section {
  max-width: none;
}

.text-editor-intro {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
}

.text-editor-intro-copy h2,
.text-editor-section-header h2 {
  font-family: 'Playfair Display', serif;
  color: var(--earth);
  margin-bottom: 0.4rem;
}

.text-editor-intro-copy p,
.text-editor-section-header p {
  margin: 0;
  color: #6e6558;
}

.text-editor-note {
  font-size: 0.9rem;
}

.text-editor-actions {
  margin-top: 0;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.text-editor-section {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.text-editor-group {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.text-editor-group-title {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--clay);
}

.text-editor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem 1.2rem;
}

.text-editor-field label {
  font-family: monospace;
  font-size: 0.82rem;
}

.text-editor-field textarea {
  min-height: 5.5rem;
}

.text-editor-field-hint {
  color: #8a6d3b;
  font-size: 0.8rem;
}

/* ── Responsive ── */

@media (max-width: 900px) {
  .admin-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    height: 100dvh;
  }

  .admin-sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 30px rgba(0, 0, 0, 0.3);
  }

  .sidebar-toggle {
    display: block;
  }

  .text-editor-intro {
    flex-direction: column;
  }

  .admin-main {
    padding: 1.2rem;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .admin-table {
    font-size: 0.8rem;
  }

  .admin-table th,
  .admin-table td {
    padding: 0.65rem 0.7rem;
  }
}

@media (max-width: 600px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .td-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
  }
}
