:root{
  --ui-bg: #f0fdfa;
  --ui-surface: #ffffff;
  --ui-text: #1f2937;
  --ui-muted: #6b7280;
  --ui-primary: #0d9488;
  --ui-primary-dark: #0f766e;
  --ui-success: #059669;
  --ui-error: #dc2626;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.06), 0 2px 4px -2px rgb(0 0 0 / 0.04);
  --shadow-lg: 0 10px 40px -10px rgb(0 0 0 / 0.1);
}

html {
  scroll-behavior: smooth;
}

html, body {
  height: 100%;
}

body {
  color: var(--ui-text);
  background:
    radial-gradient(ellipse 120% 80% at 50% -20%, #ccfbf1, transparent),
    radial-gradient(circle at 80% 50%, rgba(13, 148, 136, 0.06), transparent),
    linear-gradient(180deg, #f0fdfa 0%, #ecfeff 100%);
  min-height: 100%;
}

/* Layout & typography hierarchy */
#root {
  min-width: 0 !important;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: clamp(16px, 4vw, 32px);
}

#root > * {
  animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Section titles */
.text-2xl, .text-3xl {
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.text-gray-600 {
  color: var(--ui-muted) !important;
}

/* Cards & panels */
.bg-white,
.bg-gray-100 {
  border-radius: var(--radius-lg);
  border: 1px solid rgba(229, 231, 235, 0.8);
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.bg-white:hover,
.bg-gray-100:hover {
  box-shadow: var(--shadow-lg);
}

/* Forms – clearer hierarchy & feedback */
input, select, textarea {
  border: 1px solid #e5e7eb;
  border-radius: var(--radius);
  padding: 12px 14px;
  background-color: #fff;
  font-size: 1rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input::placeholder,
textarea::placeholder {
  color: #9ca3af;
}

input:hover:not(:focus):not(:disabled),
select:hover:not(:focus):not(:disabled),
textarea:hover:not(:focus):not(:disabled) {
  border-color: #d1d5db;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--ui-primary);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.18);
}

input:disabled, select:disabled, textarea:disabled {
  background-color: #f9fafb;
  color: var(--ui-muted);
  cursor: not-allowed;
}

/* Buttons – clearer feedback */
button {
  transition: transform 0.12s ease, box-shadow 0.2s ease, background-color 0.2s ease, opacity 0.2s ease;
  font-weight: 500;
  border-radius: var(--radius);
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.25);
}

button:active:not(:disabled) {
  transform: translateY(0);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Primary button styling */
.bg-\[\#6C489C\],
.bg-purple-200.text-white,
.bg-blue-500.text-white,
.bg-purple-200 {
  background-color: var(--ui-primary) !important;
  border: none;
}

.hover\:bg-blue-700:hover,
.hover\:bg-green-700:hover {
  background-color: var(--ui-primary-dark) !important;
}

/* Success / download button */
.bg-green-500 {
  background-color: var(--ui-success) !important;
}

/* Error states */
.text-red-500, .text-red-700 {
  color: var(--ui-error) !important;
}

/* Links & accents */
.border-purple-800 { border-color: var(--ui-primary) !important; }
.text-blue-700 { color: var(--ui-primary-dark) !important; }
a.text-blue-700 { color: var(--ui-primary) !important; }

a.text-blue-700:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.focus\:ring-blue-500:focus,
.focus\:border-blue-500:focus,
.active\:border-blue-500:active {
  border-color: var(--ui-primary) !important;
  --tw-ring-color: rgba(13, 148, 136, 0.4) !important;
}

/* Modal */
.modal {
  width: min(92vw, 50rem);
  max-height: 85vh;
  overflow: auto;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(0,0,0,0.05);
  animation: modalIn 0.25s ease-out;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

/* Improve dialog backdrop */
dialog::backdrop {
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
}

/* Focus visible for keyboard users */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 2px solid var(--ui-primary);
  outline-offset: 2px;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
