/* ============================================================
   ProductOS – Main Stylesheet (Bootstrap 5 + Custom)
   ============================================================ */

:root {
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 64px;
  --navbar-height: 56px;
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --surface: #f8f9fc;
  --border: #e2e8f0;
  --text-muted: #64748b;
  --sidebar-bg: #1e1b4b;
  --sidebar-text: #c7d2fe;
  --sidebar-active-bg: rgba(99,102,241,0.3);
  --sidebar-active-text: #fff;
  --sidebar-hover-bg: rgba(255,255,255,0.07);
}

/* ── Base ───────────────────────────────────────────────── */
body {
  background: var(--surface);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 0.925rem;
  color: #1e293b;
}

/* ── Navbar ─────────────────────────────────────────────── */
.app-navbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  height: var(--navbar-height);
  z-index: 1030;
}

.app-navbar .navbar-brand {
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: #1e293b;
}

.app-navbar .nav-link {
  color: #475569;
  font-size: 0.875rem;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}

.app-navbar .nav-link:hover {
  background: #f1f5f9;
  color: var(--primary);
}

/* ── App Layout ─────────────────────────────────────────── */
.app-wrapper {
  min-height: calc(100vh - var(--navbar-height));
  overflow-x: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────── */
/*
 * .app-sidebar stretches to full page height via flex (align-items:stretch
 * default on .app-wrapper), so the dark background fills the whole page.
 * The inner .sidebar-inner wrapper is sticky + viewport-height so the nav
 * content follows the user while scrolling.
 */
.app-sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  transition: width 0.25s ease, min-width 0.25s ease;
  /* No explicit height — flex stretch makes it fill the full page */
}

.sidebar-inner {
  position: sticky;
  top: var(--navbar-height);
  height: calc(100vh - var(--navbar-height));
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  padding: 1rem 0.75rem 1rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.sidebar-inner::-webkit-scrollbar { width: 4px; }
.sidebar-inner::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

.app-sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
  min-width: var(--sidebar-collapsed-width);
}

.sidebar-product-header {
  padding: 0.5rem;
  background: rgba(255,255,255,0.06);
  border-radius: 10px;
  margin-bottom: 0.5rem;
}

