/* ============================================
   MakLinkApp – dashboard.css
   Main app shell: sidebar + topbar + pages
   ============================================ */

/* ---- Shell layout ---- */
.app-body {
  display: flex;
  min-height: 100vh;
  background: var(--cream);
  overflow-x: hidden;
}

/* ---- Sidebar ---- */
.sidebar {
  width: 230px;
  min-width: 230px;
  background: var(--navy);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  transition: transform 0.25s ease;
}
.sidebar.collapsed { transform: translateX(-230px); }

.sidebar-logo {
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(196,154,42,0.15);
}
.sidebar-logo-badge {
  display: inline-block;
  background: rgba(196,154,42,0.18);
  color: var(--gold);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid rgba(196,154,42,0.25);
  margin-bottom: 10px;
}
.sidebar-logo-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}
.sidebar-logo-url {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.3);
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 14px 10px;
  overflow-y: auto;
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-label {
  font-size: 0.65rem;
  font-weight: 600;
  color: rgba(255,255,255,0.3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 10px 10px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: all 0.15s;
  cursor: pointer;
  margin-bottom: 1px;
}
.nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
  text-decoration: none;
}
.nav-item.active {
  background: rgba(196,154,42,0.14);
  color: var(--gold);
  border-left-color: var(--gold);
}
.nav-icon { font-size: 1rem; width: 18px; text-align: center; flex-shrink: 0; }

.nav-badge {
  margin-left: auto;
  background: var(--gold);
  color: var(--navy);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 20px;
}

.sidebar-user {
  padding: 14px 16px;
  border-top: 1px solid rgba(196,154,42,0.15);
  display: flex;
  align-items: center;
  gap: 10px;
}
.su-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(196,154,42,0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700;
  color: var(--gold);
  flex-shrink: 0;
}
.su-name  { font-size: 0.8rem; font-weight: 600; color: rgba(255,255,255,0.9); }
.su-role  { font-size: 0.7rem; color: rgba(255,255,255,0.35); }
.su-logout {
  margin-left: auto;
  color: rgba(255,255,255,0.3);
  text-decoration: none;
  font-size: 1rem;
  cursor: pointer;
  transition: color 0.15s;
}
.su-logout:hover { color: #ff6b6b; }

/* ---- Main wrap ---- */
.main-wrap {
  margin-left: 230px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.25s ease;
}
.main-wrap.expanded { margin-left: 0; }

/* ---- Top bar ---- */
.topbar {
  height: 58px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.sidebar-toggle {
  background: none; border: none;
  font-size: 1.2rem; cursor: pointer;
  color: var(--text-secondary);
  padding: 4px;
  border-radius: var(--radius-sm);
  display: none;
}
.topbar-breadcrumb { flex: 1; display: flex; align-items: center; gap: 6px; }
.tb-platform { font-size: 0.8rem; color: var(--text-muted); }
.tb-sep      { color: var(--text-muted); font-size: 0.75rem; }
.tb-page     { font-size: 0.875rem; font-weight: 600; color: var(--navy); }
.topbar-right { display: flex; align-items: center; gap: 10px; }

/* Search */
.search-wrap {
  position: relative;
}
.search-icon {
  position: absolute; left: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted); font-size: 1rem;
  pointer-events: none;
}
.search-input {
  background: var(--cream);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 7px 12px 7px 30px;
  font-size: 0.85rem;
  width: 220px;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(196,154,42,0.1);
  width: 260px;
}
.search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--white);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 300;
  max-height: 240px;
  overflow-y: auto;
  display: none;
}
.search-dropdown.open { display: block; }
.search-result-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px;
  font-size: 0.85rem; color: var(--text-primary);
  cursor: pointer;
  transition: background 0.1s;
}
.search-result-item:hover { background: var(--cream); }
.sri-icon { font-size: 1rem; }
.sri-name  { flex: 1; font-weight: 500; }
.sri-cat   { font-size: 0.75rem; color: var(--text-muted); }

