/* ==========================================
// Shadcn-Inspired CSS Framework
// ========================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --background: 0 0% 100%;
  --foreground: 222.2 84% 4.9%;
  --card: 0 0% 100%;
  --card-foreground: 222.2 84% 4.9%;
  --popover: 0 0% 100%;
  --popover-foreground: 222.2 84% 4.9%;
  --primary: 221.2 83.2% 53.3%;
  --primary-foreground: 210 40% 98%;
  --secondary: 210 40% 96.1%;
  --secondary-foreground: 222.2 47.4% 11.2%;
  --muted: 210 40% 96.1%;
  --muted-foreground: 215.4 16.3% 46.9%;
  --accent: 210 40% 96.1%;
  --accent-foreground: 222.2 47.4% 11.2%;
  --destructive: 0 84.2% 60.2%;
  --destructive-foreground: 210 40% 98%;
  --border: 214.3 31.8% 91.4%;
  --input: 214.3 31.8% 91.4%;
  --ring: 221.2 83.2% 53.3%;
  --radius: 0.5rem;
}

[data-theme='dark'] {
  --background: 222.2 84% 4.9%;
  --foreground: 210 40% 98%;
  --card: 222.2 84% 4.9%;
  --card-foreground: 210 40% 98%;
  --popover: 222.2 84% 4.9%;
  --popover-foreground: 210 40% 98%;
  --primary: 217.2 91.2% 59.8%;
  --primary-foreground: 222.2 47.4% 11.2%;
  --secondary: 217.2 32.6% 17.5%;
  --secondary-foreground: 210 40% 98%;
  --muted: 217.2 32.6% 17.5%;
  --muted-foreground: 215 20.2% 65.1%;
  --accent: 217.2 32.6% 17.5%;
  --accent-foreground: 210 40% 98%;
  --destructive: 0 62.8% 30.6%;
  --destructive-foreground: 210 40% 98%;
  --border: 217.2 32.6% 17.5%;
  --input: 217.2 32.6% 17.5%;
  --ring: 212.7 26.8% 83.9%;
}

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

body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

/* Typography */
h1, h2, h3, h4 { margin: 0 0 1rem 0; font-weight: 600; letter-spacing: -0.02em; }
p { margin: 0 0 1rem 0; color: hsl(var(--muted-foreground)); }

/* Layout */
.app-container { display: flex; min-height: 100vh; }
.sidebar { width: 250px; border-right: 1px solid hsl(var(--border)); background: hsl(var(--card)); padding: 1.5rem; display: flex; flex-direction: column; }
.main-content { flex: 1; display: flex; flex-direction: column; background: hsl(var(--background)); }
.topbar { height: 64px; border-bottom: 1px solid hsl(var(--border)); display: flex; align-items: center; justify-content: space-between; padding: 0 2rem; background: hsl(var(--card)); }
.page-content { padding: 2rem; flex: 1; overflow-y: auto; }

/* Navigation */
.nav-brand { font-size: 1.25rem; font-weight: 700; margin-bottom: 2rem; color: hsl(var(--foreground)); text-decoration: none; }
.nav-menu { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.nav-link { display:flex; align-items: center; gap: 0.75rem; padding: 0.5rem 0.75rem; border-radius: var(--radius); color: hsl(var(--muted-foreground)); text-decoration: none; font-size: 0.875rem; font-weight: 500; transition: all 0.2s; }
.nav-link:hover, .nav-link.active { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }

/* Components */
.card { background: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: var(--radius); padding: 1.5rem; box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05); }
.card-title { font-size: 1.25rem; font-weight: 600; margin-bottom: 1.5rem; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius); font-weight: 500; font-size: 0.875rem; padding: 0.5rem 1rem; cursor: pointer; transition: all 0.2s; border: none; font-family: inherit; }
.btn-primary { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }
.btn-primary:hover { opacity: 0.9; }
.btn-outline { background: transparent; border: 1px solid hsl(var(--border)); color: hsl(var(--foreground)); }
.btn-outline:hover { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }
.btn-icon { padding: 0.5rem; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 0.5rem; }
.form-control { display: flex; height: 40px; width: 100%; border-radius: var(--radius); border: 1px solid hsl(var(--input)); background: hsl(var(--background)); padding: 0.5rem 0.75rem; font-size: 0.875rem; color: hsl(var(--foreground)); font-family: inherit; transition: border-color 0.2s, box-shadow 0.2s; }
.form-control:focus { outline: none; border-color: hsl(var(--ring)); box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring)); }

