/* ============================================
   ELINOM HEALTHCARE MANAGEMENT SYSTEM
   Clean & Clinical Theme
   ============================================ */

/* CSS Variables */
:root {
  --hc-primary: #0ea5e9;      /* Sky 500 - Trust/Medical */
  --hc-primary-light: #38bdf8; /* Sky 400 */
  --hc-primary-dark: #0284c7;  /* Sky 600 */
  --hc-accent: #f43f5e;       /* Rose 500 - Emergency/Alert */
  
  --hc-success: #10b981;      /* Emerald 500 */
  --hc-warning: #f59e0b;      /* Amber 500 */
  --hc-danger: #ef4444;       /* Red 500 */
  --hc-info: #6366f1;         /* Indigo 500 */
  
  --hc-bg: #f0f9ff;           /* Sky 50 */
  --hc-card-bg: #ffffff;
  --hc-text: #0f172a;         /* Slate 900 */
  --hc-text-muted: #64748b;   /* Slate 500 */
  --hc-border: #e0f2fe;       /* Sky 100 */
  
  --hc-sidebar-width: 260px;
  --hc-sidebar-collapsed: 70px;
  
  --hc-shadow-sm: 0 1px 2px 0 rgb(14 165 233 / 0.05);
  --hc-shadow: 0 4px 6px -1px rgb(14 165 233 / 0.1), 0 2px 4px -2px rgb(14 165 233 / 0.1);
  
  --hc-radius: 12px;
  --hc-radius-sm: 6px;
  
  --hc-transition: all 0.2s ease;
}

/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--hc-bg);
  color: var(--hc-text);
  line-height: 1.5;
  min-height: 100vh;
}

/* Embedded View Mode */
body.embedded-view .sidebar,
body.embedded-view .security-bar,
body.embedded-view .system-controls {
  display: none !important;
}

body.embedded-view .app-container {
  min-height: 100vh;
}

body.embedded-view .main-content {
  padding: 24px;
}

/* App Structure */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--hc-sidebar-width);
  background: white;
  border-right: 1px solid var(--hc-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 100;
}

.sidebar-header {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--hc-border);
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: var(--hc-primary);
  color: white;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.logo-text {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--hc-text);
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-list {
  list-style: none;
}

.nav-item {
  margin-bottom: 2px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: var(--hc-text-muted);
  text-decoration: none;
  border-radius: var(--hc-radius-sm);
  transition: var(--hc-transition);
  font-weight: 500;
  font-size: 0.9rem;
}

.nav-link:hover {
  background: #e0f2fe;
  color: var(--hc-primary-dark);
}

.nav-link.active {
  background: var(--hc-primary);
  color: white;
  box-shadow: var(--hc-shadow-sm);
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
}

.section {
  display: none;
  animation: fadeIn 0.3s ease-out;
}

.section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.header-area {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--hc-border);
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--hc-text);
}

/* Buttons */
.btn {
  padding: 8px 16px;
  border-radius: var(--hc-radius-sm);
  font-weight: 600;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--hc-transition);
  font-size: 0.875rem;
}

.btn-primary {
  background: var(--hc-primary);
  color: white;
}

.btn-primary:hover {
  background: var(--hc-primary-dark);
}

.btn-danger {
    background: var(--hc-accent);
    color: white;
}

.btn-outline {
  background: white;
  border: 1px solid #cbd5e1;
  color: var(--hc-text);
}

.btn-outline:hover {
  border-color: var(--hc-primary);
  color: var(--hc-primary);
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  padding: 20px;
  border-radius: var(--hc-radius);
  box-shadow: var(--hc-shadow-sm);
  border: 1px solid var(--hc-border);
  display: flex;
  flex-direction: column;
}

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #e0f2fe;
  color: var(--hc-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--hc-text);
}

.stat-label {
  font-size: 0.875rem;
  color: var(--hc-text-muted);
}

/* Content Cards & Tables */
.card {
  background: white;
  border-radius: var(--hc-radius);
  box-shadow: var(--hc-shadow-sm);
  border: 1px solid var(--hc-border);
  margin-bottom: 24px;
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--hc-border);
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-body {
  padding: 20px;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--hc-border);
  font-size: 0.875rem;
}

th {
  background: #f8fafc;
  color: var(--hc-text-muted);
  font-weight: 600;
}

/* Status Badges */
.status {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-checkup { background: #e0f2fe; color: #0369a1; }
.status-emergency { background: #fee2e2; color: #991b1b; }
.status-success { background: #dcfce7; color: #166534; }
.status-warning { background: #fef3c7; color: #92400e; }

/* Grid Layouts */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

@media (max-width: 1024px) {
    .grid-2 { grid-template-columns: 1fr; }
    .sidebar {
      width: 68px;
      min-width: 68px;
      overflow: hidden;
    }
    .sidebar .nav-text,
    .sidebar .sidebar-label { display: none; }
    .sidebar .nav-link { justify-content: center; padding: 12px 0; }
    .sidebar .nav-link i { margin-right: 0; }
    .main-content { margin-left: 68px; }
}

@media (max-width: 900px) {
    .sidebar {
      position: fixed;
      left: -280px;
      top: 0;
      width: 260px;
      min-width: 260px;
      height: 100vh;
      z-index: 9999;
      transition: left 0.3s ease;
      box-shadow: 4px 0 24px rgba(0,0,0,0.3);
      overflow-y: auto;
    }
    .sidebar.mobile-open { left: 0; }
    .sidebar.mobile-open .nav-text,
    .sidebar.mobile-open .sidebar-label { display: initial; }
    .sidebar.mobile-open .nav-link { justify-content: flex-start; padding: 12px 20px; }
    .sidebar.mobile-open .nav-link i { margin-right: 12px; }
    .main-content { margin-left: 0; padding: 16px; width: 100%; }
    .header-area { flex-direction: column; align-items: flex-start; gap: 12px; }
}

@media (max-width: 768px) {
    .stats-grid { grid-template-columns: 1fr; }
    .patient-grid { grid-template-columns: 1fr; }
    .appointment-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
    .main-content { padding: 12px; }
}

@media (max-width: 480px) {
    .stats-grid { gap: 8px; }
}
