/* HealthTrack PWA - Styles */
:root {
  --primary: #16213e;
  --secondary: #0f3460;
  --accent: #e94560;
  --success: #4ade80;
  --warning: #fbbf24;
  --danger: #f87171;
  --bg: #1a1a2e;
  --card: #16213e;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --border: #334155;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Onboarding */
.onboarding {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
  text-align: center;
}

.onboarding h1 {
  font-size: 2rem;
  margin: 1rem 0 0.5rem;
  color: var(--accent);
}

.onboarding .subtitle {
  color: var(--text-muted);
  margin-bottom: 2rem;
  font-size: 1.1rem;
}

.install-steps {
  background: var(--card);
  border-radius: 16px;
  padding: 2rem;
  max-width: 400px;
  width: 100%;
  margin-bottom: 2rem;
}

.install-steps h2 {
  font-size: 1.2rem;
  margin-bottom: 1.5rem;
  color: var(--text);
}

.step {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
  text-align: left;
}

.step:last-child {
  margin-bottom: 0;
}

.step-number {
  background: var(--accent);
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  flex-shrink: 0;
}

.step-text {
  color: var(--text-muted);
  line-height: 1.5;
}

.step-text strong {
  color: var(--text);
}

/* Code Entry */
.code-entry {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}

.code-entry h1 {
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
  color: var(--accent);
}

.code-entry .subtitle {
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.code-form {
  background: var(--card);
  border-radius: 16px;
  padding: 2rem;
  max-width: 400px;
  width: 100%;
}

.code-form input {
  width: 100%;
  padding: 1rem;
  font-size: 1.5rem;
  text-align: center;
  letter-spacing: 0.5rem;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  margin-bottom: 1rem;
  text-transform: uppercase;
}

.code-form input:focus {
  outline: none;
  border-color: var(--accent);
}

.code-form input::placeholder {
  letter-spacing: normal;
  font-size: 1rem;
  color: var(--text-muted);
}

/* Main App */
.app-container {
  max-width: 500px;
  margin: 0 auto;
  padding: 1rem;
  min-height: 100vh;
}

.app-header {
  text-align: center;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.app-header h1 {
  font-size: 1.5rem;
  color: var(--accent);
}

.app-header .date {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, var(--accent), #c81e45);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 100px;
  font-weight: bold;
  margin-top: 1rem;
}

/* Sections */
.section {
  background: var(--card);
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Remedy Checklist */
.remedy-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg);
  border-radius: 12px;
  margin-bottom: 0.75rem;
  cursor: pointer;
  transition: background 0.2s;
}

.remedy-item:hover {
  background: #1e293b;
}

.remedy-item.checked {
  background: rgba(74, 222, 128, 0.1);
  border: 1px solid rgba(74, 222, 128, 0.3);
}

.remedy-checkbox {
  width: 28px;
  height: 28px;
  border: 2px solid var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}

.remedy-item.checked .remedy-checkbox {
  background: var(--success);
  border-color: var(--success);
}

.remedy-checkbox svg {
  width: 18px;
  height: 18px;
  opacity: 0;
  transition: opacity 0.2s;
}

.remedy-item.checked .remedy-checkbox svg {
  opacity: 1;
}

.remedy-info {
  flex: 1;
}

.remedy-name {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.remedy-dosage {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Diet Section */
.diet-options {
  display: flex;
  gap: 0.75rem;
}

.diet-option {
  flex: 1;
  padding: 1rem;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.diet-option:hover {
  border-color: var(--accent);
}

.diet-option.selected {
  border-color: var(--success);
  background: rgba(74, 222, 128, 0.1);
}

.diet-icon {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.diet-label {
  font-weight: 600;
  font-size: 0.9rem;
}

/* Notes */
.notes-input {
  width: 100%;
  min-height: 100px;
  padding: 1rem;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  resize: vertical;
}

.notes-input:focus {
  outline: none;
  border-color: var(--accent);
}

.notes-input::placeholder {
  color: var(--text-muted);
}

/* Submit Button */
.submit-btn {
  width: 100%;
  padding: 1rem;
  background: linear-gradient(135deg, var(--accent), #c81e45);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(233, 69, 96, 0.3);
}

.submit-btn:active {
  transform: translateY(0);
}

.submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Success State */
.success-state {
  text-align: center;
  padding: 3rem 1rem;
}

.success-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.success-state h2 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--success);
}

.success-state p {
  color: var(--text-muted);
  margin-bottom: 2rem;
}

/* Dashboard */
.dashboard {
  padding: 1rem;
  max-width: 1200px;
  margin: 0 auto;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}

.dashboard-header h1 {
  font-size: 1.8rem;
  color: var(--accent);
}

.dashboard-actions {
  display: flex;
  gap: 1rem;
}

.btn {
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  font-size: 0.9rem;
}

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

.btn-primary:hover {
  background: #c81e45;
}

.btn-secondary {
  background: var(--card);
  color: var(--text);
  border: 2px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--accent);
}

/* Patient Grid */
.patient-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.patient-card {
  background: var(--card);
  border-radius: 16px;
  padding: 1.5rem;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  border: 2px solid transparent;
}

.patient-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0,0,0,0.3);
}

.patient-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.patient-name {
  font-size: 1.1rem;
  font-weight: 600;
}

.patient-code {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Status Indicators */
.status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.8rem;
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 600;
}

.status-green {
  background: rgba(74, 222, 128, 0.2);
  color: var(--success);
}

.status-yellow {
  background: rgba(251, 191, 36, 0.2);
  color: var(--warning);
}

.status-red {
  background: rgba(248, 113, 113, 0.2);
  color: var(--danger);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

/* Patient Stats */
.patient-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}

.stat {
  text-align: center;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--accent);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Patient Detail Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.modal {
  background: var(--card);
  border-radius: 16px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2rem;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

/* History List */
.history-list {
  margin-top: 1rem;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg);
  border-radius: 10px;
  margin-bottom: 0.75rem;
}

.history-date {
  font-weight: 600;
  min-width: 100px;
}

.history-details {
  flex: 1;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.history-status {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

/* Login */
.login-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}

.login-form {
  background: var(--card);
  border-radius: 16px;
  padding: 2rem;
  max-width: 400px;
  width: 100%;
}

.login-form h1 {
  text-align: center;
  color: var(--accent);
  margin-bottom: 2rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}

.form-group input {
  width: 100%;
  padding: 0.75rem;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 1rem;
}

.form-group input:focus {
  outline: none;
  border-color: var(--accent);
}

/* Add Patient Form */
.add-patient-form {
  margin-top: 1.5rem;
}

.remedy-input-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.remedy-input-row input {
  flex: 1;
  padding: 0.75rem;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 10px;
  color: var(--text);
}

.remedy-input-row input:focus {
  outline: none;
  border-color: var(--accent);
}

.remove-remedy {
  background: var(--danger);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 0 1rem;
  cursor: pointer;
}

.add-remedy-btn {
  background: none;
  border: 2px dashed var(--border);
  color: var(--text-muted);
  width: 100%;
  padding: 0.75rem;
  border-radius: 10px;
  cursor: pointer;
  margin-bottom: 1rem;
}

.add-remedy-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card);
  color: var(--text);
  padding: 1rem 2rem;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 200;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

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

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

/* Responsive */
@media (max-width: 768px) {
  .patient-grid {
    grid-template-columns: 1fr;
  }
  
  .dashboard-header {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
  
  .dashboard-actions {
    width: 100%;
    flex-direction: column;
  }
  
  .btn {
    width: 100%;
  }
}

/* Loading State */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

.empty-state .icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

/* Weekly Overview */
.week-overview {
  display: flex;
  justify-content: space-between;
  margin-top: 1rem;
  padding: 1rem;
  background: var(--bg);
  border-radius: 12px;
}

.day-dot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.day-label {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.day-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
}

.day-circle.complete {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.day-circle.partial {
  background: var(--warning);
  border-color: var(--warning);
  color: white;
}

.day-circle.missed {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
}

.day-circle.today {
  border-color: var(--accent);
  border-width: 3px;
}

/* Tab Navigation */
.tab-nav {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.tab {
  flex: 1;
  padding: 1rem;
  text-align: center;
  cursor: pointer;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* History Chart */
.chart-container {
  background: var(--bg);
  border-radius: 12px;
  padding: 1.5rem;
  margin-top: 1rem;
}

.chart-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.chart-label {
  min-width: 80px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.chart-track {
  flex: 1;
  height: 24px;
  background: var(--card);
  border-radius: 12px;
  overflow: hidden;
}

.chart-fill {
  height: 100%;
  border-radius: 12px;
  transition: width 0.5s ease;
}

.chart-value {
  min-width: 40px;
  text-align: right;
  font-weight: 600;
  font-size: 0.9rem;
}
