@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&display=swap');

/* ==========================================================================
   MAGIC API - MODERN DARK / MONOCHROMATIC THEME (RYZE API STYLED)
   ========================================================================== */

:root {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  color-scheme: light;
  
  /* Light Theme Color Palette Tokens */
  --bg-main: #f8fafc;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-input: #ffffff;
  --bg-elevated: #f1f5f9;
  
  --border-subtle: #e2e8f0;
  --border-card: #e2e8f0;
  --border-focus: #6366f1;
  
  --accent-primary: #4f46e5;
  --accent-primary-hover: #4338ca;
  --accent-primary-light: #6366f1;
  --accent-glow: rgba(79, 70, 229, 0.15);
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  
  /* Shadcn UI CSS Variables (Light) */
  --background: oklch(0.99 0 0);
  --foreground: oklch(0.14 0.01 270);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.14 0.01 270);
  --popover: oklch(1 0 0);
  --popover-foreground: oklch(0.14 0.01 270);
  --primary: oklch(0.5 0.22 270);
  --primary-foreground: oklch(1 0 0);
  --secondary: oklch(0.96 0.01 270);
  --secondary-foreground: oklch(0.14 0.01 270);
  --muted: oklch(0.96 0.01 270);
  --muted-foreground: oklch(0.45 0.01 270);
  --accent: oklch(0.96 0.01 270);
  --accent-foreground: oklch(0.14 0.01 270);
  --destructive: oklch(0.55 0.22 25);
  --destructive-foreground: oklch(1 0 0);
  --border: oklch(0.9 0.01 270);
  --input: oklch(0.9 0.01 270);
  --ring: oklch(0.55 0.22 270);
  
  --sidebar: oklch(0.98 0.005 270);
  --sidebar-foreground: oklch(0.14 0.01 270);
  --sidebar-primary: oklch(0.5 0.22 270);
  --sidebar-primary-foreground: oklch(1 0 0);
  --sidebar-accent: oklch(0.94 0.01 270);
  --sidebar-accent-foreground: oklch(0.14 0.01 270);
  --sidebar-border: oklch(0.9 0.01 270);
  --sidebar-ring: oklch(0.55 0.22 270);
  
  --radius: 0.75rem;
}

.dark {
  color-scheme: dark;
  
  /* Dark Theme Color Palette Tokens */
  --bg-main: #08090d;
  --bg-sidebar: #0b0c13;
  --bg-card: #11131c;
  --bg-card-hover: #161824;
  --bg-input: #0c0d14;
  --bg-elevated: #181a27;
  
  --border-subtle: #1a1c29;
  --border-card: #1e202e;
  --border-focus: #6366f1;
  
  --accent-primary: #4f46e5;
  --accent-primary-hover: #4338ca;
  --accent-primary-light: #6366f1;
  --accent-glow: rgba(79, 70, 229, 0.25);
  
  --text-primary: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --text-dim: #52525b;
  
  /* Shadcn UI CSS Variables (Dark) */
  --background: oklch(0.1 0.01 270);
  --foreground: oklch(0.97 0 0);
  --card: oklch(0.14 0.012 270);
  --card-foreground: oklch(0.97 0 0);
  --popover: oklch(0.14 0.012 270);
  --popover-foreground: oklch(0.97 0 0);
  --primary: oklch(0.5 0.22 270);
  --primary-foreground: oklch(1 0 0);
  --secondary: oklch(0.18 0.015 270);
  --secondary-foreground: oklch(0.97 0 0);
  --muted: oklch(0.16 0.012 270);
  --muted-foreground: oklch(0.68 0.01 270);
  --accent: oklch(0.2 0.02 270);
  --accent-foreground: oklch(1 0 0);
  --destructive: oklch(0.55 0.22 25);
  --destructive-foreground: oklch(1 0 0);
  --border: oklch(0.2 0.015 270);
  --input: oklch(0.12 0.01 270);
  --ring: oklch(0.55 0.22 270);
  
  --sidebar: oklch(0.11 0.01 270);
  --sidebar-foreground: oklch(0.92 0 0);
  --sidebar-primary: oklch(0.5 0.22 270);
  --sidebar-primary-foreground: oklch(1 0 0);
  --sidebar-accent: oklch(0.17 0.015 270);
  --sidebar-accent-foreground: oklch(1 0 0);
  --sidebar-border: oklch(0.18 0.012 270);
  --sidebar-ring: oklch(0.55 0.22 270);
}

/* Global Reset & Base Styling */
body {
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: 'Plus Jakarta Sans', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* App Main Container */
#root {
  min-height: 100vh;
  background-color: var(--bg-main);
}

/* Header & Top Navigation Bar */
header, nav, .header-bar {
  background-color: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-subtle);
}

/* Sidebar Navigation */
aside, [data-sidebar="sidebar"], .sidebar-container {
  background-color: var(--bg-sidebar) !important;
  border-right: 1px solid var(--border-subtle) !important;
}

/* Sidebar Group Labels */
[data-sidebar="group-label"], .sidebar-group-title {
  color: var(--text-muted) !important;
  font-size: 0.6875rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
  padding: 0.75rem 0.75rem 0.35rem 0.75rem !important;
}

