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

body {
  background-color: #e6e3d2;
  color: #362808;
  font-family: Georgia, serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 0 1rem 2rem;
}

/* Header */
header {
  width: 100%;
  max-width: 700px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.25rem 0;
  margin-top: 1.5rem;
  margin-bottom: 2rem;
}

header img {
  height: 75px;
  width: auto;
}

.header-text {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.header-title {
  font-size: 2rem;
  font-weight: bold;
  color: #2c4723;
  line-height: 1.1;
}

.header-subtitle {
  font-size: 1.5rem;
  color: #987a2d;
}

/* Tree list */
.tree-list-wrapper {
  position: relative;
  width: 60%;
}

.tree-list-wrapper::before,
.tree-list-wrapper::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 80px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1;
}

.tree-list-wrapper::before {
  top: 0;
  background: linear-gradient(to top, transparent, #e6e3d2);
}

.tree-list-wrapper::after {
  bottom: 0;
  background: linear-gradient(to bottom, transparent, #e6e3d2);
}

.tree-list-wrapper.scrolled::before {
  opacity: 1;
}

.tree-list-wrapper:not(.at-bottom)::after {
  opacity: 1;
}

main {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 70vh;
  overflow-y: auto;
  scrollbar-width: none;
}

main::-webkit-scrollbar {
  display: none;
}

.loading {
  text-align: center;
  color: #987a2d;
  font-style: italic;
}

.no-trees {
  text-align: center;
  color: #2c4723;
  font-style: italic;
}

/* Tree card */
.tree-card {
  background: #fff;
  border: 1px solid #987a2d;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  transition: box-shadow 0.2s ease;
}

.tree-card:hover {
  box-shadow: 0 4px 12px rgba(54, 40, 8, 0.12);
}

.tree-card img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  margin-right: 10px;
}

.tree-info {
  flex: 1;
}

.tree-info .tree-name {
  font-weight: bold;
  font-size: 2rem;
  color: #2c4723;
}

.tree-info .tree-desc {
  font-size: 1.25rem;
  font-style: italic;
  color: #362808;
  margin-top: 0.2rem;
}

.tree-claimant {
  font-size: 0.8rem;
  color: #987a2d;
  margin-top: 0.3rem;
  font-style: italic;
}

.tree-card--claimed {
  opacity: 0.6;
}

.claimed-badge {
  font-size: 0.8rem;
  color: #987a2d;
  font-style: italic;
  flex-shrink: 0;
}

.btn-claim {
  background-color: #2c4723;
  color: #e6e3d2;
  border: none;
  border-radius: 4px;
  padding: 0.5rem 1rem;
  font-size: 1.5rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.15s;
}

.btn-claim:hover {
  background-color: #987a2d;
}

/* Modal */
#modal-overlay,
#confirmation-overlay {
  position: fixed;
  inset: 0;
  background: rgba(54, 40, 8, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

#modal-overlay.hidden,
#confirmation-overlay.hidden {
  display: none;
}

#modal {
  background: #e6e3d2;
  border: 2px solid #2c4723;
  border-radius: 8px;
  padding: 2rem;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
  text-align: center;
}

#modal-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
}

#modal-confirmation {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

#modal input {
  width: 100%;
}

#modal h2 {
  color: #2c4723;
  font-size: 1.2rem;
}

#modal-tree-name {
  font-weight: bold;
  color: #987a2d;
}

#modal label {
  font-size: 0.875rem;
  color: #362808;
}

#modal input {
  padding: 0.5rem;
  border: 1px solid #987a2d;
  border-radius: 4px;
  font-size: 0.95rem;
  background: #fff;
  color: #362808;
  width: 100%;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

#btn-cancel,
#btn-close {
  background: transparent;
  border: 1px solid #987a2d;
  color: #362808;
  border-radius: 4px;
  padding: 0.5rem 1rem;
  cursor: pointer;
}

#btn-cancel:hover,
#btn-close:hover {
  background: #987a2d;
  color: #e6e3d2;
}

#btn-claim {
  background-color: #2c4723;
  color: #e6e3d2;
  border: none;
  border-radius: 4px;
  padding: 0.5rem 1rem;
  cursor: pointer;
}

#btn-claim:hover {
  background-color: #987a2d;
}

.error {
  color: #b00;
  font-size: 0.85rem;
}

.hidden {
  display: none;
}

@media (max-width: 768px) {
  .tree-list-wrapper {
    width: 90%;
  }

  #modal {
    width: 90%;
  }

  .tree-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .tree-card img {
    width: 100%;
    height: 160px;
    margin-right: 0;
  }
}
