/* ============================================================================
   Admin console — light-themed, functional layout
   ============================================================================
   Extends styles.css conventions, matching QSheet+/Q&A v2 admin styling.
   All admin pages carry body.admin + data-admin-page.
   ============================================================================ */

body.admin {
  background: #f3f4f6;
  color: #111827;
  min-height: 100vh;
}

.admin-main {
  max-width: 64rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
}

/* --- Brand bar ------------------------------------------------------------ */

.admin-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}
.admin-brand img {
  max-height: 40px;
  width: auto;
}
.admin-titles {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  flex: 1;
}
.admin-client {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.01em;
}
.admin-subtitle {
  font-size: 0.8rem;
  color: var(--muted);
}

.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
}

/* --- Banner (admin pages use banner-error, not banner.error) -------------- */

.banner.banner-error   { background: #fef2f2; border-color: #fecaca; color: var(--danger); }
.banner.banner-success { background: #f0fdf4; border-color: #bbf7d0; color: var(--success); }
.banner.banner-info    { background: #f8fafc; border-color: var(--border); color: var(--muted); }

/* --- Buttons -------------------------------------------------------------- */

.btn {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s;
  text-align: center;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { opacity: 0.88; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: var(--accent);
}
.btn-secondary {
  background: #fff;
  color: #374151;
  border: 1px solid var(--border) !important;
}
.btn-secondary:hover:not(:disabled) { background: #f9fafb; }

.btn-ghost {
  background: transparent;
  color: #6b7280;
  border: 1px solid var(--border) !important;
}
.btn-ghost:hover:not(:disabled) { background: #f3f4f6; }

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.82rem;
}

/* --- Password gate (index.html) -------------------------------------------- */

.admin-gate {
  max-width: 26rem;
  margin: 5rem auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
}
.admin-gate p {
  margin: 0 0 1.25rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.admin-gate form {
  gap: 0.85rem;
}
.admin-gate button {
  width: 100%;
  margin-top: 0.25rem;
}

/* --- Section layout (dashboard.html, project.html) ------------------------ */

.admin-section {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.admin-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
}
.admin-section-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

/* --- Tables ----------------------------------------------------------------- */

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.admin-table thead {
  background: #f9fafb;
}
.admin-table th {
  padding: 0.6rem 1rem;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.admin-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover { background: #f9fafb; }
.admin-table code {
  font-size: 0.82rem;
  background: #f3f4f6;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
}

/* --- Status badges ----------------------------------------------------------- */

.status-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-draft  { background: #f3f4f6; color: #4b5563; }
.badge-active { background: #d1fae5; color: #065f46; }
.badge-closed { background: #fee2e2; color: #991b1b; }

/* Availability status badges (Responses) */
.badge-available  { background: #d1fae5; color: #065f46; }
.badge-tentative  { background: #fef3c7; color: #92400e; }
.badge-unavailable { background: #fee2e2; color: #991b1b; }
.badge-noresponse { background: #f3f4f6; color: #6b7280; }

/* --- Table action links ----------------------------------------------------- */

.action-link {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.25rem 0.55rem;
  border-radius: 4px;
  text-decoration: none;
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, #fff);
  border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent);
  white-space: nowrap;
  transition: opacity 0.12s;
}
.action-link:hover { opacity: 0.75; }
.action-btn { cursor: pointer; font-family: inherit; }

/* --- Empty state -------------------------------------------------------------- */

.admin-empty {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 2.5rem 1rem;
}

/* --- Form layout (new-project) ------------------------------------------------ */

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.form-section {
  padding: 1.5rem 1.75rem;
  border-bottom: 1px solid var(--border);
}
.form-section:last-child { border-bottom: none; }

.form-section h2 {
  margin: 0 0 1.1rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.field-row {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 1rem;
}
.field-row:last-child { margin-bottom: 0; }
.field-row label { font-weight: 500; font-size: 0.9rem; }
.field-row small.field-hint {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 400;
}
.field-row .required { color: var(--danger); margin-left: 0.15rem; }

.section-hint {
  margin: -0.5rem 0 1rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 1.25rem 1.75rem;
  background: #f9fafb;
  border-top: 1px solid var(--border);
}

/* --- Footer ------------------------------------------------------------------- */

.bsp-footer { margin-top: 2rem; }

.admin-footer {
  text-align: center;
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--muted);
}

/* --- Responsive ----------------------------------------------------------- */

@media (max-width: 640px) {
  .admin-brand { flex-wrap: wrap; }
  .admin-header-actions { width: 100%; justify-content: flex-end; }
  .form-section { padding: 1.25rem 1rem; }
  .form-actions { padding: 1rem; }
  .admin-table th, .admin-table td { padding: 0.6rem 0.75rem; }
}
