/**
 * Design System Admin UI - Shadcn/UI Styling
 * Complete styles for navbar-sidebar-main layout
 */

:root {
  /* Colors - Shadcn/UI Light Theme */
  --background: 0 0% 100%;
  --foreground: 0 0% 3.6%;
  --card: 0 0% 100%;
  --card-foreground: 0 0% 3.6%;
  --popover: 0 0% 100%;
  --popover-foreground: 0 0% 3.6%;
  --muted: 0 0% 96.1%;
  --muted-foreground: 0 0% 45.1%;
  --accent: 0 84.2% 60.2%;
  --accent-foreground: 0 0% 100%;
  --destructive: 0 84.2% 60.2%;
  --destructive-foreground: 0 0% 100%;
  --border: 0 0% 89.8%;
  --input: 0 0% 89.8%;
  --primary: 0 0% 3.6%;
  --primary-foreground: 0 0% 100%;
  --secondary: 0 0% 96.1%;
  --secondary-foreground: 0 0% 3.6%;
  --ring: 0 0% 3.6%;
  --radius: 0.5rem;

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'Monaco', 'Courier New', monospace;

  /* Spacing */
  --space-0: 0;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-7: 1.75rem;
  --space-8: 2rem;

  /* Font sizes */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;

  /* Font weights */
  --font-light: 300;
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: 0 0% 3.6%;
    --foreground: 0 0% 98.2%;
    --card: 0 0% 3.6%;
    --card-foreground: 0 0% 98.2%;
    --popover: 0 0% 3.6%;
    --popover-foreground: 0 0% 98.2%;
    --muted: 0 0% 14.9%;
    --muted-foreground: 0 0% 63.9%;
    --accent: 0 84.2% 60.2%;
    --accent-foreground: 0 0% 3.6%;
    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 0 0% 3.6%;
    --border: 0 0% 14.9%;
    --input: 0 0% 14.9%;
    --primary: 0 0% 98.2%;
    --primary-foreground: 0 0% 3.6%;
    --secondary: 0 0% 14.9%;
    --secondary-foreground: 0 0% 98.2%;
    --ring: 0 84.2% 60.2%;
  }
}

/* ============================================================================
   RESET & BASE STYLES
   ============================================================================ */

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.5;
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  width: 100%;
  height: 100%;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  padding: 0;
  font-weight: var(--font-bold);
}

p {
  margin: 0;
  padding: 0;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

img, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ============================================================================
   APP LAYOUT - FLEXBOX/GRID HYBRID
   ============================================================================ */

html, body {
  width: 100%;
  height: 100%;
}

#app {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 100vh;
}

/* Header at top */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-4);
  background-color: hsl(var(--card));
  border-bottom: 1px solid hsl(var(--border));
  gap: var(--space-4);
  height: 60px;
  min-height: 60px;
  flex-shrink: 0;
  width: 100%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  z-index: 40;
}

/* Content area: sidebar + main */
.app-wrapper {
  display: flex;
  flex: 1;
  width: 100%;
  overflow: hidden;
}

/* Sidebar on left */
.sidebar {
  width: 240px;
  min-width: 240px;
  background-color: hsl(var(--card));
  border-right: 1px solid hsl(var(--border));
  display: flex;
  flex-direction: column;
  padding: var(--space-4);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 30;
  flex-shrink: 0;
  height: 100%;
}

/* Main content on right */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  width: 100%;
  z-index: 10;
}

.app-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--space-5);
  background-color: hsl(var(--background));
  width: 100%;
}

/* ============================================================================
   HEADER STYLES
   ============================================================================ */

.app-header__project-selector {
  flex: 1;
  min-width: 200px;
}

.app-header__team-selector {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.team-select {
  padding: var(--space-2) var(--space-3);
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all 200ms ease;
}

.team-select:hover {
  border-color: hsl(var(--primary));
  background-color: hsl(var(--muted));
}

.team-select:focus {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
}

.app-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.notification-toggle-container {
  position: relative;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: hsl(var(--destructive));
}

.ds-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: hsl(var(--primary));
  display: flex;
  align-items: center;
  justify-content: center;
  color: hsl(var(--primary-foreground));
  font-weight: var(--font-semibold);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all 200ms ease;
}

.ds-avatar:hover {
  opacity: 0.9;
}

/* ============================================================================
   SIDEBAR - HEADER & LOGO
   ============================================================================ */

.sidebar__header {
  padding-bottom: var(--space-4);
  border-bottom: 1px solid hsl(var(--border));
  margin-bottom: var(--space-4);
}

