/* ============================================
   SGL - Dashboard Styles
   ============================================ */

.dashboard-body {
  background: var(--gray-50);
  overflow-x: hidden;
}

/* ===== SIDEBAR ===== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--gray-900);
  display: flex;
  flex-direction: column;
  z-index: var(--z-fixed);
  transition: width var(--transition);
  overflow: hidden;
}

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

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  min-height: 70px;
  flex-shrink: 0;
}

.sidebar-logo {
  height: 36px;
  filter: brightness(0) invert(1);
  flex-shrink: 0;
  transition: var(--transition);
}

.sidebar.collapsed .sidebar-logo {
  opacity: 0;
  width: 0;
}

.sidebar-collapse-btn {
  background: none;
  color: rgba(255,255,255,0.5);
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius);
  transition: var(--transition);
  flex-shrink: 0;
}

.sidebar-collapse-btn:hover {
  background: rgba(255,255,255,0.1);
  color: white;
}

/* NAV */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
  scrollbar-width: none;
}

.sidebar-nav::-webkit-scrollbar { display: none; }

.sidebar-section-label {
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,0.25);
  padding: 12px 20px 6px;
  white-space: nowrap;
  transition: var(--transition);
}

.sidebar.collapsed .sidebar-section-label {
  opacity: 0;
  height: 0;
  padding: 0;
  overflow: hidden;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: rgba(255,255,255,0.6);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  text-decoration: none;
  white-space: nowrap;
}

.sidebar-item:hover {
  background: rgba(255,255,255,0.08);
  color: white;
}

.sidebar-item.active {
  background: rgba(21,101,192,0.3);
  color: white;
  border-right: 3px solid var(--primary-lighter);
}

.sidebar-item.active i { color: var(--primary-lighter); }

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

.sidebar-item span:not(.sidebar-badge) {
  transition: var(--transition);
}

.sidebar.collapsed .sidebar-item span:not(.sidebar-badge) {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

.sidebar.collapsed .sidebar-badge {
  position: absolute;
  top: 6px;
  right: 6px;
}

.sidebar-badge {
  background: var(--primary);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  margin-left: auto;
  flex-shrink: 0;
  transition: var(--transition);
}

.sidebar-divider {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.08);
  margin: 8px 0;
}

.sidebar-item-danger { color: rgba(239,68,68,0.7) !important; }
.sidebar-item-danger:hover { background: rgba(239,68,68,0.1) !important; color: #ef4444 !important; }

/* Sidebar User */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.2);
  flex-shrink: 0;
  overflow: hidden;
  transition: var(--transition);
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
  transition: var(--transition);
}

.sidebar.collapsed .sidebar-user-info {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

.sidebar-user-name {
  font-size: 13px;
  font-weight: 700;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
}

.sidebar-online-dot {
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(0,0,0,0.3);
}

/* ===== MAIN ===== */
.dashboard-main {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition);
}

.sidebar.collapsed ~ .dashboard-main {
  margin-left: var(--sidebar-collapsed);
}

/* ===== TOPBAR ===== */
.dash-topbar {
  height: 64px;
  background: white;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  box-shadow: var(--shadow-sm);
}

.dash-topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.sidebar-toggle-btn {
  background: none;
  border: none;
  color: var(--gray-500);
  font-size: 18px;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius);
  transition: var(--transition);
}

.sidebar-toggle-btn:hover {
  background: var(--gray-100);
  color: var(--gray-800);
}

.dash-breadcrumb {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-700);
  display: flex;
  align-items: center;
  gap: 8px;
}

.dash-topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.dash-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--gray-100);
  border-radius: var(--radius-full);
  padding: 8px 16px;
  transition: var(--transition);
}

.dash-search:focus-within {
  background: white;
  box-shadow: 0 0 0 2px var(--primary);
}

.dash-search i { color: var(--gray-400); font-size: 13px; }

.dash-search input {
  border: none;
  background: none;
  font-size: 13px;
  width: 200px;
  color: var(--gray-700);
}

.dash-search input:focus { outline: none; }
.dash-search input::placeholder { color: var(--gray-400); }

.dash-icon-btn {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  background: var(--gray-100);
  color: var(--gray-600);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  transition: var(--transition);
}

.dash-icon-btn:hover { background: var(--primary-lighter); color: var(--primary); }

.notif-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--error);
  color: white;
  font-size: 9px;
  font-weight: 700;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid white;
}

.dash-user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius);
  background: var(--gray-100);
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.dash-user-btn:hover { background: var(--gray-200); }

.dash-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
}

/* ===== SECTIONS ===== */
.sections-wrapper { flex: 1; }

.dash-section { display: none; }
.dash-section.active { display: block; }

.section-inner {
  padding: 1.5rem 1.5rem 3rem;
  max-width: 1400px;
}

