/* Eyeguard PWA Styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --primary: #667eea;
  --primary-dark: #5a6fd6;
  --secondary: #764ba2;
  --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Header */
.header {
  background: var(--gradient);
  color: white;
  padding: 1.5rem 2rem;
  box-shadow: var(--shadow-lg);
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-icon {
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.logo h1 {
  font-size: 1.75rem;
  font-weight: 800;
}

.logo p {
  font-size: 0.875rem;
  opacity: 0.9;
}

.header-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.header-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-greeting {
  font-size: 0.875rem;
  opacity: 0.95;
  font-weight: 500;
}

.logout-btn {
  background: rgba(239, 68, 68, 0.9);
  border: none;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.875rem;
}

.logout-btn:hover {
  background: rgba(220, 38, 38, 1);
  transform: translateY(-1px);
}

/* Main Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

/* Card */
.card {
  background: white;
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

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

.card-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gray-800);
}

.card-body {
  padding: 2rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.75rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  outline: none;
}

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

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

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

.btn-success:hover {
  background: #059669;
  transform: translateY(-2px);
}

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

.btn-danger:hover {
  background: #dc2626;
}

.btn-lg {
  padding: 1.25rem 2.5rem;
  font-size: 1.125rem;
}

.btn-icon {
  font-size: 1.25rem;
}

/* Camera Container */
.camera-section {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

@media (max-width: 968px) {
  .camera-section {
    grid-template-columns: 1fr;
  }
}

.camera-container {
  position: relative;
  background: var(--gray-900);
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 4/3;
  min-height: 400px;
}

#videoElement {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

#canvasOverlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: scaleX(-1);
}

.camera-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  text-align: center;
  padding: 2rem;
}

.camera-placeholder-icon {
  width: 80px;
  height: 80px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin-bottom: 1rem;
}

.camera-placeholder h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.camera-placeholder p {
  opacity: 0.7;
  max-width: 300px;
}

/* Stats Panel */
.stats-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.stat-card {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.stat-label {
  font-size: 0.875rem;
  color: var(--gray-500);
  margin-bottom: 0.5rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-unit {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-500);
}

/* Health Status */
.health-status {
  padding: 1rem;
  border-radius: 12px;
  text-align: center;
  font-weight: 600;
}

.health-status.healthy {
  background: #d1fae5;
  color: #065f46;
}

.health-status.warning {
  background: #fef3c7;
  color: #92400e;
}

.health-status.danger {
  background: #fee2e2;
  color: #991b1b;
}

/* Progress Bar */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 0.5rem;
}

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

/* Break Reminder */
.break-card {
  background: linear-gradient(135deg, #dbeafe 0%, #e0e7ff 100%);
  border: 2px solid #93c5fd;
}

.break-card .card-body {
  text-align: center;
}

.break-timer {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--primary);
}

/* Landing Section */
.landing-section {
  text-align: center;
  padding: 4rem 2rem;
}

.landing-icon {
  width: 120px;
  height: 120px;
  background: var(--gradient);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 2rem;
  font-size: 3rem;
  color: white;
  box-shadow: var(--shadow-xl);
}

.landing-title {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--gray-800);
  margin-bottom: 1rem;
}

.landing-subtitle {
  font-size: 1.25rem;
  color: var(--gray-500);
  max-width: 500px;
  margin: 0 auto 2rem;
  line-height: 1.6;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-top: 3rem;
}

.feature-card {
  background: white;
  padding: 1.5rem;
  border-radius: 12px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.feature-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.feature-title {
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--gray-800);
}

.feature-desc {
  color: var(--gray-500);
  font-size: 0.875rem;
}

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--gray-800);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 1000;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.success {
  background: var(--success);
}

.toast.warning {
  background: var(--warning);
}

.toast.error {
  background: var(--danger);
}

/* Install Banner */
.install-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--gradient);
  color: white;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
  transform: translateY(100%);
  transition: transform 0.3s ease;
  z-index: 999;
}

.install-banner.show {
  transform: translateY(0);
}

.install-banner button {
  background: white;
  color: var(--primary);
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}

/* Animations */
@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

.pulse {
  animation: pulse 2s ease-in-out infinite;
}

@keyframes blink-flash {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }

  70% {
    box-shadow: 0 0 0 15px rgba(16, 185, 129, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.blink-detected {
  animation: blink-flash 0.5s ease-out;
}

/* Hidden class */
.hidden {
  display: none !important;
}

/* ============ NEW: Health Score Styles ============ */
.health-score-card {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border: 2px solid #86efac;
}

.health-score-display {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
}

.health-score-value {
  font-size: 2.5rem;
  font-weight: 800;
}

.health-score-value.excellent {
  color: #16a34a;
}

.health-score-value.good {
  color: #65a30d;
}

.health-score-value.moderate {
  color: #ca8a04;
}

.health-score-value.poor {
  color: #dc2626;
}

.health-score-unit {
  font-size: 1rem;
  color: var(--gray-500);
}

.strain-meter {
  width: 100%;
  height: 10px;
  background: var(--gray-200);
  border-radius: 5px;
  overflow: hidden;
  margin-top: 0.75rem;
}

.strain-meter-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.5s ease, background-color 0.5s ease;
}

.strain-meter-fill.excellent {
  background: linear-gradient(90deg, #22c55e, #16a34a);
}

.strain-meter-fill.good {
  background: linear-gradient(90deg, #84cc16, #65a30d);
}

.strain-meter-fill.moderate {
  background: linear-gradient(90deg, #eab308, #ca8a04);
}

.strain-meter-fill.poor {
  background: linear-gradient(90deg, #ef4444, #dc2626);
}

/* ============ NEW: Fatigue Level Styles ============ */
.fatigue-card {
  background: linear-gradient(135deg, #fefce8 0%, #fef9c3 100%);
  border: 2px solid #fde047;
}

.fatigue-indicator {
  font-size: 1.25rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  display: inline-block;
}

.fatigue-low {
  background: #dcfce7;
  color: #166534;
}

.fatigue-medium {
  background: #fef3c7;
  color: #92400e;
}

.fatigue-high {
  background: #fee2e2;
  color: #991b1b;
}

/* ============ NEW: Email Report Button ============ */
.btn-email-report {
  width: 100%;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
  border: none;
  padding: 1rem 1.5rem;
  border-radius: 12px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.btn-email-report:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
}

/* ============ NEW: Break Overlay ============ */
.break-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.break-overlay.show {
  opacity: 1;
  visibility: visible;
}

.break-content {
  text-align: center;
  color: white;
  padding: 3rem;
  max-width: 400px;
}

.break-content .break-icon {
  font-size: 5rem;
  margin-bottom: 1rem;
  animation: bounce 1s ease-in-out infinite;
}

.break-content h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.break-content p {
  font-size: 1.25rem;
  opacity: 0.9;
  margin-bottom: 0.5rem;
}

.break-countdown {
  font-size: 6rem;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 1rem 0;
}

.break-subtitle {
  font-size: 1rem !important;
  opacity: 0.7 !important;
}

.break-content .btn-secondary {
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: white;
  margin-top: 2rem;
}

.break-content .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.3);
}

@keyframes bounce {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}

/* Responsive */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .container {
    padding: 1rem;
  }

  .landing-title {
    font-size: 1.75rem;
  }

  .camera-container {
    min-height: 300px;
  }

  .break-countdown {
    font-size: 4rem;
  }

  .health-score-value {
    font-size: 2rem;
  }
}