/* ===== Variables & Reset ===== */
:root {
  --primary: #8B7355;
  --secondary: #F5F0EB;
  --accent: #C9A86C;
  --text: #2C2C2C;
  --text-light: #6B6B6B;
  --white: #FFFFFF;
  --shadow: 0 4px 20px rgba(0,0,0,0.08);
  --radius: 12px;
  --font-heading: 'Playfair Display', serif;
  --font-body: 'Lato', sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--secondary);
  line-height: 1.6;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  text-decoration: none;
  color: inherit;
}

ul, ol {
  list-style: none;
}

button, input, textarea, select {
  font-family: inherit;
  font-size: 1rem;
}

/* ===== Icons (SVG inline style helpers) ===== */
.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25em;
  height: 1.25em;
  vertical-align: middle;
}

.icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

/* ===== Typography ===== */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.3;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.25s ease;
  background: var(--primary);
  color: var(--white);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(139, 115, 85, 0.35);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}

.btn-outline:hover {
  background: var(--primary);
  color: var(--white);
}

.btn-accent {
  background: var(--accent);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

/* ===== Home Page ===== */
.home {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.home-header {
  background: var(--primary);
  color: var(--white);
  padding: 3rem 1.5rem;
  text-align: center;
}

.home-header h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.home-header p {
  opacity: 0.9;
  font-size: 1.1rem;
}

.home-list {
  max-width: 900px;
  margin: 2rem auto;
  padding: 0 1.5rem;
  display: grid;
  gap: 1.5rem;
}

.home-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 1.5rem;
  transition: transform 0.2s;
}

.home-card:hover {
  transform: translateY(-3px);
}

.home-card-img {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--secondary);
}

.home-card-info h2 {
  font-size: 1.4rem;
  margin-bottom: 0.25rem;
}

.home-card-info p {
  color: var(--text-light);
  font-size: 0.95rem;
}

.home-empty {
  text-align: center;
  padding: 4rem 1.5rem;
  color: var(--text-light);
}

/* ===== Invitation Page ===== */
.invitation {
  --primary: var(--theme-primary, #8B7355);
  --secondary: var(--theme-secondary, #F5F0EB);
  --accent: var(--theme-accent, #C9A86C);
}

.invitation body,
body.invitation {
  background: var(--secondary);
}

/* Cover / Hero */
.cover {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--white);
  background: linear-gradient(135deg, rgba(0,0,0,0.55), rgba(0,0,0,0.4)), var(--cover-bg, var(--primary));
  background-size: cover;
  background-position: center;
  padding: 2rem 1.5rem;
}

.cover-ornament {
  width: 80px;
  height: 2px;
  background: var(--accent);
  margin: 1rem auto;
}

.cover .guest-greeting {
  font-size: 1.1rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  opacity: 0.95;
  margin-bottom: 1.5rem;
  font-weight: 300;
}

.cover .couple-names {
  font-family: var(--font-heading);
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  font-weight: 500;
  margin-bottom: 0.5rem;
  letter-spacing: 1px;
}

.cover .and {
  font-size: 1.5rem;
  font-style: italic;
  opacity: 0.9;
  margin: 0.5rem 0;
}

.cover .date {
  font-size: 1.2rem;
  letter-spacing: 3px;
  margin-top: 1.5rem;
  opacity: 0.95;
}

.cover .open-btn {
  margin-top: 2.5rem;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* Sections */
.section {
  padding: 4rem 1.5rem;
  max-width: 900px;
  margin: 0 auto;
}

.section-title {
  text-align: center;
  font-size: 2rem;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.section-subtitle {
  text-align: center;
  color: var(--text-light);
  margin-bottom: 2.5rem;
  font-size: 0.95rem;
}

.divider {
  width: 60px;
  height: 2px;
  background: var(--accent);
  margin: 0 auto 2rem;
}

/* Countdown */
.countdown {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.countdown-item {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  min-width: 80px;
  text-align: center;
  box-shadow: var(--shadow);
}

.countdown-item .num {
  font-family: var(--font-heading);
  font-size: 2rem;
  color: var(--primary);
  display: block;
}

.countdown-item .label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-light);
}

/* Couple */
.couple-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
}

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

.person {
  text-align: center;
}

.person-photo {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 1.25rem;
  border: 4px solid var(--accent);
  box-shadow: var(--shadow);
  background: var(--white);
}

.person h3 {
  font-size: 1.5rem;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.person .parents {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-top: 0.5rem;
}

/* Story */
.story-content {
  background: var(--white);
  padding: 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text);
}

.quote {
  font-family: var(--font-heading);
  font-style: italic;
  font-size: 1.3rem;
  color: var(--primary);
  text-align: center;
  margin: 2rem 0;
  padding: 0 1rem;
}

/* Events */
.events-list {
  display: grid;
  gap: 1.5rem;
}

.event-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}

.event-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  flex-shrink: 0;
}

.event-icon svg {
  width: 24px;
  height: 24px;
}

.event-info h4 {
  font-size: 1.2rem;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.event-info p {
  color: var(--text-light);
  font-size: 0.95rem;
}

/* Gallery */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.75rem;
}

.gallery-item {
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.gallery-item:hover img {
  transform: scale(1.08);
}

/* Map */
.map-container {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  height: 300px;
}

.map-container iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.map-address {
  text-align: center;
  margin-top: 1rem;
  color: var(--text-light);
}

/* Gift */
.gift-box {
  background: var(--white);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  text-align: center;
}

.gift-box .bank {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary);
  margin: 1rem 0 0.25rem;
}

.gift-box .account {
  font-size: 1.3rem;
  letter-spacing: 1px;
  margin: 0.5rem 0;
  font-family: monospace;
}