/* ===== WELCOME BAR ===== */
.welcome-bar {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary), var(--accent-dark));
  border-radius: var(--radius-xl);
  padding: 1.5rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.welcome-title {
  color: white;
  font-size: 1.25rem;
  margin-bottom: 4px;
}

.welcome-sub {
  color: rgba(255,255,255,0.8);
  font-size: 14px;
  margin: 0;
}

/* ===== STATS GRID ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* ===== GRID ===== */
.dash-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

/* ===== TODAY APPOINTMENTS ===== */
.today-apt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-100);
}

.today-apt:last-child { border-bottom: none; }

.apt-time {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  width: 48px;
  flex-shrink: 0;
}

.apt-info { flex: 1; }

.apt-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-800);
}

.apt-type {
  font-size: 11px;
  color: var(--gray-400);
}

.apt-status {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
}

.apt-status.confirmed { background: rgba(34,197,94,0.1); color: var(--success); }
.apt-status.pending { background: rgba(245,158,11,0.1); color: var(--warning); }
.apt-status.done { background: var(--gray-100); color: var(--gray-400); }

/* ===== ACTIVITY FEED ===== */
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--gray-100);
  transition: var(--transition);
}

.activity-item:last-child { border-bottom: none; }
.activity-item:hover { background: var(--gray-50); }

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

.activity-icon.blue { background: rgba(21,101,192,0.1); color: var(--primary); }
.activity-icon.green { background: rgba(34,197,94,0.1); color: var(--success); }
.activity-icon.purple { background: rgba(124,58,237,0.1); color: #7C3AED; }
.activity-icon.orange { background: rgba(245,158,11,0.1); color: var(--warning); }

.activity-text {
  flex: 1;
  font-size: 13px;
  color: var(--gray-700);
  line-height: 1.5;
}

.activity-time {
  font-size: 11px;
  color: var(--gray-400);
  flex-shrink: 0;
}

/* ===== SUGGESTED CONNECTIONS ===== */
.suggested-connection {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-100);
}

.suggested-connection:last-child { border-bottom: none; }

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

.sc-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--gray-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sc-spec {
  font-size: 11px;
  color: var(--gray-400);
}

/* ===== FEED ===== */
.feed-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 1.5rem;
  align-items: start;
}

.feed-sidebar { position: sticky; top: 80px; }

.post-composer {
  margin-bottom: 1.5rem;
}

.post-input {
  width: 100%;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  font-size: 14px;
  resize: none;
  min-height: 80px;
  font-family: var(--font-primary);
  transition: var(--transition);
  color: var(--gray-800);
}

.post-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(21,101,192,0.1);
}

.post-input::placeholder { color: var(--gray-400); }

.post-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.post-tools { display: flex; gap: 4px; }

.post-tool-btn {
  background: none;
  border: 1px solid var(--gray-200);
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  color: var(--gray-500);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.post-tool-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-lighter);
}

/* Feed Posts */
.feed-post {
  background: white;
  border-radius: var(--radius-xl);
  border: 1px solid var(--gray-100);
  box-shadow: var(--shadow-card);
  margin-bottom: 1.25rem;
  transition: var(--transition);
}

.feed-post:hover {
  box-shadow: var(--shadow-lg);
}

.post-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 16px 16px 12px;
}

.post-author {
  display: flex;
  align-items: center;
  gap: 10px;
}

.post-author-info .author-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--gray-800);
}

.post-author-info .author-spec {
  font-size: 12px;
  color: var(--gray-400);
}

.post-time {
  font-size: 12px;
  color: var(--gray-400);
}

.post-body {
  padding: 0 16px 16px;
}

.post-text {
  font-size: 14px;
  color: var(--gray-700);
  line-height: 1.7;
  margin-bottom: 0;
}

.post-image {
  width: 100%;
  border-radius: var(--radius);
  margin-top: 12px;
  background: var(--gray-100);
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 10px;
}

.post-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--gray-100);
  display: flex;
  gap: 4px;
}

.post-action {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-500);
  cursor: pointer;
  background: none;
  border: none;
  transition: var(--transition);
}

.post-action:hover { background: var(--gray-100); color: var(--primary); }
.post-action.liked { color: var(--error); }

/* Trending Topics */
.trending-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  transition: var(--transition);
  border-bottom: 1px solid var(--gray-100);
}

.trending-item:hover { background: var(--gray-50); }
.trending-item:last-child { border-bottom: none; }

.trending-rank {
  font-size: 16px;
  font-weight: 800;
  color: var(--gray-200);
  width: 24px;
  flex-shrink: 0;
}

.trending-info .trending-tag {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
}

.trending-info .trending-count {
  font-size: 11px;
  color: var(--gray-400);
}

/* Events */
.event-item {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--gray-100);
}

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

