/* ============================================
   ECOSYSTEM DIAGRAM SECTION
   The Complete Restaurant Operating System
   ============================================ */

.ecosystem-section {
  padding: 100px 0 120px;
  background: linear-gradient(180deg, #f0f7ff 0%, #f8fafc 30%, #ffffff 60%, #f0f4ff 100%);
  position: relative;
  overflow: hidden;
}

.ecosystem-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(circle at 15% 20%, rgba(59,130,246,0.04) 0%, transparent 50%),
    radial-gradient(circle at 85% 80%, rgba(14,165,233,0.04) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(99,102,241,0.03) 0%, transparent 60%);
  pointer-events: none;
}

/* Subtle grid pattern */
.ecosystem-section::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    linear-gradient(rgba(59,130,246,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59,130,246,0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
}

.ecosystem-section .container {
  position: relative;
  z-index: 2;
}

/* Header */
.ecosystem-header {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 70px;
}

.ecosystem-header .eco-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: #2563eb;
  background: linear-gradient(135deg, rgba(37,99,235,0.08), rgba(14,165,233,0.08));
  padding: 8px 20px;
  border-radius: 50px;
  border: 1px solid rgba(37,99,235,0.12);
  margin-bottom: 24px;
}

.ecosystem-header .eco-label::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2563eb;
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.5); }
}

.ecosystem-header h2 {
  font-family: var(--font-primary);
  font-size: var(--fs-3xl);
  font-weight: var(--fw-extrabold);
  color: var(--text-primary);
  line-height: var(--lh-tight);
  letter-spacing: -0.03em;
  margin-bottom: 18px;
}

