/* ============================================
   GESTONIX - Dashboard / Admin Panel Styles
   ============================================ */

/* --- Layout --- */
.app-layout {
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* --- Sidebar --- */
.sidebar {
  width: 250px;
  background: var(--bg-card);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: var(--transition);
  overflow: hidden;
}

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

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.sidebar-brand .brand-icon {
  width: 32px;
  height: 32px;
  background: var(--accent-gradient);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}

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

.sidebar-section {
  margin-bottom: 20px;
}

.sidebar-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
  padding: 0 12px;
  margin-bottom: 6px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  font-size: 0.87rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: var(--transition);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-link:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

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

.sidebar-link i {
  width: 20px;
  text-align: center;
  font-size: 0.92rem;
  flex-shrink: 0;
}

.sidebar-link .link-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  min-width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
}

.sidebar-user:hover {
  background: var(--bg-secondary);
}

.sidebar-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.82rem;
  flex-shrink: 0;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 0.73rem;
  color: var(--text-tertiary);
}

.sidebar-user-menu {
  color: var(--text-tertiary);
  font-size: 0.82rem;
  flex-shrink: 0;
}

/* --- Main Content --- */
.main-content {
  flex: 1;
  margin-left: 250px;
  min-height: 100vh;
  background: var(--bg-secondary);
  overflow-x: hidden;
  max-width: calc(100vw - 250px);
}

/* --- Top Bar --- */
.topbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 16px;
  flex-wrap: wrap;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.topbar-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  white-space: nowrap;
}

.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-tertiary);
}

.topbar-breadcrumb a {
  color: var(--text-tertiary);
}

.topbar-breadcrumb a:hover {
  color: var(--accent);
}

.topbar-breadcrumb .separator {
  font-size: 0.7rem;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.topbar-search {
  position: relative;
}

.topbar-search input {
  width: 220px;
  padding: 8px 12px 8px 36px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: var(--text-primary);
  transition: var(--transition);
}

.topbar-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
  width: 280px;
}

.topbar-search input::placeholder {
  color: var(--text-tertiary);
}

.topbar-search i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  font-size: 0.82rem;
}

.topbar-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  position: relative;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.topbar-icon-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.topbar-icon-btn .notification-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--bg-card);
}

/* --- Page Content --- */
.page-content {
  padding: 32px;
  max-width: 100%;
  overflow-x: hidden;
}

.page-content > * + * {
  margin-top: 24px;
}

.page-content > .page-header + * {
  margin-top: 0;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 32px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-header-left h1 {
  font-size: 1.6rem;
  margin-bottom: 4px;
}

.page-header-left p {
  font-size: 0.9rem;
}

.page-header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

/* --- Stats Cards --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stats-grid-5 {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: var(--transition);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
}

.stat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.stat-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.stat-card-change {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

.stat-card-change.positive {
  background: var(--success-bg);
  color: var(--success);
}

.stat-card-change.negative {
  background: var(--danger-bg);
  color: var(--danger);
}

.stat-card-value {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card-label {
  font-size: 0.82rem;
  color: var(--text-tertiary);
}

/* --- Data Tables --- */
.data-table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.data-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-color);
  gap: 12px;
  flex-wrap: wrap;
}

.data-table-header h3 {
  font-size: 1.05rem;
}

.data-table-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.data-table-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.data-table-filter:hover {
  border-color: var(--accent);
}

.data-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
}

.data-table thead th {
  padding: 11px 18px;
  text-align: left;
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table tbody td {
  padding: 12px 18px;
  font-size: 0.88rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background: var(--bg-secondary);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

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

.table-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: var(--accent-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.78rem;
  flex-shrink: 0;
}

.table-user-name {
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.table-user-email {
  font-size: 0.8rem;
  color: var(--text-tertiary);
}

.table-actions {
  display: flex;
  gap: 5px;
}

.table-action-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.78rem;
}

.table-action-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.data-table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  font-size: 0.82rem;
  color: var(--text-tertiary);
  flex-wrap: wrap;
  gap: 12px;
}

.pagination {
  display: flex;
  gap: 4px;
}

.pagination-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: var(--transition);
}

.pagination-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.pagination-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* --- Pipeline / Kanban --- */
.pipeline-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
}

.pipeline-board {
  display: flex;
  gap: 16px;
  min-width: min-content;
}

.pipeline-column {
  width: 260px;
  min-width: 260px;
  flex-shrink: 0;
}

.pipeline-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.pipeline-column-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.pipeline-column-count {
  background: var(--bg-secondary);
  color: var(--text-tertiary);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.pipeline-column-body {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  padding: 10px;
  min-height: 180px;
  max-height: 500px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pipeline-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  cursor: pointer;
  transition: var(--transition);
}

.pipeline-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}

.pipeline-card-title {
  font-size: 0.87rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 5px;
}

.pipeline-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.76rem;
  color: var(--text-tertiary);
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.pipeline-card-meta i {
  margin-right: 2px;
}

.pipeline-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pipeline-card-amount {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--accent);
}

.pipeline-card-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 0.62rem;
  font-weight: 700;
}

/* --- Content Cards Grid --- */
.content-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  margin-bottom: 32px;
}

.content-grid-equal {
  grid-template-columns: 1fr 1fr;
}

/* --- Chart Placeholder --- */
.chart-placeholder {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}

.chart-header h3 {
  font-size: 1rem;
}

.chart-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-secondary);
  padding: 3px;
  border-radius: var(--radius-md);
}

.chart-tab {
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-tertiary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.chart-tab.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.chart-body {
  height: 240px;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 16px 0;
}

.chart-bar {
  flex: 1;
  background: var(--accent-bg);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: var(--transition);
  position: relative;
  min-height: 16px;
}

.chart-bar:hover {
  background: var(--accent);
  opacity: 0.8;
}

.chart-bar-label {
  position: absolute;
  bottom: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.68rem;
  color: var(--text-tertiary);
  white-space: nowrap;
}

/* --- Activity Feed --- */
.activity-feed {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  max-height: 420px;
  overflow-y: auto;
}

.activity-feed h3 {
  font-size: 1rem;
  margin-bottom: 16px;
}

.activity-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  flex-shrink: 0;
}

.activity-content {
  flex: 1;
  min-width: 0;
}

.activity-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.activity-text strong {
  color: var(--text-primary);
  font-weight: 600;
}

.activity-time {
  font-size: 0.76rem;
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* --- Tabs --- */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 28px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  padding: 10px 18px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-tertiary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}

.tab:hover {
  color: var(--text-primary);
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

/* --- Filter Bar --- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.filter-bar select {
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  min-width: 0;
}

.filter-bar select:focus {
  border-color: var(--accent);
  outline: none;
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 48px 20px;
}

.empty-state-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--accent-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 1.8rem;
  color: var(--accent);
}

.empty-state h3 {
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 0.9rem;
  max-width: 380px;
  margin: 0 auto 20px;
}

/* --- Responsive Dashboard --- */
@media (max-width: 1400px) {
  .content-grid { grid-template-columns: 1fr; }
}

@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; max-width: 100vw; }
  .topbar { padding: 12px 16px; }
  .page-content { padding: 16px; }
  .topbar-search input { width: 180px; }
  .topbar-search input:focus { width: 220px; }
}

@media (max-width: 768px) {
  .stats-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; gap: 12px; align-items: flex-start; }
  .page-header-actions { width: 100%; }
  .pipeline-column { width: 240px; min-width: 240px; }
  .content-grid-equal { grid-template-columns: 1fr; }
  .topbar-search { display: none; }
}
