/* Import a modern, clean font */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --bg-app: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-light: #e2e8f0;
  
  --primary: #000000;
  --primary-hover: #333333;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --success: #10b981;
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  margin: 0;
  padding: 1.5rem;
  max-width: 1200px;
  margin-inline: auto;
}

/* --- HEADER & TIMER LOGIC --- */
header {
  background: var(--bg-card);
  padding: 1.5rem 2rem;
  border-radius: 16px;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
  border: 1px solid var(--border-light);
}

@media (min-width: 768px) {
  header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

.header-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.header-title h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.025em;
}

.timer-display {
  font-size: 2.25rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--accent);
  background: #eff6ff;
  padding: 0.25rem 1rem;
  border-radius: 8px;
}

.timer-controls, .controls {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* --- GLOBAL BUTTONS --- */
button {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  padding: 0.6rem 1.25rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.btn-timer {
  background-color: white;
  border: 1px solid var(--border-light);
  color: var(--text-main);
}
.btn-timer:hover { background-color: #f1f5f9; }

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

.btn-secondary {
  background-color: white;
  border: 1px solid var(--border-light);
  color: var(--text-main);
}
.btn-secondary:hover { background-color: #f1f5f9; }

/* --- ATHLETE GRID & CARDS --- */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.athlete-card {
  background-color: var(--bg-card);
  padding: 1.5rem;
  border-radius: 16px;
  text-align: center;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  border: 1px solid var(--border-light);
  transition: transform 0.2s ease, background-color 0.4s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
}

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

.card-header h2 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
}

.action-btn {
  background: transparent;
  border: none;
  padding: 0.4rem;
  font-size: 1rem;
  border-radius: 6px;
  color: var(--text-muted);
}
.action-btn:hover { background: #f1f5f9; }

.bpm-display {
  font-size: 4rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 0.5rem;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
}

.percent-display {
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.button-container { width: 100%; }
.button-container button {
  width: 100%;
  padding: 0.875rem;
  background-color: var(--accent);
  color: white;
  font-size: 1rem;
}
.button-container button:hover { background-color: var(--accent-hover); }

/* --- OFFLINE STATE FIXES --- */
.offline {
  background-color: #fafafa;
  border: 2px dashed #cbd5e1;
  box-shadow: none;
}
.offline .bpm-display { color: #94a3b8; }
.offline .percent-display { color: #94a3b8; }
.offline .button-container button { background-color: var(--primary); }
.offline .button-container button:hover { background-color: var(--primary-hover); }

.btn-disconnect { background-color: var(--bg-card) !important; color: var(--danger) !important; border: 1px solid var(--danger) !important; }
.btn-disconnect:hover { background-color: #fef2f2 !important; }

/* --- FORMS --- */
.add-athlete-form {
  background: var(--bg-card);
  padding: 2rem;
  border-radius: 16px;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05);
  border: 1px solid var(--border-light);
  max-width: 700px;
}

.add-athlete-form h3 { margin-top: 0; margin-bottom: 1rem; }

.form-group {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.form-group input {
  padding: 0.875rem 1rem;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  flex: 1;
  min-width: 180px;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-group button {
  background-color: var(--success);
  color: white;
  padding: 0.875rem 1.5rem;
}
.form-group button:hover { background-color: #059669; }

/* --- DYNAMIC HEART RATE ZONES --- */
.zone-1 { background-color: #ecfdf5; border-color: #a7f3d0; } 
.zone-2 { background-color: #fefce8; border-color: #fef08a; } 
.zone-3 { background-color: #fff7ed; border-color: #fed7aa; } 
.zone-4 { background-color: #fef2f2; border-color: #fca5a5; } 
.zone-5 { background-color: #ef4444; border-color: #dc2626; color: white; }

/* Keep text readable in Zone 5 */
.zone-5 h2, .zone-5 .bpm-display, .zone-5 .percent-display, .zone-5 .action-btn {
  color: white;
}
.zone-5 .button-container button {
  background-color: white;
  color: #ef4444;
}

/* App Logo Styling */
.app-logo {
  width: 40px;
  height: 40px;
  border-radius: 8px; /* Slightly rounds the corners if your PNG is a hard square */
  object-fit: cover;
}
