/* ═══════════════════════════════════════════════════════
   App Shell – shared layout for all authenticated pages
   ═══════════════════════════════════════════════════════ */

/* ── Main layout ── */
.app-shell {
  min-height: calc(100vh - 57px); /* below top nav (h-14 = 56px + 1px border) */
}

/* ── Sidebar (legacy — sidebar moved to page-specific layouts) ── */
.app-sidebar {
  display: none;
}

.app-sidebar-toggle {
  display: none;
}

/* Navigation links */
.app-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.app-sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #64748b;
  text-decoration: none;
  transition: all 0.15s;
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
  text-align: left;
  width: 100%;
}

.app-sidebar-link:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.app-sidebar-link.active {
  background: #eff6ff;
  color: #3b82f6;
}

.app-sidebar-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Section label */
.app-sidebar-section-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  padding: 0.5rem 0.75rem 0.25rem;
}

/* Divider */
.app-sidebar-divider {
  height: 1px;
  background: #e2e8f0;
  margin: 0.5rem 0;
}

/* Spacer */
.app-sidebar-spacer {
  flex: 1;
}

/* Sign out */
.app-sidebar-signout {
  color: #dc2626 !important;
}

.app-sidebar-signout:hover {
  background: #fef2f2 !important;
  color: #dc2626 !important;
}

/* ── Content area ── */
.app-content {
  min-width: 0;
  overflow-x: hidden;
}

/* ── Loading state ── */
.app-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 57px);
  color: #94a3b8;
  font-size: 0.875rem;
  gap: 0.75rem;
}

.app-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #e2e8f0;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: app-spin 0.6s linear infinite;
}

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

/* ── Shared card component ── */
.card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.04);
}

.card-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 1rem;
}

/* ── Panel header ── */
.panel-header {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 1.5rem;
}

/* ── Shared buttons ── */
.btn-save {
  padding: 0.625rem 1.5rem;
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 0.5rem;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-save:hover { background: #2563eb; }
.btn-save:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-outline {
  padding: 0.625rem 1.5rem;
  background: white;
  color: #3b82f6;
  border: 1px solid #3b82f6;
  border-radius: 0.5rem;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-outline:hover { background: #eff6ff; }

.btn-danger {
  padding: 0.625rem 1.5rem;
  background: white;
  color: #dc2626;
  border: 1px solid #fecaca;
  border-radius: 0.5rem;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-danger:hover { background: #fef2f2; }

/* ── Shared form styles ── */
.form-group { margin-bottom: 1.25rem; }

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #475569;
  margin-bottom: 0.375rem;
}

.form-input {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  font-family: inherit;
  font-size: 0.875rem;
  color: #1e293b;
  background: #fff;
  box-sizing: border-box;
  transition: border-color 0.15s;
}

.form-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgb(59 130 246 / 0.1);
}

.form-input:disabled {
  background: #f8fafc;
  color: #94a3b8;
}

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

@media (max-width: 480px) {
  .form-row { grid-template-columns: 1fr; }
}

/* ── Toast notifications ── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  box-shadow: 0 4px 12px rgb(0 0 0 / 0.15);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s;
  z-index: 100;
}
.toast.visible { transform: translateY(0); opacity: 1; }
.toast-success { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.toast-error { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.toast-info { background: #eff6ff; color: #3b82f6; border: 1px solid #bfdbfe; }

/* ── Mobile sidebar ── */
.app-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 40;
}
.app-sidebar-backdrop.visible { display: block; }

.app-sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 0.5rem;
  border: none;
  background: none;
  color: #64748b;
  cursor: pointer;
  margin-right: 0.5rem;
  transition: all 0.15s;
}
.app-sidebar-toggle:hover { background: #f1f5f9; color: #1e293b; }

@media (max-width: 768px) {
  .app-content {
    padding: 1.25rem;
  }
}

/* ── Pagination ── */
.pagination {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  margin-top: 16px; padding: 8px 0; font-size: 13px; font-family: inherit;
}
.pagination-info {
  color: #6b7280; margin-right: 12px; font-size: 12px;
}
.pagination-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; height: 32px; padding: 0 8px;
  border: 1px solid #e5e7eb; border-radius: 6px;
  background: #fff; color: #374151; cursor: pointer;
  font-size: 13px; font-weight: 500; font-family: inherit;
  transition: all 0.15s;
}
.pagination-btn:hover:not(:disabled):not(.pagination-btn--active) { background: #f3f4f6; border-color: #d1d5db; }
.pagination-btn--active { background: #3b82f6; color: #fff; border-color: #3b82f6; }
.pagination-btn:disabled { opacity: 0.4; cursor: default; }
.pagination-ellipsis { color: #9ca3af; padding: 0 4px; }
