/* ============================================
   CrowdX — Base Styles & Theme Variables
   ============================================ */

:root {
  --radius: 0.5rem;
  /* Light theme — minimal, amber primary */
  --background: 0 0% 100%;
  --foreground: 220 14% 10%;
  --card: 0 0% 100%;
  --card-foreground: 220 14% 10%;
  --popover: 0 0% 100%;
  --popover-foreground: 220 14% 10%;
  --primary: 38 93% 51%;
  --primary-foreground: 0 0% 100%;
  --secondary: 220 14% 96%;
  --secondary-foreground: 220 14% 10%;
  --muted: 220 14% 96%;
  --muted-foreground: 220 9% 43%;
  --accent: 220 26% 14%;
  --accent-foreground: 0 0% 100%;
  --destructive: 0 72% 51%;
  --destructive-foreground: 0 0% 100%;
  --border: 220 13% 91%;
  --input: 220 13% 91%;
  --ring: 38 93% 51%;
  --success: 142 71% 45%;
  --warning: 38 93% 51%;
  --info: 213 94% 51%;
  --chart-1: 38 93% 51%;
  --chart-2: 220 26% 14%;
  --chart-3: 142 71% 45%;
  --chart-4: 213 94% 51%;
  --chart-5: 0 72% 51%;
  --sidebar-background: 0 0% 99%;
  --sidebar-foreground: 220 14% 10%;
  --sidebar-primary: 38 93% 51%;
  --sidebar-primary-foreground: 0 0% 100%;
  --sidebar-accent: 220 14% 96%;
  --sidebar-accent-foreground: 220 14% 10%;
  --sidebar-border: 220 13% 91%;
  --gradient-primary: linear-gradient(135deg, hsl(38 93% 51%), hsl(38 93% 65%));
  --shadow-card: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-hover: 0 4px 12px rgba(0,0,0,0.08);
}

.dark {
  --background: 220 20% 10%;
  --foreground: 220 14% 95%;
  --card: 220 20% 13%;
  --card-foreground: 220 14% 95%;
  --popover: 220 20% 13%;
  --popover-foreground: 220 14% 95%;
  --primary: 38 93% 55%;
  --primary-foreground: 0 0% 100%;
  --secondary: 220 20% 18%;
  --secondary-foreground: 220 14% 85%;
  --muted: 220 20% 18%;
  --muted-foreground: 220 9% 55%;
  --accent: 38 93% 55%;
  --accent-foreground: 0 0% 100%;
  --destructive: 0 62% 42%;
  --destructive-foreground: 0 0% 98%;
  --border: 220 20% 22%;
  --input: 220 20% 22%;
  --ring: 38 93% 55%;
  --chart-1: 38 93% 60%;
  --chart-2: 220 40% 65%;
  --chart-3: 142 60% 50%;
  --chart-4: 213 80% 60%;
  --chart-5: 0 65% 55%;
  --sidebar-background: 220 20% 8%;
  --sidebar-foreground: 220 14% 90%;
  --sidebar-border: 220 20% 18%;
  --gradient-primary: linear-gradient(135deg, hsl(38 93% 55%), hsl(38 93% 68%));
  --shadow-card: 0 1px 3px rgba(0,0,0,0.25), 0 1px 2px rgba(0,0,0,0.2);
  --shadow-hover: 0 4px 12px rgba(0,0,0,0.3);
}

/* Base resets */
* {
  border-color: hsl(var(--border));
  scrollbar-width: thin;
  scrollbar-color: hsl(var(--border)) transparent;
}

*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: hsl(var(--border)); border-radius: 3px; }
*::-webkit-scrollbar-thumb:hover { background: hsl(var(--muted-foreground)); }

body {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: 'Montserrat', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Montserrat', system-ui, sans-serif;
  text-wrap: balance;
}

p { text-wrap: pretty; }

