/*
 * i-broker launcher — styles
 * Conforms to the GAQ Design System (DESIGN-SYSTEM.md, v1).
 * The :root + base typography block is a verbatim copy of design-system/tokens.css.
 * Launcher-specific styles (sidebar collapse, module-pane switching) follow below.
 */

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

/* ============================================================
 *  Design system tokens (mirrors design-system/tokens.css)
 * ============================================================ */
:root {
  --primary:       #2563eb;
  --primary-light: #3b82f6;
  --primary-dark:  #1d4ed8;
  --primary-50:    #eff6ff;
  --primary-100:   #dbeafe;

  --success:    #16a34a;
  --success-50: #f0fdf4;
  --success-100:#dcfce7;

  --warning:    #d97706;
  --warning-50: #fffbeb;
  --warning-100:#fef3c7;

  --danger:     #dc2626;
  --danger-50:  #fef2f2;
  --danger-100: #fee2e2;

  --gray-50:  #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;

  --sidebar-bg-start: #0b1220;
  --sidebar-bg-end:   #0f172a;
  --sidebar-text:        #e2e8f0;
  --sidebar-text-strong: #f1f5f9;
  --sidebar-text-muted:  #94a3b8;
  --sidebar-text-meta:   #64748b;

  --sidebar-width-expanded: 232px;
  --sidebar-width-collapsed: 64px;

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;

  --shadow-xs: 0 1px 2px rgba(15,23,42,0.04);
  --shadow-sm: 0 1px 3px rgba(15,23,42,0.06), 0 1px 2px rgba(15,23,42,0.04);
  --shadow:    0 4px 12px -2px rgba(15,23,42,0.06), 0 2px 4px -2px rgba(15,23,42,0.04);
  --shadow-md: 0 10px 24px -6px rgba(15,23,42,0.08), 0 4px 8px -4px rgba(15,23,42,0.06);
  --shadow-lg: 0 20px 40px -10px rgba(15,23,42,0.18), 0 8px 16px -8px rgba(15,23,42,0.10);

  --transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: 15.5px; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  letter-spacing: -0.005em;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: var(--gray-800);
  background: var(--gray-100);
  height: 100vh;
  overflow: hidden;
}

h1, h2, h3, h4 { letter-spacing: -0.02em; }

@media (prefers-reduced-motion: reduce) {
  :root { --transition: none; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
 *  App shell
 * ============================================================ */
.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ============================================================
 *  Sidebar — dark navy gradient (per spec §3.2)
 * ============================================================ */
.sidebar {
  width: var(--sidebar-width-expanded);
  background: linear-gradient(180deg, var(--sidebar-bg-start) 0%, var(--sidebar-bg-end) 100%);
  color: var(--sidebar-text);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  transition: width var(--transition);
}

.app[data-sidebar="collapsed"] .sidebar {
  width: var(--sidebar-width-collapsed);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  min-height: 60px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  overflow: hidden;
  min-width: 0;
}

.brand-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.brand-name {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--sidebar-text-strong);
  white-space: nowrap;
  transition: opacity var(--transition), max-width var(--transition);
}

.app[data-sidebar="collapsed"] .brand-name {
  opacity: 0;
  pointer-events: none;
  max-width: 0;
  margin: 0;
  overflow: hidden;
}

.sidebar-toggle {
  border: none;
  background: transparent;
  padding: 6px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--sidebar-text-strong);
}

.sidebar-toggle:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.app[data-sidebar="collapsed"] .sidebar-toggle svg {
  transform: rotate(180deg);
}

/* ============================================================
 *  Sidebar nav — per spec §3.2
 * ============================================================ */
.modules {
  flex: 1;
  overflow-y: auto;
  padding: 10px 10px;
}

.modules ul {
  list-style: none;
}

.module-link {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 12px;
  background: none;
  border: none;
  color: var(--sidebar-text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
  margin-bottom: 1px;
  transition: var(--transition);
  white-space: nowrap;
  overflow: hidden;
}

.module-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--sidebar-text-strong);
}

.module-link:hover .module-icon {
  color: var(--gray-300);
}

.module-link.is-active {
  background: rgba(59, 130, 246, 0.18);
  color: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.3);
}

.module-link.is-active .module-icon {
  color: #60a5fa;
}

.module-link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.module-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--sidebar-text-meta);
  transition: var(--transition);
}

.module-label {
  opacity: 1;
  transition: opacity var(--transition), max-width var(--transition);
}

.app[data-sidebar="collapsed"] .module-label {
  opacity: 0;
  pointer-events: none;
  max-width: 0;
  margin: 0;
  overflow: hidden;
}

.app[data-sidebar="collapsed"] .module-link {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

.external-icon {
  width: 12px;
  height: 12px;
  margin-left: auto;
  flex-shrink: 0;
  color: var(--sidebar-text-meta);
  opacity: 0.7;
}

.app[data-sidebar="collapsed"] .external-icon {
  display: none;
}

/* ============================================================
 *  Sidebar footer — version pill (acts as "user block" placeholder)
 * ============================================================ */
.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--sidebar-text-meta);
  white-space: nowrap;
  overflow: hidden;
  letter-spacing: 0;
}

.app[data-sidebar="collapsed"] .sidebar-footer {
  text-align: center;
  padding-left: 0;
  padding-right: 0;
  font-size: 0.65rem;
}

/* ============================================================
 *  Content area
 * ============================================================ */
.content {
  flex: 1;
  position: relative;
  background: var(--gray-100);
  overflow: hidden;
}

.module-pane {
  position: absolute;
  inset: 0;
  display: none;
  overflow: auto;
}

.module-pane.is-active {
  display: block;
}

.module-pane iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* ============================================================
 *  Dashboard placeholder pane
 *  (Real dashboard will replace this with cards / grids per spec)
 * ============================================================ */
.module-pane[data-pane="dashboard"] {
  padding: 28px 36px 40px;
}

.placeholder {
  max-width: 640px;
  margin: 48px auto 0;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 28px 32px;
}

.placeholder h1 {
  font-size: 1.45rem;
  font-weight: 600;
  color: var(--gray-900);
  letter-spacing: -0.025em;
  margin-bottom: 12px;
}

.placeholder p {
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--gray-600);
  margin-bottom: 10px;
}

.placeholder p.muted {
  color: var(--gray-500);
  font-size: 0.85rem;
  margin-bottom: 0;
}

/* ============================================================
 *  Mobile (breakpoint per spec — 768px)
 * ============================================================ */
@media (max-width: 768px) {
  .app[data-sidebar="expanded"] .sidebar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 10;
    box-shadow: 2px 0 8px rgba(15, 23, 42, 0.18);
  }
  .module-pane[data-pane="dashboard"] {
    padding: 16px;
  }
}
