:root {
  --gold: #c9a227;
  --gold-light: #e8d48b;
  --gold-dark: #8b6914;
  --maroon: #800020;
  --maroon-dark: #4a0012;
  --cream: #faf6e9;
  --dark: #1a0a0a;
  --dark-overlay: rgba(26, 10, 10, 0.85);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Poppins', sans-serif;
  background: var(--dark);
  color: var(--cream);
  min-height: 100vh;
  overflow-x: hidden;
}

.hidden { display: none !important; }

/* Splash Screen */
.splash {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, var(--maroon-dark) 0%, var(--dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: opacity 0.5s, visibility 0.5s;
}

.splash.fade-out {
  opacity: 0;
  visibility: hidden;
}

.splash-content {
  text-align: center;
}

.mandala {
  width: 120px;
  height: 120px;
  margin: 0 auto 2rem;
  border: 3px solid var(--gold);
  border-radius: 50%;
  position: relative;
  animation: rotate 20s linear infinite;
}

.mandala::before, .mandala::after {
  content: '';
  position: absolute;
  inset: 10px;
  border: 2px solid var(--gold-light);
  border-radius: 50%;
}

.mandala::after {
  inset: 25px;
  border-style: dashed;
}

@keyframes rotate {
  to { transform: rotate(360deg); }
}

.couple-names {
  font-family: 'Playfair Display', serif;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 0.5rem;
}

.wedding-date {
  font-size: 1rem;
  color: var(--gold-light);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.splash-loader {
  width: 40px;
  height: 40px;
  margin: 2rem auto 0;
  border: 3px solid var(--gold-dark);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Main App */
.app {
  min-height: 100vh;
  padding-bottom: 70px;
}

/* Bottom Navigation */
.nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: var(--dark);
  border-top: 1px solid var(--gold-dark);
  padding: 0.5rem;
  z-index: 100;
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.6rem;
  background: none;
  border: none;
  color: var(--gold-dark);
  font-size: 0.7rem;
  cursor: pointer;
  transition: color 0.2s;
}

.nav-btn .nav-icon {
  font-size: 1.4rem;
}

.nav-btn.active {
  color: var(--gold);
}

/* Views */
.view {
  display: none;
}

.view.active {
  display: block;
}

/* Header */
.header {
  text-align: center;
  padding: 1.5rem 1rem;
  background: linear-gradient(180deg, var(--maroon-dark) 0%, transparent 100%);
}

.header h1 {
  font-family: 'Playfair Display', serif;
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--gold);
}

.header .subtitle {
  font-size: 0.85rem;
  color: var(--gold-light);
  margin-top: 0.25rem;
}

/* HOME/CAMERA VIEW */
#home-view .camera-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 70px;
  display: flex;
  flex-direction: column;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

#home-view .camera-container::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 0;
}

.camera-preview {
  flex: 1;
  position: relative;
  overflow: hidden;
  margin: 1rem;
  border-radius: 20px;
  z-index: 1;
  background: #000;
}

#camera-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#camera-canvas {
  display: none;
}

/* Event Overlay on Camera */
.event-overlay {
  position: absolute;
  top: 1rem;
  left: 1rem;
  right: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  z-index: 10;
}

.event-info-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 0.75rem 1rem;
  border-radius: 16px;
  border: 1px solid var(--gold);
  cursor: pointer;
  transition: transform 0.2s;
  max-width: 60%;
}

.event-info-card:active {
  transform: scale(0.95);
}

.event-info-card .event-emoji {
  font-size: 1.5rem;
}

.event-info-card .event-name {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--gold);
  line-height: 1.2;
}

.event-info-card .event-time {
  font-size: 0.75rem;
  color: var(--gold-light);
}

.photo-counter {
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 0.5rem 0.75rem;
  border-radius: 20px;
  font-size: 0.85rem;
  color: var(--cream);
  border: 1px solid var(--gold);
}

/* Camera Controls */
.camera-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  padding: 1.25rem;
  background: transparent;
  position: relative;
  z-index: 1;
}

.camera-btn {
  background: none;
  border: none;
  cursor: pointer;
  transition: transform 0.2s;
}

.camera-btn:active {
  transform: scale(0.9);
}

.camera-btn.secondary {
  width: 50px;
  height: 50px;
  background: var(--maroon);
  border-radius: 50%;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.camera-btn.primary {
  width: 75px;
  height: 75px;
  background: var(--gold);
  border-radius: 50%;
  padding: 5px;
}

.shutter {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--cream);
  border-radius: 50%;
  border: 3px solid var(--dark);
}

/* Events Grid */
.events-grid {
  display: grid;
  gap: 1rem;
  padding: 1rem;
}

.event-card {
  background: linear-gradient(135deg, var(--maroon) 0%, var(--maroon-dark) 100%);
  border-radius: 16px;
  padding: 1.5rem;
  border: 1px solid var(--gold-dark);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s;
}

.event-card:active {
  transform: scale(0.98);
}

.event-card.has-image {
  min-height: 160px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background-size: cover;
  background-position: center;
}

.event-card.has-image::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.2), rgba(0,0,0,0.7));
}

.event-card.has-image > * {
  position: relative;
  z-index: 1;
}

.event-card .event-emoji {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.event-card .event-name {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--gold);
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.event-card .event-date {
  font-size: 0.9rem;
  color: var(--gold-light);
}

.event-card .event-time {
  font-size: 0.8rem;
  color: var(--cream);
  opacity: 0.9;
}

.event-card .event-dress-code {
  font-size: 0.75rem;
  color: var(--gold-light);
  margin-top: 0.5rem;
  padding: 0.25rem 0.5rem;
  background: rgba(0,0,0,0.3);
  border-radius: 4px;
  display: inline-block;
}

.event-card .event-photos {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--gold);
  color: var(--dark);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: 20px;
  z-index: 2;
}

/* Gallery */
.gallery-filter {
  padding: 0 1rem 1rem;
}

.gallery-filter select {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--maroon-dark);
  border: 1px solid var(--gold-dark);
  border-radius: 8px;
  color: var(--cream);
  font-size: 0.9rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 0 4px;
}

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

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

.gallery-item:active img {
  transform: scale(1.1);
}

.gallery-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--gold-light);
}

.gallery-empty p:first-child {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

/* Modals */
.modal {
  position: fixed;
  inset: 0;
  background: var(--dark-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
}

#viewer-modal {
  flex-direction: column;
  background: #000;
}

.viewer-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 40px;
  height: 40px;
  background: var(--dark-overlay);
  border: none;
  border-radius: 50%;
  color: var(--cream);
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 10;
}

#viewer-image {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
}

.viewer-info {
  display: flex;
  justify-content: space-between;
  padding: 1rem;
  color: var(--gold-light);
  font-size: 0.85rem;
}

.btn {
  padding: 1rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
}

.btn.primary {
  background: var(--gold);
  color: var(--dark);
}

#download-btn {
  margin: 0 1rem 1rem;
}

/* Toasts */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--dark);
  border: 1px solid var(--gold-dark);
  border-radius: 12px;
  padding: 1rem 1.5rem;
  z-index: 300;
  min-width: 200px;
}

.toast-content {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toast-progress {
  height: 3px;
  background: var(--maroon-dark);
  border-radius: 3px;
  margin-top: 0.75rem;
  overflow: hidden;
}

.toast-progress-bar {
  height: 100%;
  background: var(--gold);
  width: 0%;
  transition: width 0.3s;
}

.toast.success {
  background: var(--maroon);
  border-color: var(--gold);
}