.sidebar__logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-weight: var(--font-semibold);
  font-size: var(--text-lg);
  color: hsl(var(--foreground));
}

.sidebar__logo-icon {
  width: 32px;
  height: 32px;
  background-color: hsl(var(--primary));
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: hsl(var(--primary-foreground));
  flex-shrink: 0;
}

.sidebar__logo-icon svg {
  width: 18px;
  height: 18px;
}

/* ============================================================================
   SIDEBAR - NAVIGATION
   ============================================================================ */

.sidebar__nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  padding: var(--space-4) 0;
  overflow-y: auto;
}

/* Navigation Section */
.nav-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.nav-section + .nav-section {
  padding-top: var(--space-4);
  border-top: 1px solid hsl(var(--border));
}

.nav-section__title {
  font-size: var(--text-xs);
  font-weight: var(--font-bold);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: hsl(var(--muted-foreground));
  padding-left: var(--space-3);
  margin-bottom: var(--space-2);
}

/* Navigation Item */
.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius);
  color: hsl(var(--foreground));
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  transition: all 200ms ease;
  cursor: pointer;
  user-select: none;
  border: 2px solid transparent;
  outline: none;
  position: relative;
  text-decoration: none;
}

.nav-item:hover {
  background-color: hsl(var(--muted));
  color: hsl(var(--primary));
}

.nav-item:focus {
  border-color: hsl(var(--ring));
  background-color: hsl(var(--muted));
  color: hsl(var(--primary));
  box-shadow: 0 0 0 1px hsl(var(--ring));
}

.nav-item.active {
  background-color: hsl(var(--accent) / 0.1);
  color: hsl(var(--accent));
  font-weight: var(--font-semibold);
  border-color: hsl(var(--accent));
}

.nav-item.active:focus {
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 1px hsl(var(--ring));
}

.nav-item__icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  transition: transform 200ms ease;
}

.nav-item:hover .nav-item__icon {
  transform: scale(1.05);
}

/* ============================================================================
   SIDEBAR - HELP PANEL & FOOTER
   ============================================================================ */

.sidebar__help {
  margin-top: auto;
  padding-top: var(--space-4);
  border-top: 1px solid hsl(var(--border));
  flex-shrink: 0;
}

.help-panel {
  width: 100%;
}

.help-panel__toggle {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius);
  cursor: pointer;
  user-select: none;
  width: 100%;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: hsl(var(--foreground));
  transition: all 200ms ease;
  background: none;
  border: none;
  text-align: left;
}

.help-panel__toggle:hover {
  background-color: hsl(var(--muted));
  color: hsl(var(--primary));
}

.help-panel__content {
  display: none;
  margin-top: var(--space-3);
  padding: var(--space-3);
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background-color: hsl(var(--muted));
  font-size: var(--text-xs);
}

.help-panel[open] .help-panel__content {
  display: block;
}

.help-section {
  margin-bottom: var(--space-3);
}

.help-section strong {
  display: block;
  margin-bottom: var(--space-2);
  color: hsl(var(--foreground));
  font-weight: var(--font-semibold);
}

.help-section ul,
.help-section ol {
  margin-left: var(--space-3);
  color: hsl(var(--muted-foreground));
}

.help-section li {
  margin-bottom: var(--space-1);
}

.sidebar__footer {
  padding-top: var(--space-4);
  text-align: center;
  font-size: var(--text-xs);
  color: hsl(var(--muted-foreground));
  flex-shrink: 0;
}

/* ============================================================================
   AI SIDEBAR (Right)
   ============================================================================ */

.app-sidebar {
  position: absolute;
  right: 0;
  top: 60px;
  width: 320px;
  height: calc(100vh - 60px);
  background-color: hsl(var(--card));
  border-left: 1px solid hsl(var(--border));
  overflow-y: auto;
  display: none;
  z-index: 20;
}

.app-sidebar[aria-expanded="true"] {
  display: block;
}

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ============================================================================
   BUTTON COMPONENT
   ============================================================================ */

ds-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  cursor: pointer;
  transition: all 200ms ease;
  border: 1px solid transparent;
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

ds-button:hover {
  opacity: 0.9;
}

ds-button:focus {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
}

ds-button[data-variant="ghost"] {
  background-color: transparent;
  color: hsl(var(--foreground));
  border: 1px solid transparent;
}

ds-button[data-variant="ghost"]:hover {
  background-color: hsl(var(--muted));
  color: hsl(var(--primary));
}