.gift-box .copy-btn {
  margin-top: 1rem;
}

/* RSVP */
.rsvp-form {
  background: var(--white);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  max-width: 500px;
  margin: 0 auto;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
  color: var(--text);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fafafa;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--white);
}

.attendance-options {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.attendance-options label {
  flex: 1;
  min-width: 100px;
  text-align: center;
  padding: 0.75rem;
  border: 2px solid #ddd;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.attendance-options input {
  display: none;
}

.attendance-options input:checked + span,
.attendance-options label:has(input:checked) {
  border-color: var(--primary);
  background: var(--secondary);
  color: var(--primary);
}

.rsvp-success {
  text-align: center;
  padding: 2rem;
  color: var(--primary);
}

/* Footer */
.invitation-footer {
  text-align: center;
  padding: 3rem 1.5rem;
  background: var(--primary);
  color: var(--white);
}

.invitation-footer p {
  opacity: 0.85;
  font-size: 0.9rem;
}

/* Music player */
.music-toggle {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--white);
  border: none;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  cursor: pointer;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.music-toggle svg {
  width: 22px;
  height: 22px;
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.lightbox.active {
  display: flex;
}

.lightbox img {
  max-height: 90vh;
  max-width: 90vw;
  border-radius: 8px;
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: white;
  font-size: 2rem;
  cursor: pointer;
}

/* ===== Admin ===== */
.admin-body {
  background: #f0f2f5;
  min-height: 100vh;
}

.admin-nav {
  background: #1a1a2e;
  color: white;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-nav a {
  color: white;
  opacity: 0.9;
}

.admin-nav a:hover {
  opacity: 1;
}

.admin-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.admin-header h1 {
  font-size: 1.75rem;
  color: #1a1a2e;
}

.admin-table {
  width: 100%;
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.admin-table table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 1rem 1.25rem;
  text-align: left;
  border-bottom: 1px solid #eee;
}

.admin-table th {
  background: #f8f9fa;
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #666;
}

.admin-table tr:last-child td {
  border-bottom: none;
}

.admin-table .actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-success {
  background: #d4edda;
  color: #155724;
}

.badge-muted {
  background: #e9ecef;
  color: #6c757d;
}

/* Admin Form */
.admin-form {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
}

.admin-form .form-section {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid #eee;
}

.admin-form .form-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.admin-form .form-section h2 {
  font-size: 1.25rem;
  margin-bottom: 1.25rem;
  color: #1a1a2e;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

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

.form-row.full {
  grid-template-columns: 1fr;
}

.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 500;
  cursor: pointer;
}

.color-input {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.color-input input[type="color"] {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  padding: 0;
}

.preview-img {
  max-width: 150px;
  border-radius: 8px;
  margin-top: 0.5rem;
}

.form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

/* Guests admin */
.guest-link {
  font-family: monospace;
  font-size: 0.85rem;
  background: #f0f0f0;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  word-break: break-all;
}

.copy-link-btn {
  cursor: pointer;
  color: var(--primary);
  font-size: 0.85rem;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #1a1a2e;
  color: white;
  padding: 0.85rem 1.5rem;
  border-radius: 8px;
  z-index: 999;
  opacity: 0;
  transition: all 0.3s;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* 404 */
.page-404 {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
}

.page-404 h1 {
  font-size: 4rem;
  color: var(--primary);
}

.page-404 p {
  margin: 1rem 0 2rem;
  color: var(--text-light);
}

/* ===== Petals (shared with landing) ===== */
.petals-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  overflow: hidden;
}

.petal {
  position: absolute;
  top: -40px;
  opacity: 0.65;
  animation: petal-fall linear infinite;
  will-change: transform;
}

.petal svg {
  display: block;
}

@keyframes petal-fall {
  0% {
    transform: translateY(0) rotate(0deg) translateX(0);
    opacity: 0.7;
  }
  100% {
    transform: translateY(110vh) rotate(680deg) translateX(50px);
    opacity: 0.1;
  }
}

/* Invitation content above petals */
.cover,
#mainContent,
.music-toggle,
.lightbox {
  position: relative;
  z-index: 60;
}

.music-toggle {
  z-index: 80;
}

/* ===== Better mobile invitation ===== */
@media (max-width: 768px) {
  .section {
    padding: 2.75rem 1.15rem;
  }
  .cover {
    padding: 1.5rem 1.15rem;
    min-height: 100svh;
  }
  .cover .couple-names {
    font-size: clamp(2rem, 9vw, 2.6rem);
  }
  .cover .guest-greeting {
    font-size: 0.95rem;
  }
  .cover .open-btn {
    margin-top: 2rem;
    padding: 0.85rem 1.6rem;
  }
  .person-photo {
    width: 140px;
    height: 140px;
  }
  .countdown-item {
    min-width: 68px;
    padding: 1rem 0.9rem;
  }
  .countdown-item .num {
    font-size: 1.6rem;
  }
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }
  .event-card {
    padding: 1.15rem;
  }
  .rsvp-form {
    padding: 1.5rem;
  }
  .music-toggle {
    bottom: 1.15rem;
    right: 1.15rem;
    width: 46px;
    height: 46px;
  }
  .invitation-footer {
    padding: 2.5rem 1.15rem;
  }
}

@media (min-width: 769px) {
  .section {
    padding: 5rem 1.5rem;
  }
  .cover .couple-names {
    font-size: clamp(3rem, 6vw, 4.5rem);
  }
  .person-photo {
    width: 200px;
    height: 200px;
  }
}

/* Touch-friendly */
@media (hover: none) {
  .btn:hover {
    transform: none;
  }
  .gallery-item:hover img {
    transform: none;
  }
}