.event-date-box {
  width: 40px;
  height: 44px;
  background: var(--primary-lighter);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.event-date-box .day { font-size: 16px; font-weight: 800; color: var(--primary); line-height: 1; }
.event-date-box .month { font-size: 9px; font-weight: 700; color: var(--primary); text-transform: uppercase; }

.event-info .event-title { font-size: 13px; font-weight: 600; color: var(--gray-800); }
.event-info .event-type { font-size: 11px; color: var(--gray-400); }

/* ===== AGENDA CALENDAR ===== */
.agenda-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.agenda-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.acal-day-header {
  text-align: center;
  padding: 8px 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  background: var(--gray-50);
}

.acal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  border-radius: var(--radius);
  transition: var(--transition);
  position: relative;
  color: var(--gray-700);
}

.acal-day:hover { background: var(--primary-lighter); color: var(--primary); }
.acal-day.today { font-weight: 800; background: var(--primary-lighter); color: var(--primary); }
.acal-day.selected { background: var(--primary); color: white; }
.acal-day.has-apts::after { content: ''; position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%); width: 4px; height: 4px; background: var(--success); border-radius: 50%; }
.acal-day.empty { cursor: default; }
.acal-day.past { color: var(--gray-300); }

/* ===== PATIENTS TABLE ===== */
.patients-table {
  width: 100%;
  background: white;
  border-radius: var(--radius-xl);
  border: 1px solid var(--gray-100);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.patients-table table {
  width: 100%;
  border-collapse: collapse;
}

.patients-table th {
  background: var(--gray-50);
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-500);
  border-bottom: 1px solid var(--gray-100);
}

.patients-table td {
  padding: 12px 16px;
  font-size: 14px;
  color: var(--gray-700);
  border-bottom: 1px solid var(--gray-100);
}

.patients-table tr:last-child td { border-bottom: none; }
.patients-table tr:hover td { background: var(--gray-50); }

/* ===== MESSAGES ===== */
.messages-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  height: calc(100vh - 100px);
  background: white;
  border-radius: var(--radius-xl);
  border: 1px solid var(--gray-100);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.messages-sidebar-panel {
  border-right: 1px solid var(--gray-100);
  display: flex;
  flex-direction: column;
}

.messages-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  background: var(--gray-50);
}

.messages-search i { color: var(--gray-400); font-size: 13px; }

.messages-search input {
  border: none;
  background: none;
  font-size: 13px;
  flex: 1;
  color: var(--gray-700);
}

.messages-search input:focus { outline: none; }

.conversation-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: var(--transition);
  border-bottom: 1px solid var(--gray-100);
}

.conversation-item:hover { background: var(--gray-50); }
.conversation-item.active { background: var(--primary-lighter); }

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

.conv-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--gray-800);
}

.conv-last {
  font-size: 12px;
  color: var(--gray-400);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-meta {
  text-align: right;
  flex-shrink: 0;
}

.conv-time { font-size: 11px; color: var(--gray-400); }

.conv-unread {
  background: var(--primary);
  color: white;
  font-size: 10px;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  margin-top: 2px;
}

.messages-chat { display: flex; flex-direction: column; }

.chat-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--gray-300);
  gap: 12px;
}

.chat-placeholder i { font-size: 48px; }
.chat-placeholder p { font-size: 14px; }

/* ===== CONNECTIONS ===== */
.connections-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.connection-card {
  background: white;
  border-radius: var(--radius-xl);
  border: 1px solid var(--gray-100);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  text-align: center;
  transition: var(--transition);
}

.connection-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.cc-cover {
  height: 60px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
}

.cc-body { padding: 0 1rem 1rem; margin-top: -28px; }

.cc-name { font-weight: 700; font-size: 14px; color: var(--gray-800); margin: 8px 0 2px; }
.cc-spec { font-size: 12px; color: var(--primary); margin-bottom: 12px; }

/* ===== ARTICLE CARDS ===== */
.article-dash-card {
  background: white;
  border-radius: var(--radius-xl);
  border: 1px solid var(--gray-100);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1rem;
  transition: var(--transition);
}

.article-dash-card:hover {
  box-shadow: var(--shadow-lg);
}

.article-dash-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.article-dash-info { flex: 1; }
.article-dash-title { font-weight: 700; color: var(--gray-800); margin-bottom: 4px; }
.article-dash-meta { font-size: 12px; color: var(--gray-400); }

/* RESPONSIVE */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-grid-2 { grid-template-columns: 1fr; }
  .feed-layout { grid-template-columns: 1fr; }
  .feed-sidebar { position: static; }
  .agenda-layout { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width) !important;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

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

  .stats-grid { grid-template-columns: 1fr 1fr; }
  .connections-grid { grid-template-columns: repeat(2, 1fr); }
  .messages-layout { grid-template-columns: 1fr; }
  .messages-sidebar-panel { display: none; }
  .dash-search { display: none; }
}
