/* Vitalis Health Tracking Application - Complete Stylesheet */
/* Sophisticated medical theme with warm, trustworthy colors */

/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Crimson+Text:ital,wght@0,400;0,600;1,400&display=swap');
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap');

/* CSS Variables - Vitalis Color Palette */
:root {
  /* Primary colors */
  --cream: #FAF8F5;
  --forest: #2D5F4C;
  --terracotta: #D4846A;
  --charcoal: #2C2C2C;
  --soft-gray: #E5E1DC;
  --light-cream: #FFFDFB;
  
  /* Forest variations */
  --forest-light: #3A7A60;
  --forest-dark: #1F4335;
  
  /* Semantic colors */
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #3b82f6;
  
  /* BP Category colors */
  --bp-normal: #10b981;
  --bp-elevated: #f59e0b;
  --bp-high-1: #f97316;
  --bp-high-2: #ef4444;
  
  /* BMI Category colors */
  --bmi-underweight: #3b82f6;
  --bmi-normal: #10b981;
  --bmi-overweight: #f59e0b;
  --bmi-obese: #ef4444;
  
  /* Typography */
  --font-serif: 'Crimson Text', serif;
  --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
  
  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  
  /* Border radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(45, 95, 76, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(45, 95, 76, 0.1), 0 2px 4px -1px rgba(45, 95, 76, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(45, 95, 76, 0.1), 0 4px 6px -2px rgba(45, 95, 76, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(45, 95, 76, 0.1), 0 10px 10px -5px rgba(45, 95, 76, 0.04);
}

/* Base styles */
* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  line-height: 1.6;
}

body {
  font-family: var(--font-sans);
  background: linear-gradient(135deg, var(--cream) 0%, var(--light-cream) 100%);
  color: var(--charcoal);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 var(--space-md) 0;
  color: var(--forest-dark);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p {
  margin: 0 0 var(--space-md) 0;
  line-height: 1.6;
}

/* Layout Components */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

.container-sm {
  max-width: 768px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

/* Header */
.header {
  background: rgba(255, 253, 251, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--soft-gray);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) 0;
  min-height: 4rem;
}

.header-title {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--forest);
  margin: 0;
  text-decoration: none;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.header-user {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.875rem;
  color: var(--forest-light);
}

/* Tab Navigation */
.tabs {
  background: var(--light-cream);
  border-bottom: 1px solid var(--soft-gray);
  margin-bottom: var(--space-xl);
}

.tabs-list {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-x: auto;
}

.tabs-item {
  margin: 0;
}

.tabs-link {
  display: block;
  padding: var(--space-md) var(--space-lg);
  text-decoration: none;
  color: var(--forest-light);
  border-bottom: 3px solid transparent;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.tabs-link:hover {
  color: var(--forest);
  background: rgba(45, 95, 76, 0.05);
}

.tabs-link.active {
  color: var(--forest);
  border-bottom-color: var(--terracotta);
  background: var(--cream);
}

/* Tab Content */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Cards */
.card {
  background: var(--light-cream);
  border: 1px solid var(--soft-gray);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

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

.card-header {
  padding: var(--space-lg);
  border-bottom: 1px solid var(--soft-gray);
  background: var(--cream);
}

.card-title {
  margin: 0;
  font-size: 1.25rem;
  color: var(--forest-dark);
}

.card-body {
  padding: var(--space-lg);
}

.card-footer {
  padding: var(--space-lg);
  border-top: 1px solid var(--soft-gray);
  background: var(--cream);
}

/* Statistics Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.stat-card {
  background: var(--light-cream);
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
  border-left: 4px solid var(--terracotta);
  box-shadow: var(--shadow-md);
  transition: transform 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--forest);
  margin: 0;
  font-family: var(--font-mono);
}

.stat-label {
  font-size: 0.875rem;
  color: var(--forest-light);
  margin: var(--space-xs) 0 0 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-change {
  font-size: 0.75rem;
  margin-top: var(--space-xs);
  font-weight: 500;
}

.stat-change.positive {
  color: var(--success);
}

.stat-change.negative {
  color: var(--error);
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.form-group {
  margin-bottom: var(--space-lg);
}

.form-label {
  display: block;
  margin-bottom: var(--space-sm);
  font-weight: 600;
  color: var(--forest-dark);
  font-size: 0.875rem;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-md);
  border: 2px solid var(--soft-gray);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-family: var(--font-sans);
  background: var(--light-cream);
  color: var(--charcoal);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--forest-light);
  box-shadow: 0 0 0 3px rgba(58, 122, 96, 0.1);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md) var(--space-lg);
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-sans);
  line-height: 1;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--forest);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: var(--forest-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--terracotta);
  color: white;
}

.btn-secondary:hover:not(:disabled) {
  background: #c8725a;
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--forest);
  border: 2px solid var(--forest);
}

.btn-outline:hover:not(:disabled) {
  background: var(--forest);
  color: white;
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-danger {
  background: var(--error);
  color: white;
}

.btn-sm {
  padding: var(--space-sm) var(--space-md);
  font-size: 0.75rem;
}

.btn-lg {
  padding: var(--space-lg) var(--space-xl);
  font-size: 1rem;
}

/* Tables */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--soft-gray);
  background: var(--light-cream);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table th,
.table td {
  padding: var(--space-md);
  text-align: left;
  border-bottom: 1px solid var(--soft-gray);
}

.table th {
  background: var(--cream);
  font-weight: 600;
  color: var(--forest-dark);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.table tbody tr:hover {
  background: var(--cream);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

/* BP Category Colors */
.bp-normal {
  color: var(--bp-normal);
  font-weight: 600;
}

.bp-elevated {
  color: var(--bp-elevated);
  font-weight: 600;
}

.bp-high-1 {
  color: var(--bp-high-1);
  font-weight: 600;
}

.bp-high-2 {
  color: var(--bp-high-2);
  font-weight: 600;
}

/* BMI Category Colors */
.bmi-underweight {
  color: var(--bmi-underweight);
  font-weight: 600;
}

.bmi-normal {
  color: var(--bmi-normal);
  font-weight: 600;
}

.bmi-overweight {
  color: var(--bmi-overweight);
  font-weight: 600;
}

.bmi-obese {
  color: var(--bmi-obese);
  font-weight: 600;
}

/* Charts */
.chart-container {
  position: relative;
  height: 400px;
  margin-bottom: var(--space-lg);
  background: var(--light-cream);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  border: 1px solid var(--soft-gray);
}

.chart-canvas {
  max-height: 100%;
  width: 100%;
}

/* Progress Bars */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--soft-gray);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin: var(--space-sm) 0;
}

.progress-fill {
  height: 100%;
  background: var(--forest);
  transition: width 0.3s ease;
  border-radius: var(--radius-sm);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-primary {
  background: rgba(45, 95, 76, 0.1);
  color: var(--forest);
}

.badge-success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
}

/* Login/Register Pages */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  background: linear-gradient(135deg, var(--forest-dark) 0%, var(--forest) 50%, var(--forest-light) 100%);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--light-cream);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}

