/* =============================================
   GLOBAL LAYOUT (App Shell: Sidebar + Main)
   ============================================= */

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

body {
  font-family: 'Inter', 'Segoe UI', sans-serif;
  background: #f1f5f9;
  color: #1e293b;
}

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

.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-y: auto;
  background: #f1f5f9;
}

.app-content {
  flex: 1;
  padding: 1.5rem 2rem;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* =============================================
   SIDEBAR
   ============================================= */
.sidebar {
  width: 260px;
  background: #0f172a;
  color: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.5rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.sidebar-brand-icon {
  flex-shrink: 0;
}

.sidebar-brand-name {
  font-weight: 700;
  font-size: 1.05rem;
  display: block;
  color: #fff;
}

.sidebar-brand-sub {
  font-size: 0.75rem;
  color: #64748b;
  display: block;
}

/* Menu */
.sidebar-menu {
  flex: 1;
  padding: 0.75rem 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1.25rem;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  border-left: 3px solid transparent;
  transition: all 0.15s ease;
}

.sidebar-menu-item:hover {
  color: #e2e8f0;
  background: rgba(255,255,255,0.04);
}

.sidebar-menu-item.active {
  color: #fff;
  background: rgba(59,130,246,0.12);
  border-left-color: #3b82f6;
  font-weight: 600;
}

.sidebar-menu-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-menu-label {
  flex: 1;
}

/* Bottom section */
.sidebar-bottom {
  border-top: 1px solid rgba(255,255,255,0.07);
  padding: 0.5rem 0;
}

.sidebar-logout {
  color: #f87171 !important;
}

.sidebar-logout:hover {
  background: rgba(239,68,68,0.1) !important;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
}

.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-user-info {
  display: flex;
  flex-direction: column;
}

.sidebar-user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #e2e8f0;
}

.sidebar-user-role {
  font-size: 0.72rem;
  color: #64748b;
  text-transform: capitalize;
}

/* =============================================
   HEADER
   ============================================= */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2rem;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 50;
}

.app-header-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 2px;
}

.app-header-subtitle {
  font-size: 0.85rem;
  color: #64748b;
  margin: 0;
}

.app-header-date {
  font-size: 0.78rem;
  color: #94a3b8;
}

.app-header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.app-header-actions {
  display: flex;
  gap: 0.5rem;
}

.app-header-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.app-header-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
}

.app-header-user-info {
  display: flex;
  flex-direction: column;
}

.app-header-user-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: #1e293b;
}

.app-header-user-role {
  font-size: 0.7rem;
  color: #94a3b8;
}

/* =============================================
   FOOTER
   ============================================= */
.app-footer {
  padding: 1rem 2rem;
  border-top: 1px solid #e2e8f0;
  background: #fff;
}

.app-footer-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: #94a3b8;
}

.app-footer-sep {
  color: #cbd5e1;
}

/* =============================================
   DASHBOARD HOME
   ============================================= */

/* Welcome banner */
.dash-welcome {
  background: linear-gradient(135deg, #1e3a5f 0%, #0f172a 100%);
  border-radius: 16px;
  padding: 2rem 2.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 2rem;
  color: #fff;
  position: relative;
  overflow: hidden;
}

.dash-welcome::before {
  content: '';
  position: absolute;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: rgba(59,130,246,0.08);
  top: -120px;
  right: -80px;
}

.dash-welcome-text h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.dash-welcome-text h2 strong {
  color: #93c5fd;
}

.dash-role-badge {
  background: rgba(255,255,255,0.15);
  padding: 0.2rem 0.75rem;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
}

.dash-welcome-desc {
  color: #94a3b8;
  font-size: 0.9rem;
  line-height: 1.6;
  max-width: 500px;
  margin-top: 0.5rem;
}

.dash-welcome-art {
  flex-shrink: 0;
  opacity: 0.7;
}

/* Section title */
.dash-section-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.dash-section-title::before {
  content: '';
  width: 4px;
  height: 20px;
  background: #3b82f6;
  border-radius: 2px;
}

/* Stats grid */
.dash-stats {
  margin-bottom: 2rem;
}

.dash-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
}

.dash-stat-card {
  background: #fff;
  border-radius: 14px;
  padding: 1.5rem;
  border: 1px solid #e2e8f0;
  transition: transform 0.2s, box-shadow 0.2s;
}

.dash-stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.06);
}

.dash-stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.dash-stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dash-stat-trend {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
}

.dash-stat-trend.positive {
  color: #059669;
  background: #ecfdf5;
}

.dash-stat-trend.neutral {
  color: #6b7280;
  background: #f3f4f6;
}

.dash-stat-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.35rem;
}

.dash-stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.1;
  margin-bottom: 0.25rem;
}

.dash-stat-desc {
  font-size: 0.8rem;
  color: #94a3b8;
  margin: 0;
}

/* Activity */
.dash-activity {
  margin-bottom: 1rem;
}

.dash-activity-header {
  margin-bottom: 0.5rem;
}

.dash-activity-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: #fff;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
}

.dash-activity-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.15s;
}

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

.dash-activity-item:hover {
  background: #f8fafc;
}

.dash-activity-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}

.dash-activity-body h4 {
  font-size: 0.92rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 2px;
}

.dash-activity-body p {
  font-size: 0.84rem;
  color: #64748b;
  margin-bottom: 4px;
}

.dash-activity-time {
  font-size: 0.75rem;
  color: #3b82f6;
  font-weight: 500;
}

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

@media (max-width: 768px) {
  .app-layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .sidebar-brand {
    flex: 1;
    border-bottom: none;
  }

  .sidebar-menu {
    flex-direction: row;
    overflow-x: auto;
    padding: 0.5rem;
    gap: 0;
  }

  .sidebar-menu-item {
    flex-direction: column;
    min-width: 70px;
    padding: 0.6rem 0.5rem;
    font-size: 0.72rem;
    text-align: center;
    border-left: none;
    border-bottom: 3px solid transparent;
    gap: 0.3rem;
  }

  .sidebar-menu-item.active {
    border-left: none;
    border-bottom-color: #3b82f6;
  }

  .sidebar-bottom {
    display: none;
  }

  .app-header {
    padding: 1rem;
  }

  .app-header-title {
    font-size: 1.1rem;
  }

  .app-header-user {
    display: none;
  }

  .app-content {
    padding: 1rem;
  }

  .dash-welcome {
    flex-direction: column;
    padding: 1.5rem;
  }

  .dash-welcome-art {
    display: none;
  }
}

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

  .dash-welcome-text h2 {
    font-size: 1.2rem;
  }
}