/* Tables */
.table-container { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 0.875rem; }
th { font-weight: 500; color: hsl(var(--muted-foreground)); padding: 0.75rem 1rem; border-bottom: 1px solid hsl(var(--border)); }
td { padding: 1rem; border-bottom: 1px solid hsl(var(--border)); color: hsl(var(--foreground)); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: hsl(var(--muted) / 0.5); }

/* Modals */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(2px); display: none; align-items: center; justify-content: center; z-index: 50; }
.modal-overlay.active { display: flex; }
.modal-dialog { background: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: var(--radius); width: 100%; max-width: 500px; padding: 1.5rem; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.modal-title { margin: 0; font-size: 1.125rem; font-weight: 600; }
.modal-close { background: none; border: none; cursor: pointer; color: hsl(var(--muted-foreground)); font-size: 1.25rem; }

/* Flex Utility */
.flex { display: flex; }
.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; }
.mb-4 { margin-bottom: 1rem; }
.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* Toasts */
#toast-container { position: fixed; bottom: 1rem; right: 1rem; z-index: 100; display: flex; flex-direction: column; gap: 0.5rem; }
.toast { background: hsl(var(--card)); border: 1px solid hsl(var(--border)); padding: 1rem; border-radius: var(--radius); box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1); font-size: 0.875rem; min-width: 300px; display: flex; align-items: center; gap: 0.5rem; opacity: 0; transform: translateY(10px); transition: all 0.3s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { border-left: 4px solid #10b981; }
.toast.error { border-left: 4px solid hsl(var(--destructive)); }

/* ==========================================
// Sidebar Improvements (Icon-based)
// ========================================== */
.sidebar { width: 240px; border-right: 1px solid hsl(var(--border)); background: hsl(var(--card)); padding: 1.5rem 0 1.25rem 0; display: flex; flex-direction: column; }
.sidebar-brand { display:flex; align-items:center; gap: 0.75rem; padding: 0.5rem 1.25rem 1.5rem; font-size: 1.2rem; font-weight: 700; color: hsl(var(--foreground)); border-bottom: 1px solid hsl(var(--border)); margin-bottom: 1rem; }
.sidebar-brand svg { color: hsl(var(--primary)); flex-shrink:0; }
.brand-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 0 0.75rem; }
.nav-menu { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.nav-link { display:flex; align-items: center; gap: 0.625rem; padding: 0.5rem 0.75rem; border-radius: var(--radius); color: hsl(var(--muted-foreground)); text-decoration: none; font-size: 0.85rem; font-weight: 500; transition: all 0.15s; }
.nav-link svg { flex-shrink: 0; }
.nav-link:hover, .nav-link.active { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }
.nav-link.active { color: hsl(var(--primary)); background: hsl(var(--primary) / 0.1); }
.sidebar-footer { padding: 1rem 1.25rem; border-top: 1px solid hsl(var(--border)); margin-top: auto; }
.user-info { display:flex; align-items:center; justify-content:center; gap:0.5rem; font-size: 0.9rem; font-weight: 600; color: hsl(var(--foreground)); margin-bottom:0.75rem; padding: 0.5rem; background: hsl(var(--muted)/0.3); border-radius: var(--radius); }

/* Dashboard Stat Cards */
.stat-card { background: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: var(--radius); padding: 1.5rem; box-shadow: 0 1px 3px rgba(0,0,0,0.05); display:flex; flex-direction:column; justify-content:space-between; min-height: 140px; }
.stat-label { font-size: 0.8rem; font-weight: 500; color: hsl(var(--muted-foreground)); text-transform:uppercase; letter-spacing:0.05em; margin-bottom: 0.5rem; }
.stat-value { font-size: 1.75rem; font-weight: 700; }
.stat-icon { margin-bottom: 0.75rem; background: hsl(var(--primary) / 0.1); border-radius: 8px; width:40px; height:40px; display:flex; align-items:center; justify-content:center; color: hsl(var(--primary)); }

/* Badge */
.badge { display:inline-flex; align-items:center; font-size: 0.7rem; font-weight:600; padding: 2px 8px; border-radius: 99px; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger { background: hsl(var(--destructive) / 0.15); color: hsl(var(--destructive)); }
.badge-primary { background: hsl(var(--primary) / 0.15); color: hsl(var(--primary)); }
