/* Design System Tokens (Shadcn inspired) */
:root {
  --background: 0 0% 100%;
  --foreground: 240 10% 3.9%;
  --card: 0 0% 100%;
  --card-foreground: 240 10% 3.9%;
  --popover: 0 0% 100%;
  --popover-foreground: 240 10% 3.9%;
  --primary: 240 5.9% 10%;
  --primary-foreground: 0 0% 98%;
  --secondary: 240 4.8% 95.9%;
  --secondary-foreground: 240 5.9% 10%;
  --muted: 240 4.8% 95.9%;
  --muted-foreground: 240 3.8% 46.1%;
  --brand-accent: 18 100% 50%; /* Vibrant Brand Orange (#ff4d00) */
  --accent: 18 100% 50%;
  --accent-foreground: 0 0% 100%;
  --destructive: 0 84.2% 60.2%;
  --destructive-foreground: 0 0% 98%;
  --border: 240 5.9% 90%;
  --input: 240 5.9% 90%;
  --ring: 240 5.9% 10%;
  --radius: 0.5rem;
}

[data-theme="dark"] {
  --background: 240 10% 3.9%;
  --foreground: 0 0% 98%;
  --card: 240 10% 3.9%;
  --card-foreground: 0 0% 98%;
  --popover: 240 10% 3.9%;
  --popover-foreground: 0 0% 98%;
  --primary: 0 0% 98%;
  --primary-foreground: 240 5.9% 10%;
  --secondary: 240 3.7% 15.9%;
  --secondary-foreground: 0 0% 98%;
  --muted: 240 3.7% 15.9%;
  --muted-foreground: 240 5% 64.9%;
  --accent: 18 100% 50%;
  --accent-foreground: 0 0% 98%;
  --destructive: 0 62.8% 30.6%;
  --destructive-foreground: 0 0% 98%;
  --border: 240 3.7% 15.9%;
  --input: 240 3.7% 15.9%;
  --ring: 240 4.9% 83.9%;
}

/* Base Styles */
* {
  box-sizing: border-box;
  border-color: hsl(var(--border));
}

body {
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: "Archivo", sans-serif;
  transition: background-color 0.4s ease, color 0.4s ease;
}

/* Unified Buttons (Tailwind/Shadcn inspired) */
.ui-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  height: 2.5rem;
  padding: 0 1rem;
  transition: all 0.2s;
  cursor: pointer;
  outline: none;
  border: 1px solid transparent;
  gap: 0.5rem;
}

.ui-btn:disabled {
  pointer-events: none;
  opacity: 0.5;
}

.ui-btn-primary {
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}
.ui-btn-primary:hover {
  opacity: 0.9;
}

.ui-btn-secondary {
  background-color: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
}
.ui-btn-secondary:hover {
  background-color: hsl(var(--secondary) / 0.8);
}

.ui-btn-outline {
  border: 1px solid hsl(var(--border));
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
}
.ui-btn-outline:hover {
  background-color: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
  border-color: hsl(var(--accent));
}

.ui-btn-ghost {
  background-color: transparent;
  color: hsl(var(--foreground));
}
.ui-btn-ghost:hover {
  background-color: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

.ui-btn-accent {
  background-color: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}
.ui-btn-accent:hover {
  filter: brightness(1.1);
}

/* Unified Inputs (Shadcn inspired) */
.ui-input, .ui-textarea {
  display: flex;
  height: 2.5rem;
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid hsl(var(--input));
  background-color: transparent;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: hsl(var(--foreground));
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.ui-select {
  display: flex !important;
  height: 2.5rem !important;
  width: 100% !important;
  border-radius: var(--radius) !important;
  border: 1px solid hsl(var(--input)) !important;
  background-color: transparent !important;
  padding: 0 2.5rem 0 0.75rem !important;
  font-size: 0.875rem !important;
  color: hsl(var(--foreground)) !important;
  transition: border-color 0.2s, box-shadow 0.2s !important;
  outline: none !important;
  cursor: pointer !important;
  appearance: none !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='currentColor'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 0.75rem center !important;
  background-size: 1rem !important;
}

/* Custom Dropdown Component (Shadcn-like) */
.ui-dropdown {
  position: relative;
  width: 100%;
}

.ui-dropdown-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 2.5rem;
  padding: 0 0.75rem;
  font-size: 0.875rem;
  border-radius: var(--radius);
  border: 1px solid hsl(var(--input));
  background: transparent;
  color: hsl(var(--foreground));
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.ui-dropdown-trigger:hover {
  border-color: hsl(var(--accent));
}

.ui-dropdown-trigger.active {
  border-color: hsl(var(--accent));
  box-shadow: 0 0 0 2px hsl(var(--accent) / 0.2);
}

.ui-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  padding: 4px;
  display: none;
  animation: dropdownIn 0.2s ease-out;
}

.ui-dropdown-menu.is-open {
  display: block;
}

@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.ui-dropdown-item {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  transition: background 0.1s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: hsl(var(--foreground));
}

.ui-dropdown-item:hover {
  background: hsl(var(--accent) / 0.1);
  color: hsl(var(--foreground));
}

.ui-dropdown-item.selected {
  background: hsl(var(--accent) / 0.1);
  color: hsl(var(--foreground));
  font-weight: 700;
}

.ui-dropdown-item .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.ui-textarea {
  min-height: 80px;
  height: auto;
}

.ui-input:focus-visible, .ui-select:focus-visible, .ui-textarea:focus-visible {
  border-color: hsl(var(--brand-accent));
  box-shadow: 0 0 0 2px hsl(var(--brand-accent) / 0.2);
}

.ui-input::placeholder {
  color: hsl(var(--muted-foreground));
}

.ui-checkbox {
  appearance: none;
  background-color: transparent;
  margin: 0;
  color: currentColor;
  width: 1.15rem;
  height: 1.15rem;
  border: 1px solid hsl(var(--input));
  border-radius: 4px;
  display: grid;
  place-content: center;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}

.ui-checkbox:focus-visible {
  border-color: hsl(var(--brand-accent));
  box-shadow: 0 0 0 2px hsl(var(--brand-accent) / 0.2);
  outline: none;
}

.ui-checkbox::before {
  content: "";
  width: 0.65rem;
  height: 0.65rem;
  transform: scale(0);
  transition: 120ms transform ease-in-out;
  background-color: hsl(var(--accent-foreground));
  transform-origin: center;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}

.ui-checkbox:checked {
  background-color: hsl(var(--brand-accent));
  border-color: hsl(var(--brand-accent));
}

.ui-checkbox:checked::before {
  transform: scale(1);
}

/* Utility Layout Classes (Tailwind-like) */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.w-full { width: 100%; }
.mt-4 { margin-top: 1rem; }
.p-4 { padding: 1rem; }
.rounded-lg { border-radius: var(--radius); }
.border { border: 1px solid hsl(var(--border)); }

/* Responsive Container */
.ui-container {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

@media (min-width: 1280px) {
  .ui-container { max-width: 1440px; }
}
