/* ==========================================================================
   iSuite Dashboard Stylesheet — iSPACE Design System
   Dual-Theme (Light Surface / Dark Zinc), Glassmorphism & Micro-animations
   ========================================================================== */

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  /* Light Theme Defaults (iSPACE CMS Standard) */
  --bg-app: #FAFAFA;
  --bg-surface: #FFFFFF;
  --bg-surface-subtle: #F4F4F5;
  --border-app: #E2E8F0;
  --border-subtle: #F1F5F9;
  --text-main: #0F172A;
  --text-muted: #64748B;
  --brand-blue: #004AAD;
  --brand-blue-hover: #003680;
  --brand-light: #E6F0FF;
}

html.dark {
  /* Dark Theme */
  --bg-app: #09090B;
  --bg-surface: #18181B;
  --bg-surface-subtle: #27272A;
  --border-app: rgba(255, 255, 255, 0.1);
  --border-subtle: rgba(255, 255, 255, 0.05);
  --text-main: #F4F4F5;
  --text-muted: #A1A1AA;
  --brand-blue: #3B82F6;
  --brand-blue-hover: #2563EB;
  --brand-light: rgba(59, 130, 246, 0.15);
}

* {
  box-sizing: border-box;
}

html, body {
  width: 100%;
  max-width: 100%;
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94A3B8;
}

html.dark ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
}

html.dark ::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* Cards & Surfaces */
.surface-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-app);
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.04), 0 1px 2px -1px rgba(0, 0, 0, 0.04);
}

html.dark .surface-card {
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.5);
}

.surface-hover {
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.surface-hover:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px -4px rgba(0, 0, 0, 0.08);
}

html.dark .surface-hover:hover {
  box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.6);
}

/* Slide-out Drawer Panel */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.drawer-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 600px;
  background-color: var(--bg-surface);
  border-left: 1px solid var(--border-app);
  z-index: 61;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.19, 1, 0.22, 1);
  display: flex;
  flex-direction: column;
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.15);
}

.drawer-backdrop.open + .drawer-panel,
.drawer-panel.open {
  transform: translateX(0);
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-app);
  border-radius: 1.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  width: 100%;
  max-height: calc(100vh - 2rem);
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  transform: scale(0.95) translateY(8px);
  transition: transform 0.25s cubic-bezier(0.19, 1, 0.22, 1);
}

.modal-overlay.open .modal-box {
  transform: scale(1) translateY(0);
}

/* Live Smartphone Mockup Styling */
.phone-mockup-frame {
  width: 320px;
  height: 640px;
  border-radius: 44px;
  padding: 10px;
  background: #1E293B;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.3),
              inset 0 0 0 2px #475569;
  position: relative;
  flex-shrink: 0;
}

html.dark .phone-mockup-frame {
  background: #09090B;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8),
              inset 0 0 0 2px rgba(255, 255, 255, 0.15);
}

.phone-screen {
  width: 100%;
  height: 100%;
  border-radius: 36px;
  background-color: #FAFAFA;
  overflow-y: auto;
  position: relative;
}

html.dark .phone-screen {
  background-color: #121214;
}

.phone-notch {
  width: 90px;
  height: 20px;
  background: #09090B;
  border-radius: 0 0 14px 14px;
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
  animation: fadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Toggle Switch */
.toggle-checkbox:checked {
  right: 0;
  border-color: #3B82F6;
}
.toggle-checkbox:checked + .toggle-label {
  background-color: #3B82F6;
}
