/* === layout.css === */
/* ======================================================
   === SECTION: SIDEBAR ===
   ====================================================== */
.sidebar {
  width: 280px; min-width: 280px;
  background: var(--sidebar-bg);
  color: var(--text-main);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 4px 0 30px rgba(0,0,0,0.4);
  z-index: 100;
  position: relative;
}
.sidebar::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 200px;
  background: radial-gradient(ellipse at 50% -20%, rgba(59,130,246,0.15) 0%, transparent 70%);
  pointer-events: none;
}
.sidebar-header {
  padding: 22px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.sidebar-logo {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
}
.sidebar-logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent), #06b6d4);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; color: white; font-weight: 900;
  box-shadow: 0 4px 12px var(--accent-glow);
}
.sidebar-logo-text { font-size: 0.85rem; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-main); line-height: 1.2; }
.sidebar-logo-ver { font-size: 0.6rem; color: var(--accent); font-family: 'JetBrains Mono', monospace; font-weight: 700; letter-spacing: 2px; }

.user-profile-box {
  background: var(--sidebar-card);
  border-radius: 10px;
  padding: 12px 14px;
  border-left: 3px solid var(--accent);
}
.user-role-label { font-size: 0.6rem; font-weight: 800; text-transform: uppercase; letter-spacing: 1.5px; color: var(--accent); margin-bottom: 4px; }
.user-name-input, .user-email-input {
  background: transparent; border: none; outline: none;
  color: var(--text-main); font-family: inherit; font-weight: 700;
  width: 100%; padding: 0; font-size: 0.9rem;
}
.user-email-input { font-size: 0.72rem; color: var(--text-muted); font-weight: 500; margin-top: 2px; }

.sidebar-scroll {
  flex: 1; overflow-y: auto; padding: 14px 16px;
  scrollbar-width: thin; scrollbar-color: #1e293b transparent;
}
.sidebar-scroll::-webkit-scrollbar { width: 4px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: #1e293b; border-radius: 4px; }

.sidebar-chart-box {
  background: var(--sidebar-card);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 14px;
  height: 170px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.sidebar-chart-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
}
.sidebar-chart-label {
  font-size: 0.6rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 1.5px; color: var(--text-muted); margin-bottom: 6px;
}

/* Reminder alert badge in sidebar */
.reminder-badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--red); color: white;
  border-radius: 50%; width: 18px; height: 18px;
  font-size: 0.65rem; font-weight: 900;
  margin-left: auto;
}

/* ======================================================
   === SECTION: SIDEBAR NAV LINKS ===
   ====================================================== */
.sidebar-section-label {
  font-size: 0.58rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 2px; color: var(--text-muted);
  padding: 12px 4px 6px;
}
.nav-link-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  color: #94a3b8;
  font-size: 0.82rem; font-weight: 600;
  margin-bottom: 2px;
  transition: all 0.2s;
  text-decoration: none !important;
  border: none; background: none; width: 100%; text-align: left;
}
.nav-link-item .nav-icon {
  width: 28px; height: 28px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem;
  background: rgba(255,255,255,0.04);
  flex-shrink: 0;
  transition: all 0.2s;
}
.nav-link-item:hover { background: rgba(255,255,255,0.05); color: var(--text-main); }
.nav-link-item.active {
  background: rgba(59,130,246,0.15);
  color: #e2e8f0;
  border: 1px solid rgba(59,130,246,0.25);
}
.nav-link-item.active .nav-icon { background: var(--accent); color: white; box-shadow: 0 3px 8px var(--accent-glow); }

