/* Praxis Luebberding Workflow-Dokumentation - Custom Styles */
/* Adapted from STARQstrom Partner Portal */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #60a5fa;
  --primary-50: #eff6ff;
  --primary-100: #dbeafe;
  --primary-200: #bfdbfe;
  --primary-300: #93c5fd;
  --primary-400: #60a5fa;
  --primary-500: #2563eb;
  --primary-600: #1d4ed8;
  --primary-700: #1e40af;
  --primary-800: #1e3a8a;
  --primary-900: #172554;
  --dark: #111111;
  --dark-sidebar: #1a1a1a;
}

/* Sidebar */
.sidebar {
  width: 260px;
  min-height: 100vh;
  background-color: var(--dark-sidebar);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
}

.sidebar-logo {
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo .logo-text {
  font-size: 1.125rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.sidebar-logo .logo-accent {
  color: var(--primary);
}

.sidebar-logo-img {
  max-width: 180px;
  height: auto;
  display: block;
  margin-bottom: 0.5rem;
}

.sidebar-logo .logo-subtitle {
  font-size: 0.6875rem;
  color: #6b7280;
  margin-top: 0.25rem;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0;
  overflow-y: auto;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1.5rem;
  color: #9ca3af;
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 500;
  transition: all 0.15s ease;
}

.sidebar-nav a:hover {
  color: #ffffff;
  background-color: rgba(255,255,255,0.05);
}

.sidebar-nav a.active {
  color: var(--primary-light);
  background-color: rgba(37, 99, 235, 0.1);
  border-right: 3px solid var(--primary);
}

.sidebar-nav a svg {
  width: 1.125rem;
  height: 1.125rem;
  flex-shrink: 0;
}

.sidebar-nav .nav-count {
  margin-left: auto;
  font-size: 0.6875rem;
  color: #6b7280;
  background: rgba(255,255,255,0.08);
  padding: 0.0625rem 0.375rem;
  border-radius: 0.25rem;
}

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 0.6875rem;
  color: #6b7280;
}

/* Main Content */
.main-content {
  margin-left: 260px;
  min-height: 100vh;
  background-color: #f9fafb;
}

.page-header {
  padding: 1.5rem 2rem;
  background-color: #ffffff;
  border-bottom: 1px solid #e5e7eb;
}

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #111827;
}

.page-header p {
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: #6b7280;
}

.page-body {
  padding: 1.5rem 2rem;
}

/* KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  background-color: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1.25rem;
}

.kpi-card-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: #6b7280;
}

.kpi-card-value {
  margin-top: 0.25rem;
  font-size: 1.75rem;
  font-weight: 700;
  color: #111827;
  letter-spacing: -0.02em;
}

.kpi-card-sub {
  margin-top: 0.125rem;
  font-size: 0.6875rem;
  color: #9ca3af;
}

/* Search */
.search-container {
  position: relative;
  margin-bottom: 1.5rem;
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.125rem;
  height: 1.125rem;
  color: #9ca3af;
}

.search-input {
  width: 100%;
  padding: 0.625rem 0.75rem 0.625rem 2.5rem;
  font-size: 0.875rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  background-color: #ffffff;
  outline: none;
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.search-count {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.75rem;
  color: #9ca3af;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  border-radius: 9999px;
  white-space: nowrap;
}

.badge-green {
  background-color: #dcfce7;
  color: #166534;
}

.badge-yellow {
  background-color: #fef9c3;
  color: #854d0e;
}

.badge-red {
  background-color: #fee2e2;
  color: #991b1b;
}

.badge-blue {
  background-color: var(--primary-100);
  color: var(--primary-700);
}

.badge-gray {
  background-color: #f3f4f6;
  color: #374151;
}

.badge-purple {
  background-color: #ede9fe;
  color: #5b21b6;
}

.badge-orange {
  background-color: #ffedd5;
  color: #9a3412;
}

.badge-teal {
  background-color: #ccfbf1;
  color: #115e59;
}

.badge-pink {
  background-color: #fce7f3;
  color: #9d174d;
}

/* Trigger Badges */
.trigger-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  border-radius: 0.25rem;
}

