/* ============================================================
   Conscious Indi — Dashboard & Portal Styles
   Shared styles for Admin, Vendor, Customer, and Influencer
   ============================================================ */

:root {
  --sidebar-width: 280px;
  --sidebar-collapsed-width: 80px;
  --topbar-height: 70px;
  --dash-bg: #f8f9fa;
  --dash-card-bg: #ffffff;
  --dash-border: #edf2f7;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Dashboard Wrapper --- */
.ci-dash-wrap {
  display: flex;
  min-height: 100vh;
  background: var(--dash-bg);
  overflow-x: hidden;
}

/* --- Sidebar --- */
.ci-dash-sidebar {
  width: var(--sidebar-width);
  background: var(--navy-dark);
  color: #fff;
  display: flex;
  flex-direction: column;
  transition: width 0.3s var(--ease);
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 1000;
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 0;
}

.ci-dash-sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
}

.ci-sidebar-brand {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  min-height: 80px;
}

.ci-sidebar-brand-icon {
  width: 40px;
  height: 40px;
  background: var(--saffron);
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.ci-sidebar-brand-text {
  transition: opacity 0.3s, visibility 0.3s;
  white-space: nowrap;
}

.ci-dash-sidebar.collapsed .ci-sidebar-brand-text {
  opacity: 0;
  visibility: hidden;
}

.ci-sidebar-brand-name {
  font-family: var(--font-brand);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.05em;
}

.ci-sidebar-brand-role {
  font-size: 0.7rem;
  opacity: 0.6;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.ci-sidebar-user {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0,0,0,0.2);
}

.ci-sidebar-avatar {
  width: 40px;
  height: 40px;
  background: var(--gold);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}

.ci-sidebar-user-info {
  transition: opacity 0.3s, visibility 0.3s;
  white-space: nowrap;
}

.ci-dash-sidebar.collapsed .ci-sidebar-user-info {
  opacity: 0;
  visibility: hidden;
}

.ci-sidebar-user-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.ci-sidebar-user-email {
  font-size: 0.75rem;
  opacity: 0.5;
}

.ci-sidebar-nav {
  padding: 20px 0;
  flex-grow: 1;
}

.ci-sidebar-section-label {
  padding: 10px 24px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.3);
}

.ci-dash-sidebar.collapsed .ci-sidebar-section-label {
  display: none;
}

.ci-sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  color: rgba(255,255,255,0.7);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
  position: relative;
  text-decoration: none;
  white-space: nowrap;
}

.ci-sidebar-nav-item i {
  width: 20px;
  text-align: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.ci-sidebar-nav-item:hover, .ci-sidebar-nav-item.active {
  color: #fff;
  background: rgba(255,255,255,0.05);
}

.ci-sidebar-nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--saffron);
}

.ci-sidebar-nav-badge {
  margin-left: auto;
  background: var(--saffron);
  color: #fff;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 700;
}

.ci-dash-sidebar.collapsed .ci-sidebar-nav-item span {
  display: none;
}

/* --- Main Content Area --- */
.ci-dash-main {
  flex-grow: 1;
  padding: 30px;
  min-width: 0; /* Critical for flexbox overflow */
  transition: all 0.3s var(--ease);
}

.ci-dash-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  background: #fff;
  padding: 15px 25px;
  margin: -30px -30px 30px -30px;
  border-bottom: 1px solid var(--dash-border);
}

.ci-dash-page-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 0;
}

.ci-dash-page-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.ci-dash-topbar-actions {
  display: flex;
  align-items: center;
  gap: 15px;
}

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

.ci-stat-card {
  background: #fff;
  padding: 24px;
  border-radius: var(--r-md);
  border: 1px solid var(--dash-border);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s;
}

.ci-stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.ci-stat-icon {
  position: absolute;
  right: 20px;
  top: 20px;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.ci-stat-card.saffron .ci-stat-icon { background: var(--saffron-pale); color: var(--saffron); }
.ci-stat-card.green .ci-stat-icon { background: var(--green-pale); color: var(--green); }
.ci-stat-card.navy .ci-stat-icon { background: var(--navy-pale); color: var(--navy); }
.ci-stat-card.gold .ci-stat-icon { background: var(--gold-pale); color: var(--gold); }

.ci-stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--navy);
}

.ci-stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ci-stat-change {
  margin-top: 12px;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 4px;
}

.ci-stat-change.up { color: var(--green); }
.ci-stat-change.down { color: #e53e3e; }
.ci-stat-change .vs { color: var(--text-muted); font-weight: 400; }

/* --- Chart Card --- */
.ci-chart-card {
  background: #fff;
  border-radius: var(--r-md);
  border: 1px solid var(--dash-border);
  padding: 24px;
  margin-bottom: 30px;
  box-shadow: var(--shadow-sm);
}

.ci-chart-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.ci-chart-title {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--navy);
}

.ci-chart-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.ci-chart-period-btns {
  display: flex;
  gap: 8px;
}

.ci-period-btn {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #f1f5f9;
  color: var(--text-muted);
  border: none;
  transition: all 0.2s;
}

.ci-period-btn.active {
  background: var(--navy);
  color: #fff;
}

.ci-bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  height: 200px;
  padding-top: 20px;
}

.ci-bar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.ci-bar {
  width: 100%;
  background: var(--saffron);
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  transition: height 1s var(--ease);
}

.ci-bar-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* --- Widget Grid --- */
.ci-widget-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 25px;
}

.ci-widget-card {
  background: #fff;
  border-radius: var(--r-md);
  border: 1px solid var(--dash-border);
  box-shadow: var(--shadow-sm);
}

.ci-widget-head {
  padding: 20px 24px;
  border-bottom: 1px solid var(--dash-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ci-widget-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--navy);
}

.ci-widget-link {
  font-size: 0.8rem;
  color: var(--saffron);
  font-weight: 600;
  text-decoration: none;
}

.ci-widget-body {
  padding: 20px 24px;
}

.ci-activity-item {
  display: flex;
  gap: 16px;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid #f1f5f9;
}

.ci-activity-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.ci-activity-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ci-activity-icon.saffron { background: var(--saffron-pale); color: var(--saffron); }
.ci-activity-icon.green { background: var(--green-pale); color: var(--green); }
.ci-activity-icon.navy { background: var(--navy-pale); color: var(--navy); }
.ci-activity-icon.gold { background: var(--gold-pale); color: var(--gold); }

.ci-activity-info {
  flex-grow: 1;
}

.ci-activity-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 2px;
  color: var(--navy);
}

.ci-activity-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* --- Tables --- */
.ci-table-card {
  background: #fff;
  border-radius: var(--r-md);
  border: 1px solid var(--dash-border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.ci-table-head {
  padding: 20px 24px;
  border-bottom: 1px solid var(--dash-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ci-table-title {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--navy);
}

.table {
  margin-bottom: 0;
}

.table thead th {
  background: #f8f9fa;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--dash-border);
  padding: 15px 24px;
}

.table tbody td {
  padding: 15px 24px;
  vertical-align: middle;
  font-size: 0.9rem;
  color: var(--text-primary);
  border-bottom: 1px solid #f1f5f9;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  .ci-dash-sidebar {
    position: fixed;
    left: -100%;
    transition: left 0.3s var(--ease);
  }
  .ci-dash-sidebar.open {
    left: 0;
  }
  .ci-dash-main {
    max-width: 100vw;
    padding: 20px;
  }
  .ci-dash-topbar {
    margin: -20px -20px 20px -20px;
  }
}

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