/* Filter pills */
.filter-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: 8px;
  cursor: pointer; font-size: 0.78rem; font-weight: 600;
  margin-bottom: 2px; color: #94a3b8;
  transition: all 0.2s; border: none; background: none; width: 100%; text-align: left;
}
.filter-pill:hover { background: rgba(255,255,255,0.05); color: var(--text-main); }
.filter-pill.active { background: rgba(255,255,255,0.07); color: var(--text-main); }
.filter-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.sidebar-btn {
  display: block; width: 100%;
  padding: 10px; border-radius: 9px;
  font-weight: 800; font-size: 0.8rem;
  border: none; cursor: pointer;
  text-align: center; letter-spacing: 0.5px; text-transform: uppercase;
  transition: all 0.2s; margin-bottom: 8px;
}
.sidebar-btn-primary { background: var(--accent); color: white; box-shadow: 0 4px 12px var(--accent-glow); }
.sidebar-btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px); }
.sidebar-btn-import { background: var(--green); color: white; box-shadow: 0 4px 12px rgba(16,185,129,0.3); }
.sidebar-btn-import:hover { filter: brightness(1.1); transform: translateY(-1px); }
.sidebar-btn-outline { background: transparent; color: #94a3b8; border: 1px solid #1e293b; }
.sidebar-btn-outline:hover { border-color: #94a3b8; color: var(--text-main); }

/* ======================================================
   === SECTION: MAIN CONTENT AREA ===
   ====================================================== */
.main-content {
  flex: 1; display: flex; flex-direction: column;
  height: 100vh; overflow: hidden;
  min-width: 0;
}
.top-nav {
  background: white;
  border-bottom: 1px solid #e2e8f0;
  padding: 0 30px;
  display: flex; align-items: center; gap: 4px;
  flex-shrink: 0;
  overflow: visible;
  position: relative;
  z-index: 200;
}
.tab-btn {
  padding: 16px 16px;
  font-size: 0.78rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.8px;
  color: #94a3b8; cursor: pointer;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  transition: all 0.2s;
  border-top: none; border-left: none; border-right: none;
  background: none; font-family: inherit;
  display: flex; align-items: center; gap: 6px;
}
.tab-btn:hover { color: #334155; }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-btn .tab-icon { font-size: 0.9rem; }

/* Hamburger menu button (hidden on desktop) */
.hamburger-btn {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 12px 16px;
  font-size: 1.2rem;
  color: #475569;
  flex-shrink: 0;
}
.hamburger-btn:hover { color: var(--accent); }

/* Top nav tabs wrapper for collapse */
.top-nav-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  overflow: visible;
  flex-wrap: wrap;
}

/* Mobile overlay menu */
.mobile-nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 500;
}
.mobile-nav-overlay.open { display: block; }
.mobile-nav-panel {
  position: fixed;
  top: 0; right: 0;
  width: 280px;
  height: 100vh;
  background: white;
  box-shadow: -8px 0 32px rgba(0,0,0,0.15);
  z-index: 501;
  overflow-y: auto;
  padding: 20px 0;
  transform: translateX(100%);
  transition: transform 0.25s ease;
}
.mobile-nav-overlay.open .mobile-nav-panel {
  transform: translateX(0);
}
.mobile-nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px 16px;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 8px;
}
.mobile-nav-header h3 {
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
  margin: 0;
}
.mobile-nav-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  color: #94a3b8;
  padding: 4px 8px;
  border-radius: 6px;
}
.mobile-nav-close:hover { background: #f1f5f9; color: #ef4444; }
.mobile-nav-section {
  padding: 8px 14px 4px;
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #94a3b8;
}
.mobile-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  width: 100%;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  color: #334155;
  font-family: inherit;
  text-align: left;
  transition: all 0.15s;
}
.mobile-nav-item:hover { background: #f0f4ff; color: var(--accent); }
.mobile-nav-item i { width: 20px; text-align: center; color: #94a3b8; }
.mobile-nav-item:hover i { color: var(--accent); }

/* Responsive: show hamburger, hide tabs on small screens */
@media (max-width: 1100px) {
  .hamburger-btn { display: flex; }
  .top-nav-tabs { display: none; }
}
@media (max-width: 900px) {
  .sidebar { display: none; }
  .tab-panel { padding: 16px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .pipeline-header { flex-direction: column; gap: 8px; }
}
@media (max-width: 600px) {
  .stat-grid { grid-template-columns: 1fr; }
  .form-row { flex-direction: column; }
  .crm-modal { margin: 8px; max-height: 90vh; overflow-y: auto; }
}

/* Tab dropdown menus */
.tab-dropdown {
  position: relative;
  display: inline-flex;
}
.tab-dropdown-trigger {
  display: flex !important;
  align-items: center !important;
  gap: 4px !important;
}
.tab-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  padding: 6px;
  min-width: 180px;
  z-index: 200;
}
.tab-dropdown.open .tab-dropdown-menu {
  display: block;
}
.tab-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 700;
  color: #475569;
  border-radius: 7px;
  font-family: inherit;
  text-align: left;
  transition: all 0.15s;
}
.tab-dropdown-item:hover {
  background: #f0f4ff;
  color: var(--accent);
}
.tab-dropdown-item i {
  width: 18px;
  text-align: center;
  font-size: 0.85rem;
  color: #94a3b8;
}
.tab-dropdown-item:hover i {
  color: var(--accent);
}

.content-panels {
  flex: 1; overflow: hidden; position: relative;
}
.tab-panel {
  display: none;
  position: absolute; inset: 0;
  overflow-y: auto;
  padding: 30px;
}
.tab-panel.active { display: block; }
.tab-panel-full {
  display: none;
  position: absolute; inset: 0;
  overflow: hidden; padding: 0;
}
.tab-panel-full.active { display: block; }