.trigger-jotform {
  background-color: #fef9c3;
  color: #854d0e;
}

.trigger-schedule {
  background-color: var(--primary-100);
  color: var(--primary-700);
}

.trigger-webhook {
  background-color: #ede9fe;
  color: #5b21b6;
}

.trigger-slack {
  background-color: #fce7f3;
  color: #9d174d;
}

.trigger-subworkflow {
  background-color: #f3f4f6;
  color: #374151;
}

.trigger-airtable {
  background-color: #dcfce7;
  color: #166534;
}

.trigger-trello {
  background-color: var(--primary-100);
  color: var(--primary-800);
}

.trigger-drive {
  background-color: #ffedd5;
  color: #9a3412;
}

.trigger-email {
  background-color: #fee2e2;
  color: #991b1b;
}

.trigger-error {
  background-color: #fee2e2;
  color: #991b1b;
}

/* Service Tags */
.service-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.service-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.0625rem 0.375rem;
  font-size: 0.625rem;
  font-weight: 500;
  border-radius: 0.25rem;
  background-color: #f3f4f6;
  color: #6b7280;
}

/* Category Headers */
.category-section {
  margin-bottom: 2rem;
}

.category-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.category-icon {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.375rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.category-icon svg {
  width: 1rem;
  height: 1rem;
}

.category-title {
  font-size: 1rem;
  font-weight: 600;
  color: #111827;
}

.category-count {
  font-size: 0.6875rem;
  color: #9ca3af;
  font-weight: 500;
}

/* Workflow Card Grid */
.wf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1rem;
  align-items: start;
}

/* Workflow Card */
.wf-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1.25rem;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.wf-card:hover {
  border-color: var(--primary-300);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
}

.wf-card.hidden {
  display: none;
}

.wf-card-header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.wf-card-icon {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.wf-card-icon svg {
  width: 1.125rem;
  height: 1.125rem;
}

.wf-card-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #111827;
  line-height: 1.3;
}

.wf-card-desc {
  font-size: 0.8125rem;
  color: #6b7280;
  line-height: 1.5;
}

.wf-card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}

/* Expandable Details */
.wf-card-details {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  margin-top: 0;
  padding-top: 0;
  border-top: 1px solid transparent;
  transition: max-height 0.4s ease, opacity 0.3s ease, margin-top 0.3s ease, padding-top 0.3s ease, border-color 0.3s ease;
}

.wf-card-details.open {
  max-height: 3000px;
  opacity: 1;
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top-color: #f3f4f6;
}

.wf-card-details-title {
  font-size: 0.6875rem;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.375rem;
}

.wf-card-details-text {
  font-size: 0.8125rem;
  color: #374151;
  line-height: 1.6;
  margin-bottom: 0.75rem;
}

.wf-card-details-list {
  list-style: none;
  padding: 0;
  margin: 0 0 0.75rem 0;
}

.wf-card-details-list li {
  font-size: 0.8125rem;
  color: #374151;
  padding: 0.125rem 0;
  padding-left: 1rem;
  position: relative;
}

.wf-card-details-list li::before {
  content: "\2022";
  color: var(--primary);
  position: absolute;
  left: 0;
}

.wf-card-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  border: none;
  background: none;
  padding: 0.25rem 0;
  margin-top: auto;
}

.wf-card-toggle:hover {
  color: var(--primary-dark);
}

.wf-card-toggle svg {
  width: 0.875rem;
  height: 0.875rem;
  transition: transform 0.15s ease;
}

.wf-card-toggle.open svg {
  transform: rotate(180deg);
}

