:root {
  --bg: #FDFAF4;
  --gold: #C9A84C;
  --text-main: #2C2416;
  --text-secondary: #5A4A2A;
  --text-tertiary: #7A6A4A;
  --card-bg: #FBF6EB;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Georgia, 'Times New Roman', serif;
  background-color: var(--bg);
  color: var(--text-main);
  line-height: 1.6;
}

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

/* ===== Carte d'invitation ===== */
.invitation-card {
  background-color: var(--card-bg);
  border: 1px solid var(--gold);
  border-radius: 12px;
  padding: 40px 32px;
  text-align: center;
  box-shadow: 0 4px 24px rgba(201, 168, 76, 0.15);
}

.ornament {
  font-size: 1.4rem;
  color: var(--gold);
  letter-spacing: 0.4em;
  margin-bottom: 8px;
}

.invitation-card h1 {
  font-size: 2.4rem;
  margin: 0 0 4px;
  color: var(--text-main);
  letter-spacing: 0.04em;
}

.invitation-card .subtitle {
  font-size: 1.3rem;
  color: var(--gold);
  font-style: italic;
  margin: 0 0 24px;
}

.divider {
  border: none;
  border-top: 1px solid var(--gold);
  width: 60%;
  margin: 24px auto;
  opacity: 0.6;
}

.details {
  text-align: left;
  display: inline-block;
  margin: 0 auto;
}

.details dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 16px;
  margin: 0;
}

.details dt {
  font-weight: bold;
  color: var(--text-secondary);
  white-space: nowrap;
}

.details dd {
  margin: 0;
  color: var(--text-main);
}

/* ===== Encart CHUT ===== */
.chut-box {
  margin: 28px auto 0;
  background-color: var(--bg);
  border: 1px dashed var(--gold);
  border-radius: 8px;
  padding: 16px 20px;
  color: var(--text-secondary);
  font-style: italic;
}

.chut-box strong {
  color: var(--gold);
  font-style: normal;
  letter-spacing: 0.1em;
}

/* ===== Sections générales ===== */
section {
  margin-top: 36px;
}

section h2 {
  font-size: 1.3rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--gold);
  padding-bottom: 6px;
  margin-bottom: 16px;
  letter-spacing: 0.03em;
}

/* ===== Parkings ===== */
.parking-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.parking-list li {
  background-color: var(--card-bg);
  border: 1px solid var(--gold);
  border-radius: 8px;
  padding: 12px 16px;
}

.parking-list .parking-name {
  font-weight: bold;
  color: var(--text-main);
}

.parking-list .parking-addr {
  color: var(--text-tertiary);
  font-size: 0.95rem;
}

/* ===== Carte ===== */
#map {
  height: 360px;
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--gold);
}

.map-legend {
  list-style: none;
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin: 12px 0 0;
  padding: 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.map-legend li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-marker {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 1px solid rgba(0, 0, 0, 0.25);
}

.legend-marker-gold {
  background-color: #f0c419;
}

.legend-marker-blue {
  background-color: #2a81cb;
}

/* ===== Compte à rebours ===== */
.countdown {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.countdown .unit {
  text-align: center;
  min-width: 64px;
}

.countdown .unit .value {
  font-size: 1.8rem;
  font-weight: bold;
  color: var(--gold);
}

.countdown .unit .label {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ===== RSVP ===== */
.rsvp-form {
  display: grid;
  gap: 14px;
  background-color: var(--card-bg);
  border: 1px solid var(--gold);
  border-radius: 8px;
  padding: 24px;
}

.rsvp-form label {
  display: block;
  margin-bottom: 4px;
  color: var(--text-secondary);
  font-weight: bold;
  font-size: 0.95rem;
}

.rsvp-form input[type="text"],
.rsvp-form input[type="number"],
.rsvp-form select,
.rsvp-form textarea {
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  padding: 8px 10px;
  border: 1px solid var(--gold);
  border-radius: 6px;
  background-color: var(--bg);
  color: var(--text-main);
}

.rsvp-form textarea {
  resize: vertical;
  min-height: 70px;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 480px) {
  .row {
    grid-template-columns: 1fr;
  }
}

.btn {
  display: inline-block;
  background-color: var(--gold);
  color: var(--bg);
  border: none;
  border-radius: 6px;
  padding: 12px 24px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: opacity 0.2s ease;
}

.btn:hover {
  opacity: 0.85;
}

.btn-secondary {
  background-color: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--gold);
}

.form-message {
  margin-top: 12px;
  font-weight: bold;
}

.form-message.success {
  color: #4a7a3a;
}

.form-message.error {
  color: #a03a3a;
}

/* ===== Login ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-box {
  background-color: var(--card-bg);
  border: 1px solid var(--gold);
  border-radius: 12px;
  padding: 40px 32px;
  text-align: center;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 4px 24px rgba(201, 168, 76, 0.15);
}

.login-box h1 {
  font-size: 1.6rem;
  margin-top: 0;
  color: var(--gold);
}

.login-box input[type="password"] {
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  padding: 10px;
  border: 1px solid var(--gold);
  border-radius: 6px;
  margin: 16px 0;
  background-color: var(--bg);
  color: var(--text-main);
  text-align: center;
}

/* ===== RSVP footer ===== */
.rsvp-contact {
  text-align: center;
  color: var(--text-secondary);
  margin-top: 8px;
}

.rsvp-contact a {
  color: var(--gold);
  text-decoration: none;
}

/* ===== Admin ===== */
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin: 20px 0;
}

.stat-box {
  background-color: var(--card-bg);
  border: 1px solid var(--gold);
  border-radius: 8px;
  padding: 14px 20px;
  text-align: center;
  flex: 1;
  min-width: 120px;
}

.stat-box .value {
  font-size: 1.6rem;
  font-weight: bold;
  color: var(--gold);
}

.stat-box .label {
  font-size: 0.85rem;
  color: var(--text-tertiary);
}

.stat-box-tooltip {
  cursor: help;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  font-size: 0.95rem;
}

th, td {
  border: 1px solid var(--gold);
  padding: 8px 10px;
  text-align: left;
}

th {
  background-color: var(--card-bg);
  color: var(--text-secondary);
}

tr:nth-child(even) {
  background-color: var(--card-bg);
}

.presence-oui {
  color: #4a7a3a;
  font-weight: bold;
}

.presence-non {
  color: #a03a3a;
  font-weight: bold;
}

.table-wrapper {
  overflow-x: auto;
}

.actions-cell {
  white-space: nowrap;
}

.btn-link {
  background: none;
  border: none;
  padding: 0;
  margin-right: 10px;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--gold);
  text-decoration: underline;
  cursor: pointer;
}