/* Topbar buttons */
.topbar-icon-btn {
  position: relative;
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  background: var(--cream);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 1rem;
  transition: background 0.15s;
}
.topbar-icon-btn:hover { background: var(--cream-dark); }
.topbar-badge {
  position: absolute; top: 3px; right: 3px;
  width: 16px; height: 16px;
  background: var(--gold);
  color: var(--navy);
  font-size: 0.6rem; font-weight: 700;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.topbar-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(13,27,62,0.12);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700;
  color: var(--navy);
  cursor: pointer;
  border: 2px solid var(--gold);
  transition: border-color 0.15s;
}
.topbar-avatar:hover { border-color: var(--navy); }

/* Notification panel */
.notif-panel {
  position: fixed;
  top: 68px; right: 16px;
  width: 340px;
  background: var(--white);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  z-index: 200;
}
.notif-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 10px;
  font-size: 0.9rem; font-weight: 600; color: var(--navy);
  border-bottom: 1px solid var(--border);
}
.notif-clear {
  font-size: 0.75rem; color: var(--gold-dark);
  background: none; border: none; cursor: pointer;
}
.notif-item {
  display: flex; gap: 10px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
  cursor: pointer;
}
.notif-item:hover { background: var(--cream); }
.notif-item:last-child { border-bottom: none; }
.notif-dot {
  width: 8px; height: 8px; border-radius: 50%;
  margin-top: 5px; flex-shrink: 0;
}
.notif-text { font-size: 0.825rem; color: var(--text-primary); line-height: 1.45; }
.notif-time { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

/* ---- Page content ---- */
.page-content { flex: 1; overflow-y: auto; }
.page-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 28px 40px;
}

/* Greeting row */
.greet-row {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 24px; gap: 16px;
}
.greet-title {
  font-size: 1.5rem; font-weight: 700;
  color: var(--navy); margin-bottom: 3px;
}
.greet-sub { font-size: 0.875rem; color: var(--text-muted); }
.greet-actions { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }

/* Stat cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--accent, var(--gold));
}
.stat-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--accent-bg, var(--gold-light));
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  color: var(--accent, var(--gold));
  margin-bottom: 10px;
}
.stat-val   { font-size: 1.75rem; font-weight: 700; color: var(--navy); margin-bottom: 2px; }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 4px; }
.stat-trend { font-size: 0.75rem; }
.stat-trend.up { color: #3B6D11; }

/* Section header */
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.section-label {
  font-size: 0.7rem; font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.09em; text-transform: uppercase;
}
.section-link {
  font-size: 0.8rem; color: var(--gold-dark);
  background: none; border: none; cursor: pointer;
}

/* Launchpad grid */
.launchpad-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 10px;
  margin-bottom: 28px;
}
.lp-tile {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 8px 12px;
  display: flex; flex-direction: column;
  align-items: center; gap: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  text-decoration: none;
  position: relative;
}
.lp-tile:hover {
  border-color: var(--gold);
  background: var(--gold-light);
  transform: translateY(-2px);
}
.lp-tile.dashed {
  border-style: dashed;
  border-color: var(--border-strong);
}
.lp-tile.dashed:hover { background: var(--cream-dark); border-color: var(--gold); }

.lp-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; flex-shrink: 0;
}
.lp-name {
  font-size: 0.72rem; font-weight: 600;
  color: var(--navy); text-align: center;
  line-height: 1.3;
}
.lp-tag {
  font-size: 0.65rem; color: var(--text-muted);
  text-align: center;
}
.lp-status-dot {
  position: absolute; top: 8px; right: 8px;
  width: 7px; height: 7px; border-radius: 50%;
}
.lp-status-dot.live { background: #5BB450; }
.lp-status-dot.dev  { background: var(--gold); }

/* Panels row */
.panels-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.9rem; font-weight: 600; color: var(--navy);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.panel-link {
  font-size: 0.78rem; color: var(--gold-dark);
  background: none; border: none; cursor: pointer;
}

/* Activity list */
.activity-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.act-dot {
  width: 7px; height: 7px; border-radius: 50%;
  margin-top: 5px; flex-shrink: 0;
}
.act-text { font-size: 0.825rem; color: var(--text-primary); line-height: 1.45; }
.act-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 1px; }

