@import "tailwindcss/base";
@import "tailwindcss/components";
@import "tailwindcss/utilities";

@theme {
  /* Define colors for Tailwind */
  --color-background: #ffffff;
  --color-foreground: #0f172a;
  --color-card: #ffffff;
  --color-card-foreground: #0f172a;
  --color-popover: #ffffff;
  --color-popover-foreground: #0f172a;
  --color-primary: #800000;
  --color-primary-foreground: #f8fafc;
  --color-secondary: #f1f5f9;
  --color-secondary-foreground: #0f172a;
  --color-muted: #f1f5f9;
  --color-muted-foreground: #64748b;
  --color-accent: #f1f5f9;
  --color-accent-foreground: #0f172a;
  --color-destructive: #800000;
  --color-destructive-foreground: #f8fafc;
  --color-destructive-800: #7b1419;
  --color-border: #e2e8f0;
  --color-input: #e2e8f0;
  --color-ring: #800000;
  --color-emerald-500: #6ccba8;
  --color-emerald-600: #28bf8b;
  
  /* Spacing */
  --spacing-0: 0px;
  --spacing-1: 0.25rem;
  --spacing-2: 0.5rem;
  --spacing-3: 0.75rem;
  --spacing-4: 1rem;
  --spacing-5: 1.25rem;
  --spacing-6: 1.5rem;
  --spacing-8: 2rem;
  --spacing-10: 2.5rem;
  --spacing-12: 3rem;
  
  /* Border radius */
  --radius-none: 0px;
  --radius-sm: 0.125rem;
  --radius: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
  --radius-xl: 0.75rem;
  --radius-2xl: 1rem;
  --radius-full: 9999px;
  
  /* Font sizes */
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  
  /* Animations */
  --animate-accordion-down: accordion-down 0.2s ease-out;
  --animate-accordion-up: accordion-up 0.2s ease-out;
  --animate-fade-in: fade-in 0.2s ease-out;
  --animate-fade-out: fade-out 0.2s ease-out;
  --animate-zoom-in-95: zoom-in-95 0.2s ease-out;
  --animate-zoom-out-95: zoom-out-95 0.2s ease-out;
}

:root {
  --background: #ffffff;
  --foreground: #0f172a;
  --card: #ffffff;
  --card-foreground: #0f172a;
  --popover: #ffffff;
  --popover-foreground: #0f172a;
  --primary: #800000;
  --primary-foreground: #f8fafc;
  --secondary: #f1f5f9;
  --secondary-foreground: #0f172a;
  --muted: #f1f5f9;
  --muted-foreground: #64748b;
  --accent: #f1f5f9;
  --accent-foreground: #0f172a;
  --destructive: #c84343;
  --destructive-800: #7b1419;
  --destructive-foreground: #f8fafc;
  --border: #e2e8f0;
  --input: #e2e8f0;
  --ring: #800000;
  --emerald-500: #6ccba8;
  --emerald-600: #28bf8b;
  --radius: 0.5rem;
}

/* Additional animations for dialogs and components */
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes zoom-in-95 {
  from { transform: scale(0.95); }
  to { transform: scale(1); }
}

@keyframes zoom-out-95 {
  from { transform: scale(1); }
  to { transform: scale(0.95); }
}

@keyframes slide-in-from-left-1\/2 {
  from { transform: translateX(-50%) translateX(-50%); }
  to { transform: translateX(-50%); }
}

@keyframes slide-in-from-top-48 {
  from { transform: translateY(-50%) translateY(-48%); }
  to { transform: translateY(-50%); }
}

@keyframes slide-out-to-left-1\/2 {
  from { transform: translateX(-50%); }
  to { transform: translateX(-50%) translateX(-50%); }
}

@keyframes slide-out-to-top-48 {
  from { transform: translateY(-50%); }
  to { transform: translateY(-50%) translateY(-48%); }
}

