/* ============================================
   GOMATERIALS INTERNAL HUB
   Design system: GoMaterials greens + Inter
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ── Variables ────────────────────────────── */
:root {
  --accent:       #2E9B5C;
  --accent-hover: #257a4a;
  --accent-light: #dcfce7;
  --accent-text:  #166534;

  --sidebar-w: 264px;

  --bg:             #f5f7fa;
  --surface:        #ffffff;
  --border:         #e5e7eb;
  --border-subtle:  #f0f1f3;
  --border-strong:  #d1d5db;

  --text:           #1a1a1a;
  --text-secondary: #4b5563;
  --text-muted:     #9ca3af;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 2px 8px rgba(0,0,0,.08);
  --shadow-lg: 0 4px 16px rgba(0,0,0,.12);
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout shell ─────────────────────────── */
.hub-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ──────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* header */
.sidebar-header {
  padding: 18px 16px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-mark {
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  flex-shrink: 0;
  object-fit: cover;
  display: block;
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.logo-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
}

.logo-subtitle {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

/* nav */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0 20px;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.nav-section {
  margin-bottom: 2px;
}

.nav-section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  padding: 14px 14px 5px;
}

.nav-section-icon {
  display: flex;
  align-items: center;
  color: var(--text-muted);
}

.nav-list {
  list-style: none;
}

.nav-item {
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px 7px 26px; /* indented under category label */
  text-align: left;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 500;
  transition: background 120ms, color 120ms;
  position: relative;
}

.nav-item:not([disabled]):hover {
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}

.nav-item.active {
  background: var(--accent-light);
  color: var(--accent-text);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 5px;
  bottom: 5px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.nav-item[disabled] {
  opacity: 0.45;
  cursor: default;
}

.nav-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 99px;
  flex-shrink: 0;
  line-height: 1.4;
}
.nav-badge.live  { background: var(--accent-light); color: var(--accent-text); }
.nav-badge.beta  { background: #fef3c7;             color: #92400e; }
.nav-badge.soon  { background: #f3f4f6;             color: var(--text-muted); }

/* ── Main wrapper ─────────────────────────── */
.main-wrapper {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Mobile top bar ───────────────────────── */
.mobile-top-bar {
  display: none; /* shown via media query */
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.mobile-logo {
  display: flex;
  align-items: center;
  gap: 9px;
}

.mobile-logo .logo-mark {
  width: 30px;
  height: 30px;
}

.mobile-logo-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.hamburger-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  border-radius: var(--r-sm);
  transition: background 120ms;
}
.hamburger-btn:hover { background: var(--bg); }

/* ── Welcome screen ───────────────────────── */
.welcome-screen {
  flex: 1;
  overflow-y: auto;
  padding: 36px 40px 48px;
}

.welcome-screen.hidden { display: none; }

.welcome-intro {
  margin-bottom: 32px;
}

.welcome-intro h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.welcome-intro p {
  font-size: 14px;
  color: var(--text-secondary);
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

/* category card */
.category-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.category-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.category-card-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--r-md);
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.category-card-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

/* app card within category card */
.app-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-subtle);
  margin-bottom: 8px;
  transition: border-color 150ms, box-shadow 150ms, background 120ms;
}
.app-card:last-child { margin-bottom: 0; }

.app-card.live {
  cursor: pointer;
}
.app-card.live:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(46,155,92,.08);
}

.app-card.coming-soon {
  opacity: 0.55;
}

.app-card-info {
  flex: 1;
  min-width: 0;
}

.app-card-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.app-card-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-card-action { flex-shrink: 0; }

.btn-open {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--r-sm);
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  transition: background 150ms;
  white-space: nowrap;
}
.btn-open:hover { background: var(--accent-hover); }

.soon-label {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ── App container ────────────────────────── */
.app-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.app-container.hidden { display: none; }

/* thin app bar at top when an app is open */
.app-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  height: 44px;
}

.btn-back {
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--r-sm);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font);
  transition: background 150ms, color 150ms;
}
.btn-back:hover { background: var(--bg); color: var(--text); }

.app-bar-sep {
  color: var(--text-muted);
  font-size: 13px;
  user-select: none;
}

.app-bar-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-frame {
  flex: 1;
  border: none;
  width: 100%;
  height: 100%;
  display: block;
  background: var(--bg);
}

/* ── Sidebar overlay (mobile) ─────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.3);
  z-index: 49;
  backdrop-filter: blur(1px);
}
.sidebar-overlay.active { display: block; }

/* ── Responsive ───────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 50;
    width: var(--sidebar-w) !important;
    transform: translateX(-100%);
    transition: transform 260ms ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .mobile-top-bar {
    display: flex;
  }

  .welcome-screen {
    padding: 20px 16px 36px;
  }

  .category-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 500px) {
  .welcome-intro h1 { font-size: 19px; }
}
