@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
  --sm-primary: #0f766e;
  --sm-primary-light: #14b8a6;
  --sm-primary-dark: #115e59;
  --sm-success: #10b981;
  --sm-warning: #f59e0b;
  --sm-danger: #ef4444;
  --sm-info: #3b82f6;
  --sm-bg: #f8fafc;
  --sm-panel: #ffffff;
  --sm-border: #e2e8f0;
  --sm-text: #0f172a;
  --sm-muted: #64748b;
  --sm-sidebar-bg: #0b0f19;
  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--sm-text);
  background: var(--sm-bg);
  font-family: var(--font-family);
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Premium Login Design with Glowing Mesh Background */
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #0f172a;
  position: relative;
  overflow: hidden;
}

.login-shell::before,
.login-shell::after {
  content: "";
  position: absolute;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.15;
  z-index: 1;
}

.login-shell::before {
  background: var(--sm-primary-light);
  top: 10%;
  left: 15%;
}

.login-shell::after {
  background: var(--sm-info);
  bottom: 15%;
  right: 15%;
}

.login-panel {
  width: min(440px, 100%);
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 40px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
  z-index: 10;
  color: #fff;
  transition: transform 0.3s ease;
}

.login-panel h1 {
  font-size: 1.75rem;
  font-weight: 800;
  margin: 16px 0 4px;
  letter-spacing: -0.5px;
}

.login-panel p {
  color: #94a3b8;
  margin-bottom: 28px;
  font-size: 0.95rem;
}

.login-panel .form-label {
  color: #cbd5e1;
  font-weight: 500;
  font-size: 0.88rem;
}

.login-panel .form-control {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  padding: 11px 14px;
  border-radius: 8px;
}

.login-panel .form-control:focus {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--sm-primary-light);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.25);
  color: #fff;
}

.login-panel .btn-primary {
  background: linear-gradient(135deg, var(--sm-primary-light), var(--sm-primary));
  border: none;
  font-weight: 700;
  padding: 12px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.login-panel .btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(20, 184, 166, 0.3);
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  background: linear-gradient(135deg, var(--sm-primary-light), var(--sm-primary));
  color: #fff;
  border-radius: 12px;
  font-weight: 800;
  width: 52px;
  height: 52px;
  font-size: 1.25rem;
  box-shadow: 0 8px 16px rgba(15, 118, 110, 0.3);
}

/* Admin Shell Layout */
.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

/* Sidebar Styling */
.sidebar {
  background: var(--sm-sidebar-bg);
  color: #fff;
  padding: 24px 18px;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.5px;
  margin-bottom: 32px;
  color: #fff;
}

.brand-icon {
  display: inline-grid;
  place-items: center;
  background: linear-gradient(135deg, var(--sm-primary-light), var(--sm-primary));
  color: #fff;
  border-radius: 8px;
  font-weight: 800;
  width: 34px;
  height: 34px;
  font-size: 0.85rem;
}

.sidebar-nav {
  display: grid;
  gap: 6px;
}

.sidebar-nav .nav-link {
  width: 100%;
  text-align: left;
  color: #94a3b8;
  background: transparent;
  border: 0;
  border-radius: 8px;
  padding: 12px 14px;
  font-weight: 500;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s ease;
}

.sidebar-nav .nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.04);
}

.sidebar-nav .nav-link.active {
  color: #fff;
  background: rgba(20, 184, 166, 0.15);
  border-left: 3px solid var(--sm-primary-light);
  font-weight: 600;
}

/* Workspace & Topbar */
.workspace {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 32px;
  background: var(--sm-panel);
  border-bottom: 1px solid var(--sm-border);
}

.topbar h2 {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin: 0;
}

.topbar span {
  color: var(--sm-muted);
  font-size: 0.88rem;
}

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

.operator-pill {
  border: 1px solid var(--sm-border);
  border-radius: 999px;
  padding: 8px 16px;
  background: #f8fafc;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--sm-text);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Content Views */
.content-view {
  padding: 32px;
  flex: 1;
}

/* Stat Cards & Grid */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(180px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--sm-panel);
  border: 1px solid var(--sm-border);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.02);
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.06);
  border-color: var(--sm-primary-light);
}

.stat-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--sm-primary);
  opacity: 0.8;
}

/* Customized colors for different cards */
.stat-grid>article:nth-child(2n)::after {
  background: var(--sm-info);
}

.stat-grid>article:nth-child(3n)::after {
  background: var(--sm-success);
}

.stat-grid>article:nth-child(4n)::after {
  background: var(--sm-warning);
}

.stat-grid>article:nth-child(5n)::after {
  background: var(--sm-danger);
}

.stat-label {
  color: var(--sm-muted);
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  display: block;
  font-size: 1.6rem;
  font-weight: 800;
  margin-top: 8px;
  color: var(--sm-text);
  letter-spacing: -0.5px;
}

/* Panels */
.panel {
  background: var(--sm-panel);
  border: 1px solid var(--sm-border);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.02);
  margin-bottom: 24px;
}

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

.panel-header h3 {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0;
  color: var(--sm-text);
}

/* Forms & Inputs */
.form-label {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--sm-text);
}