/* Global CSS Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
  color: var(--foreground);
  background-color: var(--background);
}

#root {
  height: 100%;
}

/* Button Reset */
button {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

/* Input Reset */
input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

/* Link Reset */
a {
  color: inherit;
  text-decoration: none;
}

/* Focus Styles */
*:focus {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

/* Utility Classes */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Component Overrides for proper styling */
.rounded-lg {
  border-radius: var(--radius-lg) !important;
}

.rounded-md {
  border-radius: var(--radius-md) !important;
}

.rounded {
  border-radius: var(--radius) !important;
}

.p-6 {
  padding: var(--spacing-6) !important;
}

.p-4 {
  padding: var(--spacing-4) !important;
}

.p-3 {
  padding: var(--spacing-3) !important;
}

.p-2 {
  padding: var(--spacing-2) !important;
}

.px-3 {
  padding-left: var(--spacing-3) !important;
  padding-right: var(--spacing-3) !important;
}

.py-2 {
  padding-top: var(--spacing-2) !important;
  padding-bottom: var(--spacing-2) !important;
}

.px-4 {
  padding-left: var(--spacing-4) !important;
  padding-right: var(--spacing-4) !important;
}

.gap-4 {
  gap: var(--spacing-4) !important;
}

.gap-2 {
  gap: var(--spacing-2) !important;
}

.space-y-1\.5 > * + * {
  margin-top: var(--spacing-1) !important;
}

.h-10 {
  height: 2.5rem !important;
}

.text-sm {
  font-size: var(--font-size-sm) !important;
}

.text-lg {
  font-size: var(--font-size-lg) !important;
}

.shadow-sm {
  box-shadow: var(--shadow-sm) !important;
}

.shadow-lg {
  box-shadow: var(--shadow-lg) !important;
}

.border {
  border-width: 1px !important;
  border-style: solid !important;
}

.bg-background {
  background-color: var(--background) !important;
}

.bg-primary {
  background-color: var(--primary) !important;
}

.bg-secondary {
  background-color: var(--secondary) !important;
}

.bg-destructive {
  background-color: var(--destructive) !important;
}

.bg-card {
  background-color: var(--card) !important;
}

.bg-emerald-500 {
  background-color: var(--emerald-500) !important;
}

.bg-emerald-600 {
  background-color: var(--emerald-600) !important;
}

.bg-destructive-800 {
    background-color: var(--destructive-800) !important;
}

.hover\:bg-destructive-800:hover {
  background-color: var(--destructive-800) !important;
}

.hover\:bg-accent:hover {
  background-color: var(--accent) !important;
}

.hover\:bg-emerald-600:hover {
  background-color: var(--emerald-600) !important;
}

.text-primary-foreground {
  color: var(--primary-foreground) !important;
}

.text-secondary-foreground {
  color: var(--secondary-foreground) !important;
}

.text-destructive-foreground {
  color: var(--destructive-foreground) !important;
}

.text-card-foreground {
  color: var(--card-foreground) !important;
}

.text-muted-foreground {
  color: var(--muted-foreground) !important;
}

.border-input {
  border-color: var(--input) !important;
}

.border-border {
  border-color: var(--border) !important;
}

.focus-visible\:ring-2:focus-visible {
  outline: 2px solid var(--ring) !important;
  outline-offset: 2px !important;
}

.focus-visible\:ring-ring:focus-visible {
  outline-color: var(--ring) !important;
}

.focus-visible\:ring-offset-2:focus-visible {
  outline-offset: 2px !important;
}

/* Dialog Overlay Styles */
.fixed {
  position: fixed !important;
}

.inset-0 {
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  left: 0 !important;
}

.z-50 {
  z-index: 50 !important;
}

.bg-black\/80 {
  background-color: rgba(0, 0, 0, 0.8) !important;
}

.bg-black\/50 {
  background-color: rgba(0, 0, 0, 0.5) !important;
}

.left-\[50\%\] {
  left: 50% !important;
}

.top-\[50\%\] {
  top: 50% !important;
}

.translate-x-\[-50\%\] {
  transform: translateX(-50%) !important;
}

.translate-y-\[-50\%\] {
  transform: translateY(0%) !important;
}

.grid {
  display: grid !important;
}

.w-full {
  width: 100% !important;
}

.max-w-lg {
  max-width: 32rem !important;
}

/* Enhanced Dialog Overlay */
[data-radix-dialog-overlay] {
  background-color: rgba(0, 0, 0, 0.75) !important;
  backdrop-filter: blur(4px) !important;
  animation: fade-in 0.2s ease-out !important;
}

/* Dialog Content Enhancement */
[data-radix-dialog-content] {
  background-color: var(--background) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
  animation: zoom-in-95 0.2s ease-out !important;
}

/* Specific dialog styling overrides */
.goal-dialog,
.progress-dialog {
  background-color: var(--background) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
}