.btn-link:last-child {
  margin-right: 0;
}

.btn-link:hover {
  opacity: 0.8;
}

td input[type="text"],
td input[type="number"],
td select {
  width: 100%;
  min-width: 70px;
  font-family: inherit;
  font-size: 0.9rem;
  padding: 4px 6px;
  border: 1px solid var(--gold);
  border-radius: 4px;
  background-color: var(--bg);
  color: var(--text-main);
}

.guest-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 10px 0;
}

.guest-row {
  display: grid;
  grid-template-columns: 1fr 1fr minmax(100px, 120px) minmax(130px, 150px) auto;
  gap: 10px;
  align-items: center;
}

.guest-row--user {
  grid-template-columns: 1fr 1fr minmax(100px, 120px) minmax(130px, 150px);
}

.guest-row input,
.guest-row select {
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  padding: 8px 10px;
  border: 1px solid var(--gold);
  border-radius: 4px;
  background-color: var(--bg);
  color: var(--text-main);
}

.remove-guest-btn {
  background: none;
  border: 1px solid var(--gold);
  border-radius: 4px;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.remove-guest-btn:hover {
  background-color: var(--card-bg);
}

@media (max-width: 600px) {
  .guest-row,
  .guest-row--user {
    grid-template-columns: 1fr;
  }
}

.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: bold;
  margin-bottom: 15px;
}

.status-en_attente {
  background-color: #f0e6c8;
  color: var(--text-secondary);
}

.status-confirmee {
  background-color: #dcefd2;
  color: #4a7a3a;
}

.status-refusee {
  background-color: #f5dcdc;
  color: #a03a3a;
}

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

.admin-list-header h2 {
  margin: 0;
}

.invitations-table .col-guests {
  min-width: 200px;
}

.invitations-table .col-max {
  width: 60px;
  text-align: center;
}

.invitations-table .col-icon {
  width: 52px;
  text-align: center;
}

.guest-entry {
  white-space: nowrap;
}

.guest-type-icon {
  margin-right: 2px;
}

.guest-separator {
  color: var(--text-tertiary);
}

.text-muted {
  color: var(--text-tertiary);
  font-style: italic;
}

.status-badge-inline {
  margin-bottom: 0;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--gold);
  border-radius: 6px;
  background: var(--bg);
  color: var(--gold);
  cursor: pointer;
}

.icon-btn:hover {
  background-color: var(--card-bg);
}

.icon-btn-success {
  border-color: #4a7a3a;
  color: #4a7a3a;
}

body.modal-open {
  overflow: hidden;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.55);
}

.modal-dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 640px;
  max-height: calc(100vh - 32px);
  overflow: auto;
  background-color: var(--bg);
  border: 1px solid var(--gold);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px 0;
}

.modal-header h2 {
  margin: 0;
  color: var(--gold);
  font-size: 1.25rem;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0 4px;
}

.modal-close-btn:hover {
  color: var(--gold);
}

.modal-body {
  padding: 16px 20px 20px;
}

.modal-body label {
  display: block;
  margin-bottom: 5px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.modal-body input[type="text"],
.modal-body input[type="number"],
.modal-body select,
.modal-body textarea {
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  padding: 8px 10px;
  border: 1px solid var(--gold);
  border-radius: 4px;
  background-color: var(--card-bg);
  color: var(--text-main);
  margin-bottom: 15px;
}

.modal-body textarea {
  min-height: 70px;
  resize: vertical;
}

.modal-link-row {
  margin-bottom: 4px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.admin-search {
  margin-bottom: 16px;
}

.admin-search input[type="search"] {
  width: 100%;
  max-width: 400px;
  padding: 10px 12px;
  border: 1px solid var(--gold);
  border-radius: 6px;
  background-color: var(--card-bg);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem;
}

.admin-empty-search {
  color: var(--text-tertiary);
  font-style: italic;
  margin-top: 8px;
}

.link-row {
  display: flex;
  gap: 10px;
}

.link-row input {
  flex: 1;
}
