/* ==================== GLOBAL VARIABLES & BASE ==================== */
:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --accent-color: #3b82f6;
  --accent-glow: rgba(59, 130, 246, 0.3);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --success-glow: rgba(16, 185, 129, 0.2);
  --border-light: rgba(255, 255, 255, 0.08);
}

body {
  font-family: 'Outfit', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

/* ==================== SCROLLBARS ==================== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-color);
}

/* ==================== LOGIN SCREEN ==================== */
.login-card {
  background: rgba(30, 41, 59, 0.75);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-light);
  border-radius: 24px;
  width: 100%;
  max-width: 450px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.brand-logo i {
  filter: drop-shadow(0 0 15px rgba(220, 38, 38, 0.4));
}

.animate-pulse {
  animation: pulse 2s infinite alternate;
}

@keyframes pulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.1); }
}

.btn-glow {
  box-shadow: 0 4px 15px var(--accent-glow);
  transition: all 0.3s ease;
}
.btn-glow:hover {
  box-shadow: 0 4px 25px var(--accent-color);
  transform: translateY(-2px);
}

/* ==================== LAYOUT (SIDEBAR & WRAPPER) ==================== */
#dashboard-container {
  display: flex;
  min-vh-100;
}

.sidebar {
  width: 280px;
  background-color: rgba(15, 23, 42, 0.95);
  border-right: 1px solid var(--border-light);
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

.content-wrapper {
  margin-left: 280px;
  flex-grow: 1;
  min-height: 100vh;
  background: radial-gradient(circle at top right, rgba(30, 41, 59, 0.5), var(--bg-primary));
  padding-bottom: 60px;
}

/* ==================== SIDEBAR COMPONENTS ==================== */
.sidebar-brand span {
  letter-spacing: 1px;
}

.sidebar nav .nav-link {
  color: var(--text-secondary);
  font-weight: 500;
  padding: 12px 18px;
  border-radius: 12px;
  margin-bottom: 8px;
  transition: all 0.2s ease;
}

.sidebar nav .nav-link:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.05);
}

.sidebar nav .nav-link.active {
  color: var(--text-primary);
  background: linear-gradient(135deg, var(--accent-color), #2563eb);
  box-shadow: 0 4px 15px var(--accent-glow);
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background-color: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
}

/* ==================== HEADER & GENERAL CARDS ==================== */
.content-header {
  background-color: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-light);
  sticky: top;
  z-index: 10;
}

.pulse-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 10px #10b981;
  display: inline-block;
  animation: glow 1.5s infinite;
}

@keyframes glow {
  0% { opacity: 0.4; }
  100% { opacity: 1; }
}

.bg-success-glow {
  background-color: var(--success-glow);
  color: #34d399;
}

/* METRIC CARDS */
.metric-card {
  background: rgba(30, 41, 59, 0.4);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.metric-card:hover {
  transform: translateY(-5px);
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(30, 41, 59, 0.55);
}

.metric-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.custom-card {
  background: rgba(30, 41, 59, 0.35);
  border: 1px solid var(--border-light);
  border-radius: 24px;
}

/* ==================== LATEST LOGS LIST ==================== */
.latest-logs-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 300px;
  overflow-y: auto;
  padding-right: 4px;
}

.latest-log-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 12px;
  transition: background 0.2s ease;
}

.latest-log-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* ==================== CUSTOM TABLE ==================== */
.custom-table {
  border-collapse: separate;
  border-spacing: 0 8px;
}

.custom-table thead th {
  border-bottom: none;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
  padding: 12px 16px;
}

.custom-table tbody tr {
  background-color: rgba(255, 255, 255, 0.02);
  transition: all 0.2s ease;
}

.custom-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.05);
  transform: scale(1.002);
}

.custom-table tbody td {
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  padding: 16px;
}

.custom-table tbody td:first-child {
  border-left: 1px solid var(--border-light);
  border-top-left-radius: 12px;
  border-bottom-left-radius: 12px;
}

.custom-table tbody td:last-child {
  border-right: 1px solid var(--border-light);
  border-top-right-radius: 12px;
  border-bottom-right-radius: 12px;
}

/* ==================== LIST GROUP DARK ==================== */
.list-group-dark .list-group-item {
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  margin-bottom: 8px;
  border-radius: 12px !important;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.list-group-dark .list-group-item:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.list-group-dark .list-group-item.active {
  background-color: rgba(59, 130, 246, 0.15) !important;
  border-color: var(--accent-color) !important;
  color: var(--text-primary) !important;
}

/* ==================== REMINDER CARDS ==================== */
.reminder-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 12px;
  transition: all 0.2s ease;
}

.reminder-card:hover {
  background: rgba(255, 255, 255, 0.04);
}

.reminder-time-badge {
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent-color);
  font-weight: 700;
  font-size: 16px;
  padding: 8px 16px;
  border-radius: 8px;
  display: inline-block;
}

/* ==================== ALERTS ==================== */
.alert-info-glow {
  background-color: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  border-radius: 12px;
}

/* ==================== MAX WIDTHS ==================== */
.max-w-600 {
  max-width: 600px;
}

.min-vh-overflow {
  min-height: 100vh;
}

/* ==================== CHAT INTERFACE ==================== */
.bg-dark-glow {
  background-color: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-light);
}

.chat-bubble {
  max-width: 75%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.4;
  position: relative;
  word-wrap: break-word;
}

.chat-bubble.patient {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.chat-bubble.admin {
  background: linear-gradient(135deg, var(--accent-color), #2563eb);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.chat-time {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 4px;
  text-align: right;
}

.chat-sender-name {
  font-size: 11px;
  font-weight: 600;
  color: #60a5fa;
  margin-bottom: 2px;
}

/* ==================== RESPONSIVE DESIGN (MOBILE & TABLET) ==================== */
@media (max-width: 991.98px) {
  #dashboard-container {
    flex-direction: column;
  }
  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-light);
  }
  .content-wrapper {
    margin-left: 0;
    padding: 15px;
  }
  .sidebar nav {
    flex-direction: row !important;
    overflow-x: auto;
    padding: 10px !important;
    gap: 8px;
    -webkit-overflow-scrolling: touch;
  }
  .sidebar nav .nav-link {
    margin-bottom: 0;
    white-space: nowrap;
    padding: 8px 12px;
  }
  .sidebar-brand {
    padding: 15px !important;
    justify-content: center;
  }
  .sidebar-footer {
    display: none !important;
  }
}