.ecosystem-header h2 .gradient-text {
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.ecosystem-header p {
  font-size: var(--fs-base);
  color: var(--text-secondary);
  line-height: var(--lh-relaxed);
}

/* ---- MAIN DIAGRAM LAYOUT ---- */
.ecosystem-diagram {
  position: relative;
  max-width: 1200px;
  margin: 0 auto;
}

/* SVG connection lines layer */
.eco-connections-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.eco-connections-svg line,
.eco-connections-svg path {
  stroke: rgba(37,99,235,0.12);
  stroke-width: 1.5;
  fill: none;
  stroke-dasharray: 6 4;
  animation: dash-flow 20s linear infinite;
}

@keyframes dash-flow {
  to { stroke-dashoffset: -200; }
}

/* ---- CENTER HUB ---- */
.eco-center-hub {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  margin-bottom: 60px;
  position: relative;
  z-index: 10;
}

.device-mockup {
  position: relative;
  transition: transform 0.4s ease;
}

.device-mockup:hover {
  transform: translateY(-6px);
}

/* Tablet mockup */
.tablet-mockup {
  width: 340px;
  height: 240px;
  background: #0f172a;
  border-radius: 16px;
  padding: 10px;
  box-shadow:
    0 25px 60px rgba(15,23,42,0.2),
    0 10px 25px rgba(15,23,42,0.12),
    inset 0 1px 0 rgba(255,255,255,0.08);
}

.tablet-screen {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

.tablet-topbar {
  height: 28px;
  background: linear-gradient(90deg, #2563eb, #0ea5e9);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 6px;
}

.tablet-topbar .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
}

.tablet-topbar .bar {
  height: 3px;
  flex: 1;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
  margin-left: 8px;
}

.tablet-topbar .logo-text-mini {
  font-family: var(--font-primary);
  font-size: 0.96rem;
  font-weight: 700;
  color: white;
  letter-spacing: 1px;
}

.tablet-content {
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.tab-stat-card {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  padding: 10px;
}

.tab-stat-card .stat-label {
  font-size: 0.5rem;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.tab-stat-card .stat-val {
  font-family: var(--font-primary);
  font-size: 1.07rem;
  font-weight: 700;
  color: white;
}

.tab-stat-card .stat-val.green { color: #34d399; }
.tab-stat-card .stat-val.blue { color: #60a5fa; }
.tab-stat-card .stat-val.orange { color: #fb923c; }

.tab-chart-row {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

.tab-mini-chart {
  flex: 1;
  height: 60px;
  background: rgba(255,255,255,0.04);
  border-radius: 6px;
  display: flex;
  align-items: flex-end;
  padding: 6px 8px;
  gap: 3px;
}

.tab-mini-chart .bar-item {
  flex: 1;
  border-radius: 2px 2px 0 0;
  min-height: 6px;
  transition: height 0.4s ease;
}

.tab-mini-chart.chart-1 .bar-item:nth-child(1) { height: 35%; background: #3b82f6; }
.tab-mini-chart.chart-1 .bar-item:nth-child(2) { height: 55%; background: #60a5fa; }
.tab-mini-chart.chart-1 .bar-item:nth-child(3) { height: 75%; background: #3b82f6; }
.tab-mini-chart.chart-1 .bar-item:nth-child(4) { height: 90%; background: #2563eb; }
.tab-mini-chart.chart-1 .bar-item:nth-child(5) { height: 65%; background: #60a5fa; }
.tab-mini-chart.chart-1 .bar-item:nth-child(6) { height: 80%; background: #3b82f6; }

.tab-mini-chart.chart-2 .bar-item:nth-child(1) { height: 50%; background: #f59e0b; }
.tab-mini-chart.chart-2 .bar-item:nth-child(2) { height: 70%; background: #f97316; }
.tab-mini-chart.chart-2 .bar-item:nth-child(3) { height: 40%; background: #fb923c; }
.tab-mini-chart.chart-2 .bar-item:nth-child(4) { height: 85%; background: #f59e0b; }
.tab-mini-chart.chart-2 .bar-item:nth-child(5) { height: 60%; background: #f97316; }
.tab-mini-chart.chart-2 .bar-item:nth-child(6) { height: 45%; background: #fb923c; }

.tab-orders-list {
  flex: 1;
  height: 60px;
  background: rgba(255,255,255,0.04);
  border-radius: 6px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.tab-order-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tab-order-row .order-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
}

.tab-order-row .order-dot.green { background: #34d399; }
.tab-order-row .order-dot.yellow { background: #fbbf24; }
.tab-order-row .order-dot.blue { background: #60a5fa; }

.tab-order-row .order-line {
  height: 2px;
  flex: 1;
  background: rgba(255,255,255,0.08);
  border-radius: 1px;
}

.tab-order-row .order-amount {
  font-size: 0.57rem;
  color: rgba(255,255,255,0.5);
  font-weight: 600;
}

/* Mobile mockup */
.mobile-mockup {
  width: 140px;
  height: 260px;
  background: #0f172a;
  border-radius: 22px;
  padding: 8px;
  box-shadow:
    0 25px 60px rgba(15,23,42,0.2),
    0 10px 25px rgba(15,23,42,0.12),
    inset 0 1px 0 rgba(255,255,255,0.08);
}

.mobile-screen {
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #1e293b, #0f172a);
  border-radius: 16px;
  overflow: hidden;
  position: relative;
}

.mobile-notch {
  width: 50px;
  height: 5px;
  background: #0f172a;
  border-radius: 3px;
  margin: 6px auto 8px;
}

.mobile-header {
  padding: 0 10px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mobile-header .mh-title {
  font-size: 0.5rem;
  font-weight: 700;
  color: white;
}

.mobile-header .mh-avatar {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
}

.mobile-qr-area {
  margin: 0 10px;
  background: white;
  border-radius: 10px;
  padding: 10px;
  text-align: center;
}

.mobile-qr-area .qr-grid {
  width: 60px;
  height: 60px;
  margin: 0 auto 6px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: 2px;
}

.mobile-qr-area .qr-grid .qr-cell {
  background: #0f172a;
  border-radius: 1px;
}

.mobile-qr-area .qr-grid .qr-cell.empty {
  background: transparent;
}

.mobile-qr-area .qr-text {
  font-size: 0.54rem;
  font-weight: 700;
  color: #0f172a;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.mobile-menu-items {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.mobile-menu-row {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.04);
  border-radius: 6px;
  padding: 5px 6px;
}

.mobile-menu-row .food-icon {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: linear-gradient(135deg, #f59e0b, #f97316);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.57rem;
}

.mobile-menu-row .food-info {
  flex: 1;
}

.mobile-menu-row .food-name {
  font-size: 0.4rem;
  color: rgba(255,255,255,0.7);
  font-weight: 600;
}

.mobile-menu-row .food-price {
  font-size: 0.38rem;
  color: rgba(255,255,255,0.4);
}

.mobile-menu-row .add-btn {
  font-size: 0.38rem;
  background: #2563eb;
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
}

.mobile-bottom-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 28px;
  background: rgba(15,23,42,0.9);
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 0 12px;
}

.mobile-bottom-bar .nav-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
}

.mobile-bottom-bar .nav-dot.active {
  background: #3b82f6;
  width: 14px;
  border-radius: 2px;
}

/* Center label */
.eco-center-label {
  text-align: center;
  margin-bottom: 60px;
  position: relative;
  z-index: 10;
}

.eco-center-label .hub-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: white;
  padding: 10px 24px;
  border-radius: 50px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-normal);
  box-shadow: 0 8px 25px rgba(15,23,42,0.2);
}

.eco-center-label .hub-badge .hub-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34d399;
  animation: pulse-dot 2s ease infinite;
}

/* ---- MODULE CATEGORIES ---- */
.eco-categories {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  position: relative;
  z-index: 5;
}

.eco-category {
  background: white;
  border-radius: 16px;
  border: 1px solid rgba(226,232,240,0.8);
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.eco-category:hover {
  transform: translateY(-6px);
  box-shadow:
    0 20px 40px rgba(15,23,42,0.08),
    0 8px 16px rgba(15,23,42,0.04);
  border-color: rgba(37,99,235,0.15);
}

.eco-cat-header {
  padding: 18px 20px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #f1f5f9;
}

.eco-cat-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.07rem;
  flex-shrink: 0;
}

.eco-cat-icon.blue   { background: #eff6ff; color: #2563eb; }
.eco-cat-icon.green  { background: #f0fdf4; color: #16a34a; }
.eco-cat-icon.orange { background: #fff7ed; color: #ea580c; }
.eco-cat-icon.purple { background: #faf5ff; color: #9333ea; }
.eco-cat-icon.red    { background: #fef2f2; color: #dc2626; }
.eco-cat-icon.teal   { background: #f0fdfa; color: #0d9488; }
.eco-cat-icon.indigo { background: #eef2ff; color: #4f46e5; }
.eco-cat-icon.amber  { background: #fffbeb; color: #d97706; }

.eco-cat-header h4 {
  font-family: var(--font-primary);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  line-height: 1.3;
  letter-spacing: var(--ls-normal);
}

.eco-cat-modules {
  padding: 10px 14px 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.eco-module {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.96rem;
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  transition: all 0.25s ease;
  cursor: default;
  white-space: nowrap;
}

.eco-module:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1e40af;
  transform: translateY(-1px);
}

.eco-module .mod-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.eco-module .mod-dot.blue   { background: #3b82f6; }
.eco-module .mod-dot.green  { background: #22c55e; }
.eco-module .mod-dot.orange { background: #f97316; }
.eco-module .mod-dot.purple { background: #a855f7; }
.eco-module .mod-dot.red    { background: #ef4444; }
.eco-module .mod-dot.teal   { background: #14b8a6; }
.eco-module .mod-dot.indigo { background: #6366f1; }
.eco-module .mod-dot.amber  { background: #f59e0b; }

/* ---- FLOW CONNECTIONS (below the grid) ---- */
.eco-flow-section {
  margin-top: 50px;
  position: relative;
  z-index: 5;
}

.eco-flow-title {
  text-align: center;
  margin-bottom: 28px;
}

.eco-flow-title h3 {
  font-family: var(--font-primary);
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  letter-spacing: var(--ls-tight);
}

.eco-flow-title h3 .accent {
  color: #2563eb;
}

.eco-flow-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.flow-connection {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 50px;
  font-size: 0.90rem;
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
  letter-spacing: var(--ls-normal);
  transition: all 0.3s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.flow-connection:hover {
  border-color: #bfdbfe;
  background: #f0f7ff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37,99,235,0.08);
}

.flow-connection .flow-from,
.flow-connection .flow-to {
  font-weight: 600;
  color: #0f172a;
}

.flow-connection .flow-arrow {
  color: #2563eb;
  font-size: 0.97rem;
  display: flex;
  align-items: center;
}

.flow-connection .flow-arrow svg {
  width: 16px;
  height: 16px;
  stroke: #2563eb;
  fill: none;
  stroke-width: 2;
}

/* ---- ANIMATED ORBIT RINGS ---- */
.eco-orbit-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 500px;
  height: 500px;
  pointer-events: none;
  z-index: 0;
}

.orbit-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px dashed rgba(37,99,235,0.08);
}

.orbit-ring-1 {
  width: 300px;
  height: 300px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: orbit-spin 60s linear infinite;
}

.orbit-ring-2 {
  width: 450px;
  height: 450px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: orbit-spin 90s linear infinite reverse;
}

@keyframes orbit-spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.orbit-particle {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(37,99,235,0.2);
}

.orbit-ring-1 .orbit-particle:nth-child(1) { top: 0; left: 50%; }
.orbit-ring-1 .orbit-particle:nth-child(2) { bottom: 0; left: 50%; }
.orbit-ring-1 .orbit-particle:nth-child(3) { top: 50%; left: 0; }
.orbit-ring-2 .orbit-particle:nth-child(1) { top: 10%; right: 10%; background: rgba(14,165,233,0.15); }
.orbit-ring-2 .orbit-particle:nth-child(2) { bottom: 10%; left: 10%; background: rgba(14,165,233,0.15); }

/* ---- RESPONSIVE ---- */
@media (max-width: 1024px) {
  .eco-categories {
    grid-template-columns: repeat(2, 1fr);
  }

  .tablet-mockup {
    width: 280px;
    height: 200px;
  }

  .mobile-mockup {
    width: 120px;
    height: 220px;
  }
}

@media (max-width: 768px) {
  .ecosystem-header h2 {
    font-size: 2rem;
  }

  .eco-categories {
    grid-template-columns: 1fr;
  }

  .eco-center-hub {
    flex-direction: column;
    gap: 16px;
  }

  .tablet-mockup {
    width: 100%;
    max-width: 340px;
    height: 240px;
  }

  .mobile-mockup {
    display: none;
  }

  .eco-flow-grid {
    flex-direction: column;
    align-items: center;
  }
}
