:root {
  --color-primary: #070924;
  --color-secondary: #1a2456;
  --color-accent: #5a80c0;
  --color-accent-warm: #c9a84c;
  --color-accent-earth: #a87850;
  --color-surface: #0f1129;
  --color-surface-raised: #1a1d3a;
  --color-text: #e2e8f0;
  --color-text-muted: #94a3b8;
}

html, body {
  overflow-x: hidden;
}

input, select, textarea {
  font-size: 16px;
}

@media (max-width: 640px) {
  table {
    display: block;
    overflow-x: auto;
  }
}

/* Hero gradient */
.hero-gradient {
  background:
    linear-gradient(135deg, rgba(90, 128, 192, 0.08) 0%, transparent 50%),
    linear-gradient(225deg, rgba(26, 36, 86, 0.12) 0%, transparent 40%),
    linear-gradient(180deg, #0f1129 0%, #070924 100%);
}

/* Page background atmosphere */
body {
  background:
    radial-gradient(ellipse at 20% 0%, rgba(90, 128, 192, 0.04) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 100%, rgba(26, 36, 86, 0.06) 0%, transparent 50%),
    #0f1129;
}

/* Staggered fade-in animation */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-in {
  animation: fadeInUp 0.4s ease-out both;
}
.animate-in:nth-child(2) { animation-delay: 0.08s; }
.animate-in:nth-child(3) { animation-delay: 0.16s; }
.animate-in:nth-child(4) { animation-delay: 0.24s; }
.animate-in:nth-child(5) { animation-delay: 0.32s; }
.animate-in:nth-child(6) { animation-delay: 0.40s; }
.animate-in:nth-child(7) { animation-delay: 0.48s; }
.animate-in:nth-child(8) { animation-delay: 0.56s; }

@media (prefers-reduced-motion: reduce) {
  .animate-in { animation: none; }
}

/* Button visibility fallback */
button[type="submit"] {
  background-color: var(--color-accent, #5a80c0);
  color: #fff;
}

button[type="submit"].bg-red-600 {
  background-color: #dc2626;
}

/* Line clamp utility */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Nav scroll shadow */
#main-nav.scrolled {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* Focus visible styles */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid rgba(90, 128, 192, 0.5);
  outline-offset: 2px;
}

/* Smooth transitions for interactive elements */
a, button {
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

/* Card hover lift */
.hover-lift:hover {
  transform: translateY(-2px);
}

/* Prose dark for content areas */
.prose-dark p {
  color: #cbd5e1;
  line-height: 1.75;
}

/* Custom scrollbar for dark theme */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #0f1129;
}

::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

/* Checkbox styling fix for dark backgrounds */
input[type="checkbox"] {
  accent-color: var(--color-accent);
}

/* File input dark mode */
input[type="file"] {
  color: #94a3b8;
}

/* Delete button override - prevent primary styling on inline text-link delete buttons */
form[data-confirm] button[type="submit"]:not([class*="bg-"]),
button[type="submit"].text-red-500:not([class*="bg-"]),
button[type="submit"].text-red-600:not([class*="bg-"]) {
  background: transparent;
  color: #ef4444;
  box-shadow: none;
  font-weight: 500;
  border-radius: 0.375rem;
}
form[data-confirm] button[type="submit"]:not([class*="bg-"]):hover,
button[type="submit"].text-red-500:not([class*="bg-"]):hover,
button[type="submit"].text-red-600:not([class*="bg-"]):hover {
  color: #dc2626;
  background: rgba(239, 68, 68, 0.05);
  transform: none;
  box-shadow: none;
}

/* DELETE_BUTTON_UPGRADE (MW v12): unified destructive style */
form[action*="/delete"] button[type="submit"],
form[action*="/destroy"] button[type="submit"],
button[data-destructive="true"] {
  background: transparent !important;
  color: #ef4444 !important;
  border: 1.5px solid rgba(239, 68, 68, 0.45) !important;
  box-shadow: none !important;
  font-weight: 500 !important;
  transition: background 0.15s, color 0.15s, border-color 0.15s !important;
}
form[action*="/delete"] button[type="submit"]:hover,
form[action*="/destroy"] button[type="submit"]:hover,
button[data-destructive="true"]:hover {
  background: rgba(239, 68, 68, 0.12) !important;
  color: #fca5a5 !important;
  border-color: rgba(239, 68, 68, 0.7) !important;
  transform: none !important;
}
form[action*="/delete"] button[type="submit"]:focus-visible,
form[action*="/destroy"] button[type="submit"]:focus-visible {
  outline: 2px solid rgba(239, 68, 68, 0.5);
  outline-offset: 2px;
}

/* v17-button-system:v1 */
.btn-primary, .btn-secondary, .btn-ghost, .btn-destructive, .btn-warm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.75rem 1.25rem;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 0.9375rem;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.btn-primary:focus-visible, .btn-secondary:focus-visible, .btn-ghost:focus-visible, .btn-destructive:focus-visible, .btn-warm:focus-visible {
  outline: 2px solid var(--color-accent, #5a80c0);
  outline-offset: 2px;
}
.btn-primary {
  background: var(--color-accent, #5a80c0);
  color: #fff;
}
.btn-primary:hover { background: color-mix(in oklab, var(--color-accent, #5a80c0) 85%, #000); }
.btn-secondary {
  background: transparent;
  color: var(--color-text, #e2e8f0);
  border-color: rgba(148, 163, 184, 0.45);
}
.btn-secondary:hover { background: rgba(148, 163, 184, 0.12); border-color: rgba(148, 163, 184, 0.7); }
.btn-ghost {
  background: transparent;
  color: var(--color-text-muted, #94a3b8);
}
.btn-ghost:hover { background: rgba(148, 163, 184, 0.1); color: var(--color-text, #e2e8f0); }
.btn-destructive {
  background: transparent;
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.5);
}
.btn-destructive:hover { background: rgba(248, 113, 113, 0.12); border-color: #f87171; color: #fca5a5; }
.btn-warm {
  background: var(--color-accent-warm, #c9a84c);
  color: #1a1204;
}
.btn-warm:hover { background: color-mix(in oklab, var(--color-accent-warm, #c9a84c) 85%, #000); }
