* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

.hidden {
  display: none !important;
}

.object-popup {
  font-size: 0.85rem;
}

.object-popup strong {
  color: #1f6d4c;
}

.object-popup p {
  margin: 0.25rem 0;
  color: #555;
}

.object-popup ul {
  list-style: none;
  margin: 0.4rem 0 0;
  padding: 0;
}

.object-popup li {
  padding: 0.2rem 0;
  border-top: 1px solid #eee;
}

.object-popup li.fulfilled {
  color: #1f6d4c;
  font-weight: 600;
}

#app {
  position: absolute;
  inset: 0;
}

#map {
  position: absolute;
  inset: 0;
}

#app-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  background: rgba(31, 109, 76, 0.92);
  color: #fff;
}

#app-header h1 {
  font-size: 1rem;
  margin: 0;
  font-weight: 600;
}

#header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

#wallet-badge {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
  font-size: 0.9rem;
}

#logout-button {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: #fff;
  border-radius: 6px;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
  font-size: 0.85rem;
}

.upload-button {
  background: #fff;
  color: #1f6d4c;
  border-radius: 6px;
  padding: 0.3rem 0.75rem;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
}

.import-result {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1500;
  padding: 0.6rem 1.25rem;
  border-radius: 8px;
  font-size: 0.9rem;
  color: #fff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  max-width: 90vw;
  text-align: center;
}

.import-result.info {
  background: #34586a;
}

.import-result.success {
  background: #1f6d4c;
}

.import-result.error {
  background: #b23a2f;
}

.auth-panel {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #1f6d4c, #123c2a);
  z-index: 2000;
}

.auth-card {
  background: #fff;
  border-radius: 12px;
  padding: 2rem;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.auth-card h1 {
  font-size: 1.25rem;
  margin: 0 0 1rem;
  text-align: center;
  color: #1f6d4c;
}

.auth-tabs {
  display: flex;
  margin-bottom: 1rem;
  border-bottom: 1px solid #eee;
}

.auth-tabs button {
  flex: 1;
  background: none;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: #888;
  border-bottom: 2px solid transparent;
}

.auth-tabs button.active {
  color: #1f6d4c;
  border-bottom-color: #1f6d4c;
  font-weight: 600;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.auth-form label {
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
  color: #333;
  gap: 0.25rem;
}

.auth-form input {
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 1rem;
}

.auth-form button[type="submit"] {
  margin-top: 0.5rem;
  background: #1f6d4c;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.6rem;
  font-size: 1rem;
  cursor: pointer;
}

.auth-error {
  color: #c0392b;
  font-size: 0.85rem;
  min-height: 1em;
  margin: 0;
}

/* Avatar (bouton d'en-tete + panneau profil) */

.avatar-button {
  position: relative;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: visible;
}

.avatar-img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 2px solid #fff;
}

.avatar-placeholder {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

.avatar-img-large,
.avatar-placeholder-large {
  width: 72px;
  height: 72px;
  border-radius: 50%;
}

.avatar-img-large {
  object-fit: cover;
  display: block;
}

.avatar-placeholder-large {
  background: #e9f3ee;
  color: #1f6d4c;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.75rem;
}

.avatar-edit {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #b23a2f;
  color: #fff;
  border-radius: 999px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  font-size: 0.65rem;
  line-height: 16px;
  text-align: center;
}

.panel-tabs .notif-badge {
  position: static;
  display: inline-block;
  margin-left: 0.25rem;
}

/* Panneau profil (superpose a la carte) */

.side-panel {
  position: absolute;
  inset: 0;
  z-index: 2500;
}

.side-panel-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
}

.side-panel-content {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 380px;
  background: #fff;
  box-shadow: -6px 0 24px rgba(0, 0, 0, 0.25);
  padding: 1.5rem 1.25rem;
  overflow-y: auto;
}

.close-button {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: #888;
}

.panel-tabs {
  display: flex;
  margin: 0.5rem 0 1.25rem;
  border-bottom: 1px solid #eee;
}

.panel-tabs button {
  flex: 1;
  background: none;
  border: none;
  padding: 0.5rem 0.25rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: #888;
  border-bottom: 2px solid transparent;
}

.panel-tabs button.active {
  color: #1f6d4c;
  border-bottom-color: #1f6d4c;
  font-weight: 600;
}

.upload-button-small {
  display: inline-block;
  background: #1f6d4c;
  color: #fff;
  border-radius: 6px;
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
  cursor: pointer;
  border: none;
}

.form-error {
  font-size: 0.85rem;
  min-height: 1em;
  margin: 0;
  color: #c0392b;
}

.form-error.success-text {
  color: #1f6d4c;
}

.wallet-section,
.strava-section {
  margin-top: 1.25rem;
  font-size: 0.9rem;
}

.strava-section button {
  margin-top: 0.5rem;
  background: #eee;
  color: #999;
  border: none;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  cursor: not-allowed;
}

#notifications-list,
#activities-list {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
}

#notifications-list li {
  padding: 0.6rem 0;
  border-bottom: 1px solid #eee;
  font-size: 0.85rem;
  color: #333;
}

#notifications-list li.unread {
  font-weight: 600;
  color: #1f6d4c;
}

.notif-time {
  display: block;
  font-size: 0.75rem;
  font-weight: 400;
  color: #999;
}

#activities-list li {
  padding: 0.6rem 0.25rem;
  border-bottom: 1px solid #eee;
  font-size: 0.85rem;
  color: #333;
  cursor: pointer;
}

#activities-list li:hover {
  background: #f5f5f5;
}

#activity-detail h3 {
  margin: 0.5rem 0;
  color: #1f6d4c;
  font-size: 1rem;
}

#activity-detail p {
  margin: 0.35rem 0;
  font-size: 0.85rem;
  color: #333;
}

.back-button {
  background: none;
  border: none;
  color: #1f6d4c;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0;
  margin-bottom: 0.5rem;
}

/* Administration */

#admin-tab-button {
  flex: 1.3;
}

[data-panel-section="admin"] h3 {
  font-size: 0.9rem;
  color: #1f6d4c;
  margin: 1.25rem 0 0.5rem;
}

[data-panel-section="admin"] h3:first-child {
  margin-top: 0;
}

.admin-table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 0.35rem 0.4rem;
  border-bottom: 1px solid #eee;
  white-space: nowrap;
}

.admin-table th {
  color: #888;
  font-weight: 600;
}

#admin-activities-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  font-size: 0.8rem;
  max-height: 200px;
  overflow-y: auto;
}

#admin-activities-list li {
  padding: 0.4rem 0;
  border-bottom: 1px solid #eee;
  color: #333;
}

#admin-object-form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.75rem;
}

#admin-object-form label {
  display: flex;
  flex-direction: column;
  font-size: 0.8rem;
  color: #333;
  gap: 0.2rem;
}

#admin-object-form input,
#admin-object-form select,
#admin-object-form textarea {
  padding: 0.4rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
}

#admin-object-form button[type="submit"] {
  background: #1f6d4c;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.5rem;
  font-size: 0.9rem;
  cursor: pointer;
}
