/*
 * Stylesheet for the Recovery Time Tracker web app.
 * The design focuses on clean typography, soft colours and smooth
 * animations to create a calming interface appropriate for
 * sobriety tracking. Progress bars are rounded rectangles that
 * gradually fill as time passes.
 */

/* Root variables define the colour palette used across the app. */
:root {
  --bg-colour: #fdfcfb;
  --primary-colour: #2196f3;
  --primary-dark: #1976d2;
  --secondary-colour: #8bc34a;
  --text-colour: #333;
  --card-bg: #ffffff;
  --modal-bg: rgba(0, 0, 0, 0.5);
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg-colour);
  color: var(--text-colour);
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.app-container {
  width: 100%;
  max-width: 700px;
  padding: 1rem 1rem 2rem;
}

h1 {
  text-align: center;
  margin-top: 1rem;
  margin-bottom: 2rem;
  font-size: 2rem;
  font-weight: 600;
}

/* Input section styles */
.input-container {
  text-align: center;
  margin-top: 2rem;
}

.input-container input[type="datetime-local"] {
  padding: 0.5rem;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  margin-right: 0.5rem;
}

.input-container button {
  padding: 0.5rem 1rem;
  font-size: 1rem;
  border: none;
  border-radius: 4px;
  background: var(--primary-colour);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s ease;
}

.input-container button:hover {
  background: var(--primary-dark);
}

/* Display section styles */
.display-container {
  margin-top: 1.5rem;
  padding: 1.5rem;
  border-radius: 8px;
  background: var(--card-bg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.start-date-display {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  font-size: 1rem;
}

.start-date-display .label {
  font-weight: 600;
}

.edit-btn {
  margin-left: auto;
  padding: 0.3rem 0.75rem;
  font-size: 0.9rem;
  background: transparent;
  border: 1px solid var(--primary-colour);
  color: var(--primary-colour);
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.edit-btn:hover {
  background: var(--primary-colour);
  color: #fff;
}

/* Progress bar container */
.progress-bars {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.progress-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.progress-item .label {
  width: 70px;
  font-weight: 600;
}

.progress-bar {
  flex-grow: 1;
  height: 22px;
  background: #e9ecef;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  transition: width 0.5s linear;
}

/* Colours for each progress bar */
.progress-fill.years {
  background: linear-gradient(90deg, #8e2de2 0%, #4a00e0 100%);
}
.progress-fill.months {
  background: linear-gradient(90deg, #8bc34a 0%, #558b2f 100%);
}
.progress-fill.days {
  background: linear-gradient(90deg, #ffb74d 0%, #ff8a00 100%);
}
.progress-fill.hours {
  background: linear-gradient(90deg, #03a9f4 0%, #0288d1 100%);
}
.progress-fill.minutes {
  background: linear-gradient(90deg, #ba68c8 0%, #7b1fa2 100%);
}
.progress-fill.seconds {
  background: linear-gradient(90deg, #ec407a 0%, #ad1457 100%);
}

.progress-item .value {
  width: 60px;
  text-align: right;
  font-weight: 600;
}

/* Action buttons */
.actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.share-btn {
  padding: 0.5rem 1rem;
  font-size: 1rem;
  border: none;
  border-radius: 4px;
  background: var(--primary-colour);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s ease;
}

.share-btn:hover {
  background: var(--primary-dark);
}

.download-link {
  padding: 0.5rem 1rem;
  font-size: 1rem;
  border: 1px solid var(--primary-colour);
  border-radius: 4px;
  color: var(--primary-colour);
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
}

.download-link:hover {
  background: var(--primary-colour);
  color: #fff;
}

.share-info {
  text-align: center;
  font-size: 0.9rem;
  color: #666;
  margin-top: 0.5rem;
}

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

/* Modal styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--modal-bg);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background: var(--card-bg);
  padding: 2rem 2rem 1.5rem;
  border-radius: 8px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.modal-content h2 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.4rem;
}

.modal-content input[type="datetime-local"] {
  width: 100%;
  padding: 0.6rem;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  margin-bottom: 1.2rem;
}

.modal-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.modal-buttons button {
  padding: 0.45rem 0.9rem;
  font-size: 0.9rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

#modalSaveBtn {
  background: var(--primary-colour);
  color: #fff;
}

#modalSaveBtn:hover {
  background: var(--primary-dark);
}

#modalCancelBtn {
  background: #ccc;
  color: #333;
}

#modalCancelBtn:hover {
  background: #b5b5b5;
}