/* ================================================================
   KONEKTA — Dashboard Stylesheet
   ================================================================ */

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

html {
  font-size: 16px;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.5;
  color: #0f172a;
  background: #f1f5f9;
  display: flex;
  min-height: 100vh;
}

a {
  text-decoration: none;
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

/* ─────────────── SIDEBAR ─────────────── */
.sidebar {
  width: 224px;
  flex-shrink: 0;
  background: #0f172a;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 20;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  flex-shrink: 0;
}

.sidebar-logo img {
  height: 26px;
  width: auto;
  filter: brightness(0) invert(1);
  opacity: 0.9;
}

.sidebar-logo-sub {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.35);
  margin-top: 6px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 0;
}

.nav-section-label {
  padding: 10px 20px 4px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.28);
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  font-size: 0.87rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.58);
  border-radius: 0;
  transition: color 0.15s, background 0.15s;
  cursor: pointer;
}

.nav-item:hover {
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  border-left: 2px solid #ffffff;
  padding-left: 18px;
}

.nav-icon {
  width: 16px;
  height: 16px;
  opacity: 0.7;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-item.active .nav-icon {
  opacity: 1;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  flex-shrink: 0;
}

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

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.7);
  flex-shrink: 0;
}

.user-details {
  min-width: 0;
}

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

.user-role {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.38);
}

/* ─────────────── MAIN LAYOUT ─────────────── */
.dashboard-main {
  flex: 1;
  margin-left: 224px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ─────────────── TOP BAR ─────────────── */
.topbar {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  padding: 0 32px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  flex-direction: column;
}

.topbar-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.topbar-breadcrumb {
  font-size: 0.75rem;
  color: #94a3b8;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: 7px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #475569;
  font-size: 0.83rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  font-family: inherit;
}

.topbar-btn:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.topbar-btn.primary {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}

.topbar-btn.primary:hover {
  background: #1e293b;
  border-color: #1e293b;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  color: #64748b;
  font-size: 0.82rem;
  font-weight: 500;
  transition: border-color 0.15s, color 0.15s;
}

.back-link:hover {
  border-color: #0f172a;
  color: #0f172a;
}

/* ─────────────── CONTENT AREA ─────────────── */
.content {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
}

/* ─────────────── STAT CARDS ─────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: #ffffff;
  border-radius: 10px;
  border: 1px solid #e8edf3;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: box-shadow 0.2s;
}

.stat-card:hover {
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
}

.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stat-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

.stat-icon.blue   { background: #eff6ff; color: #3b82f6; }
.stat-icon.green  { background: #f0fdf4; color: #22c55e; }
.stat-icon.amber  { background: #fffbeb; color: #f59e0b; }
.stat-icon.violet { background: #f5f3ff; color: #8b5cf6; }

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.04em;
  line-height: 1;
}

.stat-trend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  font-weight: 500;
}

.stat-trend.up   { color: #16a34a; }
.stat-trend.down { color: #dc2626; }
.stat-trend.flat { color: #94a3b8; }

.stat-sub {
  font-size: 0.78rem;
  color: #94a3b8;
}

/* ─────────────── CONTENT GRID ─────────────── */
.content-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
}

/* ─────────────── PANEL (reusable card) ─────────────── */
.panel {
  background: #ffffff;
  border-radius: 10px;
  border: 1px solid #e8edf3;
  overflow: hidden;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid #f1f5f9;
}

.panel-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.panel-action {
  font-size: 0.78rem;
  font-weight: 500;
  color: #64748b;
  transition: color 0.15s;
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
}

.panel-action:hover {
  color: #0f172a;
}

/* ─────────────── PROJECT TABLE ─────────────── */
.project-table {
  width: 100%;
  border-collapse: collapse;
}

.project-table th {
  text-align: left;
  padding: 10px 24px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: #f8fafc;
  border-bottom: 1px solid #f1f5f9;
}

.project-table td {
  padding: 14px 24px;
  font-size: 0.88rem;
  color: #334155;
  border-bottom: 1px solid #f8fafc;
  vertical-align: middle;
}

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

.project-table tr:hover td {
  background: #fafbfc;
}

.project-name {
  font-weight: 600;
  color: #0f172a;
}

.project-client {
  color: #64748b;
  font-size: 0.8rem;
  margin-top: 2px;
}

/* ─────────────── STATUS BADGES ─────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.badge.active     { background: #f0fdf4; color: #16a34a; }
.badge.review     { background: #fffbeb; color: #d97706; }
.badge.completed  { background: #f0f9ff; color: #0284c7; }
.badge.paused     { background: #fef2f2; color: #dc2626; }
.badge.planning   { background: #f5f3ff; color: #7c3aed; }

/* ─────────────── PROGRESS BAR ─────────────── */
.progress-wrap {
  width: 100%;
  background: #f1f5f9;
  border-radius: 999px;
  height: 5px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: #0f172a;
  transition: width 0.4s ease;
}

/* ─────────────── ACTIVITY FEED ─────────────── */
.activity-list {
  list-style: none;
  padding: 8px 0;
}

.activity-item {
  display: flex;
  gap: 12px;
  padding: 12px 24px;
  align-items: flex-start;
  border-bottom: 1px solid #f8fafc;
}

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

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cbd5e1;
  flex-shrink: 0;
  margin-top: 5px;
}

.activity-dot.green  { background: #22c55e; }
.activity-dot.blue   { background: #3b82f6; }
.activity-dot.amber  { background: #f59e0b; }
.activity-dot.violet { background: #8b5cf6; }

.activity-text {
  font-size: 0.85rem;
  color: #334155;
  line-height: 1.5;
}

.activity-time {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-top: 2px;
}

/* ─────────────── RESPONSIVE ─────────────── */
@media (max-width: 1100px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .dashboard-main {
    margin-left: 0;
  }

  .topbar {
    padding: 0 20px;
  }

  .content {
    padding: 20px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }

  .stat-value {
    font-size: 1.6rem;
  }

  .project-table th,
  .project-table td {
    padding: 12px 16px;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}