/* Custom utilities */
.gradient-text {
  background-image: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.glass {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.dark .glass {
  background: rgba(17, 24, 39, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.shadow-card { box-shadow: var(--shadow-card); }
.shadow-hover { box-shadow: var(--shadow-hover); }

/* Grid background */
.grid-bg {
  background-image:
    linear-gradient(to right, hsl(var(--border)) 1px, transparent 1px),
    linear-gradient(to bottom, hsl(var(--border)) 1px, transparent 1px);
  background-size: 64px 64px;
}

/* Navbar scroll state */
#navbar.scrolled {
  background: hsl(var(--background) / 0.70);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid hsl(var(--border));
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

/* Floating cards animation */
.floating-card {
  animation: float-card 4s ease-in-out infinite;
}
.floating-card[data-card="0"] { animation-delay: 0s; animation-duration: 4s; }
.floating-card[data-card="1"] { animation-delay: 0.5s; animation-duration: 4.5s; }
.floating-card[data-card="2"] { animation-delay: 1s; animation-duration: 5s; }

@keyframes float-card {
  0%, 100% { transform: translateY(0) rotate(var(--rot, 0deg)); }
  50% { transform: translateY(-8px) rotate(var(--rot, 0deg)); }
}

/* Scroll hint bounce */
.scroll-bounce {
  animation: scroll-bounce 1.5s infinite;
}
@keyframes scroll-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(4px); }
}

/* Sidebar nav items */
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.125rem;
  color: hsl(var(--muted-foreground));
  transition: all 0.2s;
}
.sidebar-link:hover {
  background: hsl(var(--muted));
  color: hsl(var(--foreground));
}
.sidebar-link.active {
  background: hsl(var(--primary) / 0.1);
  color: hsl(var(--primary));
}

/* Tab buttons */
.tab-btn.active,
.admin-tab.active,
.hiw-tab.active {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  box-shadow: 0 1px 2px rgba(0,0,0,0.09);
}

.hiw-tab:not(.active) {
  color: hsl(var(--muted-foreground));
}

/* Toggle switch */
.switch-toggle[data-on="true"] .toggle-knob {
  transform: translateX(16px);
}
.switch-toggle[data-on="false"] .toggle-knob {
  transform: translateX(0);
}

/* Modal */
.modal-open {
  display: flex !important;
}
.modal-content {
  animation: modal-in 0.2s ease-out;
}
@keyframes modal-in {
  from { opacity: 0; transform: scale(0.95) translateY(-10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Toast notifications */
.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-radius: 0.5rem;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  min-width: 280px;
  max-width: 400px;
  animation: toast-in 0.3s ease-out;
}
.toast.toast-success { border-left: 3px solid hsl(var(--success)); }
.toast.toast-error { border-left: 3px solid hsl(var(--destructive)); }
.toast.toast-info { border-left: 3px solid hsl(var(--info)); }
.toast.toast-warning { border-left: 3px solid hsl(var(--warning)); }
.toast.removing { animation: toast-out 0.3s ease-in forwards; }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateX(20px); }
}

/* Accordion */
.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, hsl(var(--muted)) 25%, hsl(var(--muted) / 0.5) 50%, hsl(var(--muted)) 75%);
  background-size: 200% 100%;
  animation: skeleton 1.5s infinite;
  border-radius: 0.375rem;
}
@keyframes skeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Progress bars */
.progress-bar {
  position: relative;
  height: 0.5rem;
  width: 100%;
  overflow: hidden;
  border-radius: 9999px;
  background: hsl(var(--primary) / 0.2);
}
.progress-bar > div {
  height: 100%;
  background: hsl(var(--primary));
  transition: width 0.3s ease;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 0.375rem;
  border: 1px solid transparent;
  padding: 0.125rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  transition: colors 0.2s;
}
.badge-default { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }
.badge-outline { border-color: hsl(var(--border)); color: hsl(var(--foreground)); }
.badge-secondary { background: hsl(var(--secondary)); color: hsl(var(--secondary-foreground)); }
.badge-destructive { background: hsl(var(--destructive)); color: hsl(var(--destructive-foreground)); }

/* Form inputs base */
input, textarea, select {
  font-family: inherit;
}
input:focus, textarea:focus, select:focus {
  outline: none;
}

/* Buttons base */
button { cursor: pointer; font-family: inherit; }
button:disabled { cursor: not-allowed; opacity: 0.5; }

/* Avatar */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  overflow: hidden;
  background: hsl(var(--muted));
  flex-shrink: 0;
}

/* Lucide icon sizing fix */
[data-lucide] { display: inline-block; vertical-align: middle; }