/* common.css - Shared styles across all pages */

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

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 20px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  background: white;
  border-radius: 12px;
  padding: 30px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.header {
  margin-bottom: 30px;
}

h1 {
  color: #333;
  margin-bottom: 10px;
  text-align: center;
}

h2 {
  color: #333;
}

.subtitle {
  text-align: center;
  color: #666;
  margin-bottom: 30px;
}

.nav-links {
  text-align: center;
  margin-top: 15px;
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.nav-links a {
  display: inline-block;
  padding: 10px 20px;
  background: #28a745;
  color: white;
  text-decoration: none;
  border-radius: 6px;
  font-weight: 600;
  transition: background 0.3s;
}

.nav-links a:hover {
  background: #218838;
}

/* Form styles */
.form-section {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 30px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
  margin-bottom: 15px;
}

.form-group {
  display: flex;
  flex-direction: column;
}

label {
  font-weight: 600;
  color: #555;
  margin-bottom: 5px;
  font-size: 14px;
}

input,
textarea {
  padding: 10px;
  border: 2px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.3s;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: #667eea;
}

textarea {
  resize: vertical;
  min-height: 60px;
}

button {
  background: #667eea;
  color: white;
  border: none;
  padding: 12px 30px;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s;
}

button:hover {
  background: #5568d3;
}

.refresh-btn {
  background: #28a745;
  padding: 8px 20px;
  font-size: 14px;
}

.refresh-btn:hover {
  background: #218838;
}

/* Statistics cards */
.stats-summary,
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.stat-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px;
  border-radius: 8px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-label {
  font-size: 14px;
  opacity: 0.9;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
}

.stat-unit {
  font-size: 16px;
  opacity: 0.9;
}

/* Table styles */
table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

th {
  background: #667eea;
  color: white;
  padding: 15px;
  text-align: left;
  font-weight: 600;
}

td {
  padding: 12px 15px;
  border-bottom: 1px solid #eee;
}

tr:hover {
  background: #f8f9fa;
}

.bp-value {
  font-weight: 600;
  font-size: 16px;
}

/* Status badges */
.status {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.status-normal {
  background: #d4edda;
  color: #155724;
}

.status-elevated {
  background: #fff3cd;
  color: #856404;
}

.status-high {
  background: #f8d7da;
  color: #721c24;
}

.duration-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 14px;
  background: #d4edda;
  color: #155724;
}

/* Messages */
.message {
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 15px;
  display: none;
}

.message.success {
  background: #d4edda;
  color: #155724;
  display: block;
}

.message.error {
  background: #f8d7da;
  color: #721c24;
  display: block;
}

.no-data {
  text-align: center;
  padding: 40px;
  color: #999;
}

/* Chart containers */
.chart-container {
  position: relative;
  height: 500px;
  background: #f8f9fa;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 30px;
}

canvas {
  max-height: 460px;
}

.chart-section {
  margin-bottom: 40px;
}

.chart-section h2 {
  color: #333;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid #eee;
}

/* Mobile card layout */
.readings-cards,
.activities-cards {
  display: none;
}

.reading-card,
.activity-card {
  background: white;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 15px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.reading-card-header,
.activity-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid #f0f0f0;
}

.reading-date,
.activity-date {
  font-size: 14px;
  color: #666;
  font-weight: 600;
}

.reading-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-bottom: 15px;
}

.reading-detail {
  display: flex;
  flex-direction: column;
}

.detail-label {
  font-size: 12px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 5px;
}

.detail-value {
  font-size: 18px;
  font-weight: 700;
  color: #333;
}

.reading-notes,
.activity-description {
  background: #f8f9fa;
  padding: 12px;
  border-radius: 6px;
  font-size: 14px;
  color: #555;
  margin-top: 10px;
}

.activity-description {
  font-size: 16px;
  color: #333;
  line-height: 1.5;
  background: transparent;
  padding: 0;
}

.reading-notes:empty {
  display: none;
}

.readings-section,
.activities-section {
  margin-top: 20px;
}

.readings-header,
.activities-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  flex-wrap: wrap;
  gap: 10px;
}

/* Mobile responsive styles */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }

  .container {
    padding: 20px;
  }

  h1 {
    font-size: 24px;
  }

  h2 {
    font-size: 20px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .nav-links {
    flex-direction: column;
  }

  .nav-links a {
    width: 100%;
    text-align: center;
  }

  button {
    width: 100%;
  }

  table {
    display: none;
  }

  .readings-cards,
  .activities-cards {
    display: block;
  }

  .readings-header,
  .activities-header {
    flex-direction: column;
    align-items: stretch;
  }

  .readings-header h2,
  .activities-header h2 {
    text-align: center;
  }

  .chart-container {
    height: 350px;
  }
}