/* Sidebar Menu Items & Links */
[data-sidebar="menu-button"], .sidebar-item {
  border-radius: 0.6rem !important;
  color: var(--text-secondary) !important;
  font-size: 0.875rem !important;
  font-weight: 500 !important;
  transition: all 0.15s ease-in-out !important;
  padding: 0.5rem 0.75rem !important;
}

[data-sidebar="menu-button"]:hover, .sidebar-item:hover {
  background-color: var(--bg-card-hover) !important;
  color: #ffffff !important;
}

[data-sidebar="menu-button"][data-active="true"], [data-sidebar="menu-button"].active, .sidebar-item.active {
  background-color: var(--bg-elevated) !important;
  color: #ffffff !important;
  font-weight: 600 !important;
  box-shadow: inset 2px 0 0 0 var(--accent-primary-light) !important;
}

/* Upgrade Card inside Sidebar */
.plan-usage-card, [data-sidebar="footer"] > div {
  background-color: #121420 !important;
  border: 1px solid var(--border-card) !important;
  border-radius: 0.85rem !important;
  padding: 1rem !important;
}

/* Cards & Elevated Containers */
.card, [data-slot="card"], div.bg-card, div.rounded-lg.border.bg-card {
  background-color: var(--bg-card) !important;
  border: 1px solid var(--border-card) !important;
  border-radius: 0.85rem !important;
  box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.25) !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
}

.card:hover, [data-slot="card"]:hover {
  border-color: #26293c !important;
}

/* Buttons Styling */
button, .btn {
  border-radius: 0.6rem !important;
  font-weight: 500 !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

/* Primary Action Buttons */
button.bg-primary, button[type="submit"], .btn-primary, [data-variant="default"] {
  background: linear-gradient(135deg, #5b50f6 0%, #4f46e5 100%) !important;
  color: #ffffff !important;
  border: none !important;
  font-weight: 600 !important;
  box-shadow: 0 4px 14px 0 rgba(79, 70, 229, 0.35) !important;
}

button.bg-primary:hover, button[type="submit"]:hover, .btn-primary:hover, [data-variant="default"]:hover {
  background: linear-gradient(135deg, #6366f1 0%, #4338ca 100%) !important;
  box-shadow: 0 6px 20px 0 rgba(79, 70, 229, 0.5) !important;
  transform: translateY(-1px) !important;
}

/* Outline / Secondary Buttons */
button.border, button.bg-secondary, [data-variant="outline"] {
  background-color: var(--bg-card) !important;
  border: 1px solid var(--border-card) !important;
  color: var(--text-primary) !important;
}

button.border:hover, button.bg-secondary:hover, [data-variant="outline"]:hover {
  background-color: var(--bg-card-hover) !important;
  border-color: #2d3045 !important;
}

/* Inputs & Form Elements */
input, select, textarea, [role="combobox"] {
  background-color: var(--bg-input) !important;
  border: 1px solid var(--border-card) !important;
  color: var(--text-primary) !important;
  border-radius: 0.6rem !important;
  font-size: 0.875rem !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
}

input:focus, select:focus, textarea:focus, [role="combobox"]:focus {
  border-color: var(--accent-primary-light) !important;
  box-shadow: 0 0 0 3px var(--accent-glow) !important;
  outline: none !important;
}

/* Modals & Dialog Windows */
[role="dialog"], [data-slot="dialog-content"], div.fixed.inset-0.z-50 {
  background-color: var(--bg-card) !important;
  border: 1px solid #222435 !important;
  border-radius: 1rem !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8) !important;
}

/* Backdrop Blur Overlay */
[data-slot="dialog-overlay"], div.fixed.inset-0.bg-black\/80 {
  background-color: rgba(4, 5, 8, 0.75) !important;
  backdrop-filter: blur(8px) !important;
}

/* Modal Inner Tab Links */
.modal-tabs button, [role="tab"] {
  border-radius: 0.5rem !important;
  color: var(--text-secondary) !important;
  transition: all 0.15s ease !important;
}

[role="tab"][data-state="active"], [role="tab"].active {
  background-color: var(--bg-elevated) !important;
  color: #ffffff !important;
  font-weight: 600 !important;
}

/* Badges & Tags */
.badge, [data-slot="badge"] {
  border-radius: 9999px !important;
  font-weight: 600 !important;
  font-size: 0.75rem !important;
  padding: 0.2rem 0.6rem !important;
}

.badge-violet, [data-variant="default"].badge {
  background-color: rgba(99, 102, 241, 0.15) !important;
  color: #818cf8 !important;
  border: 1px solid rgba(99, 102, 241, 0.3) !important;
}

/* Table Styling */
table {
  width: 100%;
  border-collapse: separate !important;
  border-spacing: 0 !important;
}

th {
  background-color: var(--bg-sidebar) !important;
  color: var(--text-muted) !important;
  font-size: 0.75rem !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  border-bottom: 1px solid var(--border-subtle) !important;
  padding: 0.75rem 1rem !important;
}

td {
  border-bottom: 1px solid var(--border-subtle) !important;
  padding: 0.875rem 1rem !important;
  color: var(--text-primary) !important;
  font-size: 0.875rem !important;
}

tr:hover td {
  background-color: var(--bg-card-hover) !important;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: #202232;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-primary-light);
}

/* Sleek Fade-in Animation */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.card, [role="dialog"], main > div {
  animation: fadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
