﻿/* ==========================================
   NRCrobo 联核机器人 — Layout System
   ========================================== */

/* --- Safe Area --- */
.safe-top { padding-top: env(safe-area-inset-top, 0px); }
.safe-bottom { padding-bottom: env(safe-area-inset-bottom, 0px); }

/* --- App Shell --- */
.app-shell {
  max-width: var(--content-max-width);
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg-primary);
  position: relative;
}

/* --- Page Container --- */
.page {
  padding-top: var(--header-height);
  padding-bottom: calc(var(--tabbar-height) + var(--tabbar-safe-bottom));
  min-height: 100vh;
  min-height: 100dvh;
}
.page-no-tabbar {
  padding-bottom: 0;
}
.page-content {
  padding: var(--space-4);
}
.page-content-sm {
  padding: var(--space-3);
}

/* --- Header / Navigation Bar --- */
.navbar {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--content-max-width);
  height: var(--header-height);
  padding: 0 var(--space-4);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  z-index: var(--z-header);
}
.navbar-safe { padding-top: env(safe-area-inset-top, 0px); height: calc(var(--header-height) + env(safe-area-inset-top, 0px)); }
.navbar-title {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  flex: 1;
  text-align: center;
}
.navbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 64px;
}
.navbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 64px;
  justify-content: flex-end;
}
.navbar-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  transition: background 0.2s;
}
.navbar-btn:active { background: var(--border-light); }
.navbar-back { color: var(--text-primary); font-size: var(--text-lg); }
.navbar-back svg { vertical-align: middle; }

/* Logo */
.navbar-logo { display: flex; align-items: center; gap: var(--space-2); }
.navbar-logo .logo-nrc {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--primary);
}
.navbar-logo .logo-brand {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--secondary);
}

/* --- City Selector --- */
.city-selector {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
  transition: background 0.2s;
}
.city-selector:active { background: var(--border-light); }
.city-selector svg { flex-shrink: 0; }

/* --- Tab Bar (Bottom) --- */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--content-max-width);
  height: calc(var(--tabbar-height) + var(--tabbar-safe-bottom));
  padding-bottom: var(--tabbar-safe-bottom);
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  z-index: var(--z-tabbar);
  box-shadow: 0 -1px 4px rgba(0,0,0,0.04);
}
.tabbar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 100%;
  color: var(--text-muted);
  font-size: var(--text-xs);
  transition: color 0.2s;
  position: relative;
}
.tabbar-item.active { color: var(--primary); }
.tabbar-item svg { width: 24px; height: 24px; }
.tabbar-item .badge {
  position: absolute;
  top: 4px;
  right: 50%;
  margin-right: -18px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
  border-radius: var(--radius-full);
}

/* --- Section Block --- */
.section-block {
  margin-bottom: var(--space-4);
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
  padding: 0 var(--space-1);
}
.section-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}
.section-more {
  font-size: var(--text-sm);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 2px;
}
.section-more:active { color: var(--primary); }

/* --- Banner / Carousel --- */
.banner-wrap {
  margin: 0;
  border-radius: 0;
  overflow: hidden;
  position: relative;
  height: 200px;
  background: var(--secondary);
}
.banner-slide {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 0;
  left: 0;
  overflow: hidden;
}
.banner-dots {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
}
.banner-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.5);
  transition: all 0.3s;
}
.banner-dot.active { width: 18px; border-radius: 3px; background: var(--primary); }

/* --- Grid --- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--space-3); }

/* --- Card --- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, transform 0.2s;
}
.card:active { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.card-body { padding: var(--space-4); }

/* Horizontal Scroll */
.scroll-x {
  display: flex;
  gap: var(--space-3);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding: 0 var(--space-4);
  scrollbar-width: none;
}
.scroll-x::-webkit-scrollbar { display: none; }
.scroll-x .card,
.scroll-x .solution-card { scroll-snap-align: start; flex-shrink: 0; }

/* --- Category Nav (Grid Icons) --- */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-3);
  padding: var(--space-4);
}
.cat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  text-align: center;
}
.cat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--primary-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}
.cat-icon svg { width: 24px; height: 24px; }
.cat-label {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  line-height: 1.3;
}
.cat-item:active .cat-icon { background: var(--brand-orange); color: #fff; }

/* --- Info Card (Article/News) --- */
.info-card {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border-light);
}
.info-card:last-child { border-bottom: none; }
.info-card-img {
  width: 100px;
  height: 72px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--border-light);
}
.info-card-img img { width: 100%; height: 100%; object-fit: cover; }
.info-card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.info-card-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.info-card-meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: auto;
}

/* --- Tag --- */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  font-size: 10px;
  font-weight: var(--weight-medium);
  line-height: 1.6;
}
.tag-primary { background: var(--primary-bg); color: var(--primary); }
.tag-blue { background: var(--info-bg); color: var(--info); }
.tag-green { background: var(--success-bg); color: var(--success); }
.tag-warning { background: var(--warning-bg); color: var(--warning); }
.tag-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

/* --- Divider --- */
.divider { height: 1px; background: var(--border-light); margin: 0 var(--space-4); }

/* --- Spacer --- */
.spacer-4 { height: var(--space-4); }
.spacer-8 { height: var(--space-8); }
.spacer-12 { height: var(--space-12); }



