/* Shared design system: components, typography and responsive helpers. Brand colors match the Tailwind config in base.html. */

:root {
  --brand-500: #4a5df5;
  --brand-600: #3640d6;
  --brand-gradient: linear-gradient(135deg, #4a5df5 0%, #7c3aed 50%, #ec4899 100%);
  --shadow-soft: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 16px rgba(15, 23, 42, 0.06);
  --shadow-lift: 0 2px 4px rgba(15, 23, 42, 0.05), 0 12px 32px rgba(15, 23, 42, 0.1);
}

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }
body { overflow-x: clip; text-rendering: optimizeLegibility; }
h1, h2, h3, .font-display { font-family: "Plus Jakarta Sans", "Inter", ui-sans-serif, system-ui, sans-serif; letter-spacing: -0.015em; }
img, video, svg { max-width: 100%; }
input.flex-1, select.flex-1, textarea.flex-1 { min-width: 0; }
.grid > * { min-width: 0; }
::selection { background: rgba(74, 93, 245, 0.2); }
:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; min-height: 2.75rem; padding: 0.625rem 1.25rem; border-radius: 0.75rem; font-size: 0.875rem; font-weight: 600; line-height: 1.25; transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease, border-color 0.2s ease, background-color 0.2s ease; cursor: pointer; text-align: center; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background-image: var(--brand-gradient); color: #fff; box-shadow: 0 8px 24px rgba(74, 93, 245, 0.28); }
.btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 12px 30px rgba(74, 93, 245, 0.38); }
.btn-secondary { background: #fff; color: #1e293b; border: 1px solid #cbd5e1; }
.btn-secondary:hover { border-color: var(--brand-500); color: var(--brand-600); }
.btn-ghost { color: #475569; }
.btn-ghost:hover { background: #f1f5f9; color: #0f172a; }

/* Surfaces */
.card { background: #fff; border: 1px solid #e2e8f0; border-radius: 1rem; box-shadow: var(--shadow-soft); }
.card-hover { transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease; }
.card-hover:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); border-color: #c6d1ff; }
.glass { background: rgba(255, 255, 255, 0.75); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }

/* Forms: 16px font on small screens prevents iOS zoom-on-focus */
.input { width: 100%; min-height: 2.75rem; padding: 0.5rem 1rem; border: 1px solid #cbd5e1; border-radius: 0.75rem; background: #fff; font-size: 1rem; outline: none; transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.input:focus { border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(74, 93, 245, 0.2); }
@media (min-width: 640px) { .input { font-size: 0.875rem; } }
@media (max-width: 767px) { input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]), select, textarea { font-size: 16px !important; } }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.125rem 0.625rem; border-radius: 999px; font-size: 0.6875rem; font-weight: 600; background: #e2e8ff; color: #2b31ab; }

/* Tables: scroll horizontally inside the wrapper instead of breaking the page */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap > table { min-width: 36rem; }
.table-wrap thead th { white-space: nowrap; }

/* Page container with fluid gutters */
.container-page { width: 100%; max-width: 80rem; margin-inline: auto; padding-inline: 1rem; }
@media (min-width: 640px) { .container-page { padding-inline: 1.5rem; } }
@media (min-width: 1024px) { .container-page { padding-inline: 2rem; } }

/* Toasts (flash messages) */
.toast-stack { position: fixed; top: 0.75rem; left: 0.75rem; right: 0.75rem; z-index: 100; display: flex; flex-direction: column; gap: 0.5rem; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: 0.75rem; width: 100%; max-width: 32rem; padding: 0.75rem 1rem; border-radius: 0.875rem; font-size: 0.875rem; box-shadow: var(--shadow-lift); animation: toast-in 0.3s ease both; }
.toast-success { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.toast-error { background: #fff1f2; color: #be123c; border: 1px solid #fecdd3; }
.toast-close { flex: none; font-size: 1.25rem; line-height: 1; opacity: 0.6; padding: 0 0.25rem; }
.toast-close:hover { opacity: 1; }
.toast.is-leaving { opacity: 0; transform: translateY(-8px); transition: opacity 0.25s ease, transform 0.25s ease; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* Skeleton loader */
.skeleton { background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 37%, #e2e8f0 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 0.5rem; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* Empty state */
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; padding: 2.5rem 1rem; text-align: center; color: #64748b; border: 1px dashed #cbd5e1; border-radius: 1rem; background: #fff; }

/* Standalone public-page headers: shrink the oversized logo and drop the negative margin on phones */
@media (max-width: 767px) {
  .\-ml-4 { margin-left: 0; }
  .\-ml-4 img.h-20 { height: 3rem; }
  header .mx-auto.max-w-6xl.px-6.py-5, header .mx-auto.max-w-5xl.px-6.py-5 { padding-inline: 1rem; padding-block: 0.5rem; }
}

/* Safe-area support for notched phones */
.safe-bottom { padding-bottom: max(1rem, env(safe-area-inset-bottom)); }

/* Dashboard off-canvas sidebar (below lg) */
body.drawer-locked { overflow: hidden; }
.dash-backdrop { opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }
.dash-backdrop.is-open { opacity: 1; pointer-events: auto; }
@media (max-width: 1023px) {
  .dash-sidebar { transform: translateX(-100%); transition: transform 0.3s ease; }
  .dash-sidebar.is-open { transform: translateX(0); }
}
@media (prefers-reduced-motion: reduce) { .dash-sidebar, .dash-backdrop { transition: none; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, .card-hover, .toast, .skeleton { transition: none; animation: none; }
}