.auth-header {
  padding: var(--space-2xl) var(--space-xl) var(--space-lg);
  text-align: center;
  background: var(--cream);
}

.auth-logo {
  font-family: var(--font-serif);
  font-size: 2.5rem;
  font-weight: 600;
  color: var(--forest);
  margin: 0 0 var(--space-sm) 0;
}

.auth-subtitle {
  color: var(--forest-light);
  margin: 0;
  font-size: 0.875rem;
}

.auth-body {
  padding: var(--space-xl);
}

.auth-footer {
  padding: var(--space-lg) var(--space-xl) var(--space-2xl);
  text-align: center;
  border-top: 1px solid var(--soft-gray);
}

.auth-link {
  color: var(--forest);
  text-decoration: none;
  font-weight: 500;
}

.auth-link:hover {
  text-decoration: underline;
}

/* Shared View Styles */
.shared-header {
  background: var(--forest);
  color: white;
  padding: var(--space-lg) 0;
  margin-bottom: var(--space-xl);
}

.doctor-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  background: rgba(255, 255, 255, 0.1);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  margin-left: var(--space-md);
}

.shared-footer {
  text-align: center;
  padding: var(--space-2xl) 0;
  color: var(--forest-light);
  border-top: 1px solid var(--soft-gray);
  margin-top: var(--space-2xl);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-lg);
}

.modal {
  background: var(--light-cream);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  padding: var(--space-lg);
  border-bottom: 1px solid var(--soft-gray);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  margin: 0;
  font-size: 1.25rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--forest-light);
  padding: var(--space-sm);
}

.modal-body {
  padding: var(--space-lg);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: var(--space-lg);
  right: var(--space-lg);
  z-index: 1100;
  max-width: 400px;
}

.toast {
  background: var(--light-cream);
  border: 1px solid var(--soft-gray);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--space-md) var(--space-lg);
  margin-bottom: var(--space-sm);
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  animation: toast-slide-in 0.3s ease;
}

.toast-success {
  border-left: 4px solid var(--success);
}

.toast-error {
  border-left: 4px solid var(--error);
}

.toast-warning {
  border-left: 4px solid var(--warning);
}

.toast-info {
  border-left: 4px solid var(--info);
}

/* Utility Classes */
.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-muted {
  color: var(--forest-light);
}

.font-mono {
  font-family: var(--font-mono);
}

.font-serif {
  font-family: var(--font-serif);
}

/* Animations */
@keyframes toast-slide-in {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.fade-in {
  animation: fade-in 0.5s ease;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 0 var(--space-sm);
  }
  
  .header-content {
    flex-direction: column;
    gap: var(--space-md);
    padding: var(--space-md) 0;
  }
  
  .tabs-list {
    justify-content: center;
  }
  
  .tabs-link {
    padding: var(--space-sm) var(--space-md);
    font-size: 0.875rem;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
  }
  
  .chart-container {
    height: 300px;
  }
  
  .auth-container {
    padding: var(--space-md);
  }
  
  .modal-overlay {
    padding: var(--space-md);
  }
  
  .toast-container {
    top: var(--space-md);
    right: var(--space-md);
    left: var(--space-md);
    max-width: none;
  }
}

/* Print Styles */
@media print {
  body {
    background: white;
    color: black;
  }
  
  .header,
  .tabs,
  .btn,
  .toast-container,
  .modal-overlay {
    display: none !important;
  }
  
  .card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
  }
  
  .chart-container {
    break-inside: avoid;
  }
}