* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f4f6f8;
  color: #222;
}

header {
  background: white;
  padding: 24px 20px 18px;
  border-bottom: 1px solid #ddd;
}

header h1 {
  margin: 0;
  font-size: 25px;
}

main {
  padding: 20px;
  max-width: 700px;
  margin: auto;
}

.section {
  background: white;
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.section h2 {
  margin-top: 0;
  font-size: 18px;
}

.buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

button,
.nav-button {
  display: block;
  width: 100%;
  padding: 18px 10px;
  border: none;
  border-radius: 10px;
  background: #eeeeee;
  font-size: 16px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  color: #222;
}

.capture-button {
  grid-column: span 2;
  background: #222;
  color: white;
  font-size: 19px;
}

textarea,
input,
select {
  width: 100%;
  padding: 12px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 16px;
  margin-top: 6px;
  margin-bottom: 14px;
}

.primary-button {
  background: #222;
  color: white;
}

.secondary-button {
  background: #eeeeee;
  color: #222;
}

.back-button {
  display: inline-block;
  width: auto;
  padding: 10px 14px;
  margin-bottom: 16px;
}

/* Journal */

.journal-entry {
  background: white;
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.journal-entry-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.journal-entry-header strong {
  font-size: 1rem;
}

.journal-entry-header span {
  margin-left: 8px;
  color: #666;
}

.journal-category {
  background: #eeeeee;
  padding: 5px 10px;
  border-radius: 12px;
  font-size: 0.85rem;
  white-space: nowrap;
}

.journal-entry-text {
  font-size: 1.05rem;
  line-height: 1.5;
  margin-bottom: 12px;
  white-space: pre-wrap;
}

.journal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.journal-tags span {
  background: #eeeeee;
  padding: 4px 8px;
  border-radius: 10px;
  font-size: 0.8rem;
}

.journal-entry-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border-top: 1px solid #eeeeee;
  padding-top: 12px;
}

.journal-entry-footer span {
  color: #666;
  font-size: 0.9rem;
}

.journal-entry-footer button {
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  background: #222;
  color: white;
}

.journal-entry-footer button:hover {
  opacity: 0.85;
}

/* Journal action buttons */

.journal-entry-footer > div {
  display: flex;
  gap: 8px;
  align-items: center;
}

.journal-edit-button {
  display: inline-block;
  background: #eeeeee;
  color: #222;
  text-decoration: none;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.9rem;
}

.journal-edit-button:hover {
  background: #dddddd;
}

.journal-entry-footer button {
  font-size: 0.9rem;
  white-space: nowrap;
}
/* Tag selector */

.tag-selector {
  position: relative;
}

.selected-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.selected-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #eeeeee;
  border-radius: 12px;
  padding: 5px 9px;
  font-size: 0.85rem;
}

.selected-tag button {
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  font-size: 1rem;
  color: #555;
}

.tag-suggestions {
  position: absolute;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #cccccc;
  border-radius: 8px;
  margin-top: 4px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
}

.tag-suggestion {
  padding: 10px 12px;
  cursor: pointer;
}

.tag-suggestion:hover {
  background: #eeeeee;
}

#unitOptions {
  margin-top: 8px;
}

#unitOptions label {
  display: block;
  margin: 6px 0;
  padding-left: 0;
}

#unitOptions input[type="checkbox"] {
  width: auto;
  padding: 0;
  margin: 0 6px 0 0;
}

#unitOptions label {
  display: flex;
  align-items: center;
  margin: 6px 0;
  padding: 0;
}

/* =========================================================
   CAPTURE PAGE - UNIT CHECKBOXES
   ========================================================= */

/*
   Each unit option is kept on one line.

   The generic input CSS elsewhere in this file makes
   inputs width: 100%. That is good for text boxes,
   but NOT for checkboxes.

   These rules override that behavior.
*/

/* =========================================================
   UNIT CHECKBOXES
   ========================================================= */

/*
   Keep each checkbox and its text together on one line.
*/

#unitOptions label,
#entryUnitOptions label {
  display: flex;
  align-items: center;
  gap: 8px;
  width: auto;
  margin: 6px 0;
  padding: 0;
}


/*
   Prevent the global input styling from making
   checkboxes full width.
*/

#unitOptions input[type="checkbox"],
#entryUnitOptions input[type="checkbox"] {
  width: auto;
  margin: 0;
  padding: 0;
}

/* =========================================================
   PAGE NAVIGATION
   ========================================================= */

.page-navigation {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

/* =====================================================
   JOURNAL ENTRY PHOTO PREVIEWS
   ===================================================== */

.entry-photo-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}


.entry-photo-thumbnail {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #ccc;
}

/* =========================================================
   MOBILE / PHONE LAYOUT
   ========================================================= */

@media (max-width: 600px) {

  body {
    font-size: 16px;
  }

  header {
    padding: 18px 14px 14px;
  }

  header h1 {
    font-size: 22px;
  }

  main {
    padding: 12px;
    width: 100%;
  }

  .section {
    padding: 14px;
    border-radius: 10px;
  }

  .buttons {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .capture-button {
    grid-column: span 1;
  }

  button,
  .nav-button {
    min-height: 48px;
    padding: 14px 12px;
    font-size: 16px;
  }

  textarea,
  input,
  select {
    min-height: 48px;
    font-size: 16px;
  }

  .page-navigation {
    gap: 8px;
  }

  .page-navigation .nav-button {
    flex: 1;
  }

  .back-button {
    width: auto;
  }

  /* Journal entries */

  .journal-entry {
    padding: 14px;
  }

  .journal-entry-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .journal-entry-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .journal-entry-footer > div {
    width: 100%;
    flex-wrap: wrap;
  }

  .journal-entry-footer button,
  .journal-edit-button {
    flex: 1;
    text-align: center;
    min-height: 44px;
  }

  /* Photos */

  .entry-photo-thumbnail {
    width: 90px;
    height: 90px;
  }

  /* Unit checkboxes */

  #unitOptions label,
  #entryUnitOptions label {
    min-height: 42px;
    margin: 4px 0;
  }

}