/* Module list */
.module-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.module-item:last-child { border-bottom: none; }
.mod-icon {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem; flex-shrink: 0;
}
.mod-name { font-size: 0.84rem; font-weight: 600; color: var(--text-primary); }
.mod-meta { font-size: 0.75rem; color: var(--text-muted); }
.mod-badge {
  margin-left: auto; flex-shrink: 0;
  font-size: 0.7rem; font-weight: 600;
  padding: 3px 10px; border-radius: 20px;
}
.mod-badge.live { background: #EAF3DE; color: #3B6D11; }
.mod-badge.dev  { background: var(--gold-light); color: #854F0B; }

/* Apps full grid */
.apps-filter-row {
  display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap;
}
.filter-btn {
  padding: 6px 14px;
  background: var(--white);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  font-size: 0.8rem; font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}
.filter-btn:hover  { border-color: var(--gold); color: var(--navy); }
.filter-btn.active { background: var(--navy); border-color: var(--navy); color: #fff; }

.apps-full-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.app-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 18px 16px;
  display: flex; flex-direction: column; gap: 10px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  position: relative;
}
.app-card:hover { border-color: var(--gold); box-shadow: var(--shadow-sm); }
.app-card-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
}
.app-card-name { font-size: 0.9rem; font-weight: 600; color: var(--navy); }
.app-card-cat  { font-size: 0.75rem; color: var(--text-muted); }
.app-card-badge {
  position: absolute; top: 12px; right: 12px;
  font-size: 0.65rem; font-weight: 600;
  padding: 2px 8px; border-radius: 20px;
}
.app-card-badge.live { background: #EAF3DE; color: #3B6D11; }
.app-card-badge.dev  { background: var(--gold-light); color: #854F0B; }

/* Analytics bars */
.analytics-bar-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.analytics-bar-row:last-child { border-bottom: none; }
.ab-name  { font-size: 0.84rem; font-weight: 500; color: var(--text-primary); width: 160px; flex-shrink: 0; }
.ab-bar-wrap { flex: 1; height: 8px; background: var(--cream-dark); border-radius: 4px; overflow: hidden; }
.ab-bar   { height: 100%; border-radius: 4px; background: var(--navy); transition: width 0.8s ease; }
.ab-count { font-size: 0.8rem; color: var(--text-muted); width: 50px; text-align: right; flex-shrink: 0; }

/* Audit log */
.audit-row {
  display: grid;
  grid-template-columns: 140px 1fr 80px;
  gap: 12px;
  padding: 9px 0;
  font-size: 0.82rem;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.audit-row:last-child { border-bottom: none; }
.audit-time { color: var(--text-muted); font-size: 0.78rem; }
.audit-action { color: var(--text-primary); }
.audit-level {
  font-size: 0.7rem; font-weight: 600;
  padding: 2px 8px; border-radius: 20px;
  text-align: center;
}
.audit-level.info    { background: #E6F1FB; color: #185FA5; }
.audit-level.success { background: #EAF3DE; color: #3B6D11; }
.audit-level.warning { background: var(--gold-light); color: #854F0B; }

/* Buttons */
.btn-navy-sm {
  background: var(--navy); color: #fff;
  border: none; border-radius: var(--radius-md);
  padding: 8px 16px; font-size: 0.85rem; font-weight: 600;
  cursor: pointer; transition: background 0.15s;
}
.btn-navy-sm:hover { background: var(--navy-mid); }
.btn-ghost-sm {
  background: var(--white); color: var(--navy);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 8px 16px; font-size: 0.85rem; font-weight: 500;
  cursor: pointer; transition: background 0.15s;
}
.btn-ghost-sm:hover { background: var(--cream-dark); }

/* Responsive */
@media (max-width: 1100px) {
  .launchpad-grid { grid-template-columns: repeat(6, 1fr); }
}
@media (max-width: 900px) {
  .stats-grid     { grid-template-columns: 1fr 1fr; }
  .launchpad-grid { grid-template-columns: repeat(4, 1fr); }
  .panels-row     { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .sidebar { transform: translateX(-230px); }
  .sidebar.open { transform: translateX(0); }
  .main-wrap { margin-left: 0; }
  .sidebar-toggle { display: block; }
  .launchpad-grid { grid-template-columns: repeat(3, 1fr); }
  .stats-grid     { grid-template-columns: 1fr 1fr; }
  .search-input   { width: 160px; }
  .search-input:focus { width: 180px; }
}
