/* Aquamentum Dashboard - Layout */

.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--color-bg-sidebar);
  color: var(--color-text-light);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform var(--transition-base);
}

.sidebar-header {
  padding: var(--space-lg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--color-white);
}

.sidebar-logo img {
  width: 240px;
  fill: var(--color-secondary);
}

/* Navigation */
.sidebar-nav {
  flex: 1;
  padding: var(--space-md);
  overflow-y: auto;
  /* Hide scrollbar but keep functionality */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}

.sidebar-nav::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

.nav-section {
  margin-bottom: var(--space-sm);
}

.nav-group-label {
  font-size: var(--font-size-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.25);
  padding: var(--space-md) var(--space-md) var(--space-xs);
  margin-top: var(--space-sm);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.5);
  padding: var(--space-sm) var(--space-md);
  margin-bottom: var(--space-xs);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  user-select: none;
}

.nav-section-title:hover {
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.7);
}

.nav-section-title-left {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.nav-section-title svg {
  width: 14px;
  height: 14px;
}

.nav-section-toggle {
  width: 16px;
  height: 16px;
  transition: transform var(--transition-fast);
}

.nav-section.collapsed .nav-section-toggle {
  transform: rotate(-90deg);
}

.nav-section-items {
  overflow: hidden;
  transition: max-height var(--transition-normal), opacity var(--transition-fast);
  max-height: 1200px;
  opacity: 1;
}

.nav-section.collapsed .nav-section-items {
  max-height: 0;
  opacity: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  min-height: 40px;
  border-radius: var(--radius-md);
  color: rgba(255, 255, 255, 0.8);
  transition: all var(--transition-fast);
  margin-bottom: 2px;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-white);
}

.nav-item.active {
  background: var(--color-secondary);
  color: var(--color-white);
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Main Content */
.main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100vh;
}

/* Header */
.header {
  height: var(--header-height);
  background: var(--color-bg-card);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-xl);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-shrink: 0;
}

/* Mobile Suche-Icon: nur auf Mobile sichtbar */
.search-toggle-mobile {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  color: var(--color-text);
  cursor: pointer;
  border-radius: var(--radius-md);
}

.search-toggle-mobile svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
}

/* Content Area */
.content {
  flex: 1;
  padding: var(--space-xl);
  overflow-y: auto;
  min-height: 0;
  /* Custom Scrollbar */
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}

/* Pipeline-Modus: gesamte Flex-Kette bis zur Pipeline durchziehen */
.content.pipeline-mode {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding-bottom: 0;
}

.content.pipeline-mode .page.active,
.content.pipeline-mode #crm-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.content::-webkit-scrollbar {
  width: 6px;
}

.content::-webkit-scrollbar-track {
  background: transparent;
}

.content::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 3px;
}

.content::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

/* Page Container */
.page {
  display: none;
}

.page.active {
  display: block;
}

/* Cards */
.card {
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
}

.card-header {
  padding: var(--space-lg);
  border-bottom: 1px solid var(--color-border);
}

.card-body {
  padding: var(--space-lg);
}

/* Grid System */
.grid {
  display: grid;
  gap: var(--space-lg);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

/* Header Left */
.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  min-width: 0;
  flex: 1;
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Hamburger Menu Toggle — standardmäßig ausgeblendet (nur Mobile) */
.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: none;
  color: var(--color-text);
  cursor: pointer;
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.menu-toggle svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
}

.menu-toggle:hover {
  background: var(--color-bg);
}

/* ============================================
   MOBILE BREAKPOINTS (max-width: 768px)
   ============================================ */

/* Sidebar Overlay Backdrop */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
  backdrop-filter: blur(2px);
}

@media (max-width: 768px) {
  /* Sidebar: Slide-in Overlay */
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  /* Backdrop anzeigen wenn Sidebar offen */
  .sidebar-overlay.active {
    display: block;
  }

  /* Main: kein Seitenabstand */
  .main {
    margin-left: 0;
  }

  /* Hamburger anzeigen */
  .menu-toggle {
    display: flex;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
  }

  /* Mobile Suche-Icon anzeigen */
  .search-toggle-mobile {
    display: flex;
  }

  /* Header: kompakter auf Mobile */
  .header {
    padding: 0 var(--space-md);
    gap: var(--space-sm);
  }

  /* Suche auf Mobile ausblenden (zu wenig Platz) */
  .search-container {
    display: none;
  }

  /* Content: weniger Padding */
  .content {
    padding: var(--space-md);
  }

  /* Grids: schmal auf Mobile */
  .grid-2, .grid-3 {
    grid-template-columns: 1fr;
  }

  /* 4er-Grid: 2×2 auf Mobile */
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Page Header: kompakter */
  .page-header {
    margin-bottom: var(--space-md);
  }

  /* Quick Links: 1 Spalte */
  .quick-links {
    grid-template-columns: 1fr;
  }
}

/* Sidebar Footer */
.sidebar-footer {
  padding: var(--space-md);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Logo Icon Color */
.sidebar-logo svg {
  color: var(--color-secondary);
  stroke: var(--color-secondary);
}

/* Page Header */
.page-header {
  margin-bottom: var(--space-xl);
}

.page-header h1 {
  margin-bottom: var(--space-xs);
}

.page-subtitle {
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}

/* Quick Links */
.quick-links {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
}

.quick-link {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: var(--color-bg);
  border-radius: var(--radius-md);
  color: var(--color-text);
  transition: all var(--transition-fast);
}

.quick-link:hover {
  background: var(--color-secondary);
  color: var(--color-white);
}

.quick-link svg {
  width: 20px;
  height: 20px;
}

/* Info List */
.info-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.info-label {
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}

.info-value {
  font-weight: 500;
}

/* Card Header with Icon */
.card-header h3 {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--font-size-lg);
}

.card-header h3 svg {
  width: 20px;
  height: 20px;
  color: var(--color-secondary);
}