.form-control,
.form-select {
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--sm-border);
  font-size: 0.92rem;
  color: var(--sm-text);
  transition: all 0.2s ease;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--sm-primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}

/* Buttons */
.btn {
  padding: 9px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary {
  background: var(--sm-primary);
  border-color: var(--sm-primary);
}

.btn-primary:hover,
.btn-primary:focus {
  background: var(--sm-primary-dark);
  border-color: var(--sm-primary-dark);
}

.btn-outline-primary {
  color: var(--sm-primary);
  border-color: var(--sm-primary);
}

.btn-outline-primary:hover {
  background: var(--sm-primary);
  border-color: var(--sm-primary);
  color: #fff;
}

/* Tables */
.table {
  font-size: 0.9rem;
}

.table th {
  font-weight: 700;
  color: var(--sm-muted);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
  padding: 14px 12px;
  background: #f8fafc;
  border-bottom: 2px solid var(--sm-border);
}

.table td {
  padding: 14px 12px;
  color: var(--sm-text);
  border-bottom: 1px solid #f1f5f9;
}

.table tr:hover td {
  background: #f8fafc;
}

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.75rem;
  font-weight: 700;
}

.status-badge::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.status-active::before,
.status-approved::before {
  background: var(--sm-success);
}

.status-active,
.status-approved {
  background: #ecfdf5;
  color: #065f46;
}

.status-pending::before {
  background: var(--sm-warning);
}

.status-pending {
  background: #fffbeb;
  color: #92400e;
}

.status-suspended::before,
.status-rejected::before {
  background: var(--sm-danger);
}

.status-suspended,
.status-rejected {
  background: #fef2f2;
  color: #991b1b;
}

/* Specific view styles */
.resource-grid {
  display: grid;
  gap: 24px;
}

.resource-toolbar {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) 200px 100px;
  gap: 12px;
  margin-bottom: 20px;
}

.finance-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  margin-top: 24px;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Toast Region */
.toast-region {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 1090;
  display: grid;
  gap: 12px;
}

.app-toast {
  min-width: 300px;
  border-radius: 10px;
  background: #ffffff;
  border-left: 4px solid var(--sm-primary);
  box-shadow: 0 12px 36px rgba(15, 23, 42, 0.12);
  padding: 16px;
  font-weight: 600;
  font-size: 0.9rem;
  animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  color: var(--sm-text);
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Modal Styling */
.modal-content {
  border-radius: 16px;
  border: none;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.16);
}

.modal-header {
  border-bottom: 1px solid #f1f5f9;
  padding: 20px 24px;
}

.modal-title {
  font-weight: 800;
  letter-spacing: -0.5px;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  border-top: 1px solid #f1f5f9;
  padding: 16px 24px;
}

/* Complaints Section Layout */
.complaint-detail-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
}

.complaint-info-sidebar {
  border-right: 1px solid var(--sm-border);
  padding-right: 24px;
}

.complaint-info-item {
  margin-bottom: 16px;
}

.complaint-info-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--sm-muted);
  margin-bottom: 4px;
}

.complaint-info-value {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--sm-text);
}

/* Conversation/Timeline UI */
.complaint-chat-container {
  display: flex;
  flex-direction: column;
  height: 400px;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid var(--sm-border);
  padding: 16px;
  overflow-y: auto;
  margin-bottom: 20px;
}

.complaint-bubble {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 12px;
  margin-bottom: 12px;
  font-size: 0.9rem;
  line-height: 1.5;
}

.complaint-bubble.patient {
  background: #ffffff;
  border: 1px solid var(--sm-border);
  align-self: flex-start;
  border-top-left-radius: 2px;
}

.complaint-bubble.admin {
  background: var(--sm-primary);
  color: #ffffff;
  align-self: flex-end;
  border-top-right-radius: 2px;
}

.bubble-meta {
  font-size: 0.72rem;
  color: var(--sm-muted);
  margin-top: 4px;
  display: block;
  text-align: right;
}

.complaint-bubble.admin .bubble-meta {
  color: rgba(255, 255, 255, 0.7);
}

.timeline-header {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--sm-muted);
  margin-bottom: 10px;
}

.complaint-timeline {
  display: grid;
  gap: 12px;
  max-height: 200px;
  overflow-y: auto;
  padding: 10px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid var(--sm-border);
}

.timeline-item {
  font-size: 0.85rem;
  line-height: 1.4;
  padding-left: 14px;
  position: relative;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 5px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--sm-primary);
}

/* Responsiveness overrides */
@media (max-width: 1200px) {
  .stat-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 991px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: -260px;
    width: 260px;
    height: 100vh;
    transition: left 0.3s ease;
  }

  .sidebar.open {
    left: 0;
  }
}

@media (max-width: 768px) {
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .complaint-detail-grid {
    grid-template-columns: 1fr;
  }

  .complaint-info-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--sm-border);
    padding-right: 0;
    padding-bottom: 16px;
  }
}

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

  .content-view {
    padding: 16px;
  }

  .topbar {
    padding: 16px;
  }
}

@media (max-width: 620px) {
  /* Added for mobile breakpoints and test compatibility */
}