ds-button[data-size="icon"] {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

ds-button[data-size="icon"] svg {
  width: 18px;
  height: 18px;
}

/* ============================================================================
   BADGE COMPONENT
   ============================================================================ */

ds-badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  border: 1px solid hsl(var(--border));
  background-color: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
}

ds-badge[data-variant="outline"] {
  border: 1px solid hsl(var(--border));
  background-color: transparent;
  color: hsl(var(--foreground));
}

/* ============================================================================
   COMPONENT PLACEHOLDERS
   ============================================================================ */

ds-notification-center {
  display: block;
}

ds-ai-chat {
  display: block;
  width: 100%;
  height: 100%;
}

ds-toast-provider {
  display: block;
}

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */

/* Tablet */
@media (max-width: 1024px) {
  .sidebar {
    width: 200px;
    min-width: 200px;
    padding: var(--space-3);
  }

  .app-content {
    padding: var(--space-4);
  }
}

/* Mobile */
@media (max-width: 768px) {
  .app-header {
    padding: 0 var(--space-3);
  }

  .app-header__project-selector {
    display: none;
  }

  .app-header__team-selector {
    display: none;
  }

  .sidebar {
    position: fixed;
    left: -240px;
    width: 240px;
    height: calc(100vh - 60px);
    top: 60px;
    z-index: 100;
    transition: left 300ms ease;
    border-right: 1px solid hsl(var(--border));
    border-bottom: none;
  }

  .sidebar.open {
    left: 0;
  }

  .app-main {
    flex: 1;
    width: 100%;
  }

  .app-content {
    padding: var(--space-3);
  }
}

/* Small phones */
@media (max-width: 480px) {
  .app-header {
    padding: 0 var(--space-2);
    gap: var(--space-2);
  }

  .app-header__actions {
    gap: var(--space-2);
  }

  .sidebar {
    width: 240px;
    padding: var(--space-3);
  }

  .app-content {
    padding: var(--space-2);
  }
}

/* ============================================================================
   PROJECT SELECTOR
   ============================================================================ */

.project-selector {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.project-selector__label {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: hsl(var(--foreground));
  white-space: nowrap;
}

.project-selector__select {
  padding: var(--space-2) var(--space-3);
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all 200ms ease;
  min-width: 200px;
  appearance: none;
  padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  background-size: 12px;
}

.project-selector__select:hover {
  border-color: hsl(var(--primary));
  background-color: hsl(var(--muted));
}

.project-selector__select:focus {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
  border-color: hsl(var(--ring));
}

/* ============================================================================
   LANDING PAGE
   ============================================================================ */

.landing-page {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: var(--space-5);
  background-color: hsl(var(--background));
  width: 100%;
}

.landing-page.active {
  display: flex;
  flex-direction: column;
}

.landing-hero {
  margin-bottom: var(--space-8);
  padding: var(--space-8) 0;
  text-align: center;
}

.landing-hero h1 {
  font-size: var(--text-4xl);
  font-weight: var(--font-bold);
  color: hsl(var(--foreground));
  margin-bottom: var(--space-4);
}

.landing-hero p {
  font-size: var(--text-lg);
  color: hsl(var(--muted-foreground));
  max-width: 600px;
  margin: 0 auto;
}

.landing-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

.dashboard-category {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.dashboard-category__title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: hsl(var(--foreground));
  padding-bottom: var(--space-3);
  border-bottom: 1px solid hsl(var(--border));
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: var(--space-4);
  width: 100%;
}

.dashboard-card {
  display: flex;
  flex-direction: column;
  padding: var(--space-5);
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background-color: hsl(var(--card));
  text-decoration: none;
  color: hsl(var(--foreground));
  transition: all 200ms ease;
  cursor: pointer;
  gap: var(--space-3);
}

.dashboard-card:hover {
  border-color: hsl(var(--accent));
  background-color: hsl(var(--card));
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.dashboard-card:focus {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
}

.dashboard-card__icon {
  font-size: 2rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background-color: hsl(var(--muted));
  border-radius: var(--radius);
}

.dashboard-card__content {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex: 1;
}

.dashboard-card__title {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: hsl(var(--foreground));
}

.dashboard-card__description {
  font-size: var(--text-sm);
  color: hsl(var(--muted-foreground));
  line-height: 1.5;
}

.dashboard-card__meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: auto;
  font-size: var(--text-xs);
  color: hsl(var(--muted-foreground));
}