.sidebar-product-name { font-size: 0.875rem; color: #fff; }

.product-logo-sm {
  width: 32px; height: 32px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.product-logo-placeholder {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-divider {
  border-color: rgba(255,255,255,0.1);
  margin: 0.75rem 0;
}

.sidebar-section-label {
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  font-weight: 700;
  color: rgba(199,210,254,0.5);
  padding: 0 0.5rem;
  margin-bottom: 0.25rem;
  text-transform: uppercase;
}

.sidebar-nav {
  list-style: none;
  padding: 0;
  margin: 0 0 0.5rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.85rem;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-link:hover {
  background: var(--sidebar-hover-bg);
  color: #fff;
}

.sidebar-link.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  font-weight: 600;
}

.sidebar-link i { font-size: 1rem; flex-shrink: 0; }
.sidebar-link .ms-auto { margin-left: auto !important; }

.sidebar-toggle-btn {
  margin-top: auto;
  background: rgba(255,255,255,0.07);
  border: none;
  color: rgba(199,210,254,0.6);
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  align-self: flex-start;
  transition: background 0.15s;
}

.sidebar-toggle-btn:hover { background: rgba(255,255,255,0.14); color: #fff; }

/* ── Main Content ───────────────────────────────────────── */
.app-main {
  background: var(--surface);
  min-width: 0;
}

/* ── Avatar ─────────────────────────────────────────────── */
.avatar-sm {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.avatar-lg {
  width: 56px; height: 56px;
  font-size: 1.4rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Cards ──────────────────────────────────────────────── */
.card {
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.card-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  border-radius: 12px 12px 0 0 !important;
  padding: 1rem 1.25rem;
  font-weight: 600;
}

/* ── Page Header ─────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.page-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}

.page-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0.15rem 0 0;
}

/* ── Stat Tiles ──────────────────────────────────────────── */
.stat-tile {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stat-icon {
  width: 48px; height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.stat-icon.indigo { background: #ede9fe; color: var(--primary); }
.stat-icon.blue   { background: #dbeafe; color: #2563eb; }
.stat-icon.green  { background: #d1fae5; color: #059669; }
.stat-icon.orange { background: #ffedd5; color: #ea580c; }

.stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1; color: #0f172a; }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }

/* ── Module Cards ────────────────────────────────────────── */
.module-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.module-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 16px rgba(79,70,229,0.12);
  transform: translateY(-2px);
  color: inherit;
}

.module-card.done { border-left: 4px solid #10b981; }

.module-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: #ede9fe;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}

.module-title { font-weight: 600; font-size: 0.95rem; color: #0f172a; margin-bottom: 0.25rem; }
.module-desc  { font-size: 0.8rem; color: var(--text-muted); line-height: 1.4; }

/* ── Product Cards ───────────────────────────────────────── */
.product-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: box-shadow 0.15s, transform 0.15s;
  overflow: hidden;
}

.product-card:hover {
  box-shadow: 0 6px 24px rgba(0,0,0,0.09);
  transform: translateY(-2px);
}

.product-card-cover {
  height: 8px;
  background: linear-gradient(90deg, var(--primary), #7c3aed);
}

/* ── Forms ───────────────────────────────────────────────── */
.form-label { font-weight: 500; font-size: 0.875rem; color: #374151; margin-bottom: 0.35rem; }
.form-control, .form-select {
  border-color: #d1d5db;
  border-radius: 8px;
  font-size: 0.9rem;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
}

.section-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 1rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border);
}

/* ── Tables ──────────────────────────────────────────────── */
.table { font-size: 0.875rem; }
.table th { font-weight: 600; background: #f8fafc; color: #475569; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }
.table td { vertical-align: middle; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.45rem 1rem;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-outline-primary {
  color: var(--primary);
  border-color: var(--primary);
}

.btn-outline-primary:hover {
  background: var(--primary);
  border-color: var(--primary);
}

/* ── Persona Card ────────────────────────────────────────── */
.persona-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  transition: box-shadow 0.15s;
}

.persona-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.08); }

.persona-avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-size: 1.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.75rem;
}

/* ── Roadmap Item ────────────────────────────────────────── */
.roadmap-item {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.roadmap-item-type {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.9rem;
}

/* ── Auth Pages ──────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--sidebar-bg) 0%, #312e81 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.auth-card {
  background: #fff;
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}

.auth-logo {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  text-align: center;
  margin-bottom: 1.5rem;
}

/* ── Tags / Pills ────────────────────────────────────────── */
.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: #ede9fe;
  color: var(--primary);
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-weight: 500;
}

/* ── Progress circle ─────────────────────────────────────── */
.progress-circle {
  position: relative;
  width: 60px; height: 60px;
}

/* ── Empty state ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}

.empty-state i { font-size: 3rem; opacity: 0.3; display: block; margin-bottom: 1rem; }
.empty-state h5 { color: #374151; margin-bottom: 0.5rem; }

/* ── Step Indicator ──────────────────────────────────────── */
.step-indicator {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 2rem;
  overflow-x: auto;
}

.step {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.step-circle {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: #e2e8f0;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
  transition: background 0.2s, color 0.2s;
}

.step.done .step-circle   { background: #10b981; color: #fff; }
.step.active .step-circle { background: var(--primary); color: #fff; }

.step-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
  white-space: nowrap;
  display: none;
}

@media (min-width: 768px) { .step-label { display: block; } }

.step-line {
  flex: 1;
  height: 2px;
  background: #e2e8f0;
  margin: 0 4px;
}

.step.done + .step .step-line,
.step.done .step-line { background: #10b981; }

/* ── Admin ───────────────────────────────────────────────── */
.admin-stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .app-sidebar {
    position: fixed;
    left: -100%;
    top: var(--navbar-height);
    height: calc(100vh - var(--navbar-height));
    z-index: 1040;
    transition: left 0.25s ease;
  }

  .app-sidebar.open { left: 0; }

  /* On mobile the sidebar is fixed, so the inner wrapper doesn't need to stick */
  .sidebar-inner {
    position: static;
    height: 100%;
  }

  .app-main { min-width: 100%; }
}

/* ── Utilities ───────────────────────────────────────────── */
.text-primary { color: var(--primary) !important; }
.bg-primary   { background: var(--primary) !important; }
.border-primary { border-color: var(--primary) !important; }
.fw-500 { font-weight: 500; }
.rounded-10 { border-radius: 10px; }
.gap-3 { gap: 0.75rem; }