/* Detail: Trigger Box */
.detail-trigger {
  background: var(--primary-50);
  border: 1px solid var(--primary-200);
  border-radius: 0.5rem;
  padding: 0.625rem 0.75rem;
  margin-bottom: 0.75rem;
  font-size: 0.8125rem;
  color: var(--primary-800);
  line-height: 1.5;
}

.detail-trigger strong {
  color: var(--primary-700);
}

/* Detail: Step Timeline */
.detail-steps {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 0.75rem;
}

.detail-step {
  display: flex;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-left: 2px solid var(--primary-200);
  margin-left: 0.75rem;
  padding-left: 1rem;
  position: relative;
}

.detail-step:last-child {
  border-left-color: transparent;
}

.detail-step-num {
  position: absolute;
  left: -0.875rem;
  top: 0.5rem;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 9999px;
  background: var(--primary);
  color: #ffffff;
  font-size: 0.6875rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.detail-step-content {
  flex: 1;
  min-width: 0;
}

.detail-step-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 0.125rem;
}

.detail-step-body {
  font-size: 0.8125rem;
  color: #4b5563;
  line-height: 1.6;
}

.detail-step-body em {
  color: #6b7280;
  font-style: italic;
}

.detail-step-body ul {
  list-style: none;
  padding: 0;
  margin: 0.25rem 0 0 0;
}

.detail-step-body ul li {
  padding-left: 0.875rem;
  position: relative;
  font-size: 0.75rem;
  color: #6b7280;
  line-height: 1.5;
}

.detail-step-body ul li::before {
  content: "\2022";
  color: var(--primary-400);
  position: absolute;
  left: 0;
}

/* Detail: Condition/Special Case Box */
.detail-condition {
  background: #fef9c3;
  border: 1px solid #fde68a;
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
  font-size: 0.8125rem;
  color: #92400e;
  line-height: 1.5;
}

.detail-condition strong {
  color: #78350f;
}

/* Detail: Connected Processes */
.detail-connections {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-top: 0.25rem;
}

.detail-connections a,
.detail-connections span {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.1875rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: 500;
  border-radius: 0.25rem;
  background: var(--primary-50);
  color: var(--primary-700);
  text-decoration: none;
}

/* Detail: Section Label */
.detail-label {
  font-size: 0.625rem;
  font-weight: 700;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.375rem;
  margin-top: 0.5rem;
}

/* Connected Workflows */
.wf-connection {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: 500;
  border-radius: 0.25rem;
  background-color: var(--primary-50);
  color: var(--primary-700);
  text-decoration: none;
}

/* Service Overview Table */
.service-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  overflow: hidden;
}

.service-table thead th {
  padding: 0.625rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background-color: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}

.service-table tbody td {
  padding: 0.625rem 1rem;
  font-size: 0.8125rem;
  color: #374151;
  border-bottom: 1px solid #f3f4f6;
}

.service-table tbody tr:last-child td {
  border-bottom: none;
}

.service-table tbody tr:hover {
  background-color: #f9fafb;
}

/* System Intro */
.system-intro {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1.25rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  color: #374151;
  line-height: 1.7;
}

.system-intro strong {
  color: #111827;
}

/* Process Flow */
.process-flow {
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, var(--primary-50) 0%, #ffffff 100%);
  border: 1px solid var(--primary-200);
  border-radius: 0.75rem;
}

.flow-step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  background: #ffffff;
  border: 1px solid var(--primary-200);
  border-radius: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--primary-800);
  white-space: nowrap;
}

.flow-step svg {
  width: 1rem;
  height: 1rem;
  color: var(--primary);
  flex-shrink: 0;
}

.flow-arrow {
  padding: 0 0.375rem;
  color: var(--primary-400);
  font-size: 1rem;
  flex-shrink: 0;
}

/* Responsive */
@media (max-width: 1024px) {
  .sidebar {
    display: none;
  }
  .main-content {
    margin-left: 0;
  }
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  .wf-grid {
    grid-template-columns: 1fr;
  }
  .page-header, .page-body {
    padding: 1rem;
  }
}
