/* Custom Design Tokens & Variables */
:root {
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  /* Palette - Warm Champagne & Metallic Gold */
  --bg-gradient: linear-gradient(135deg, #fdfbf7 0%, #f6eff0 50%, #eae1dd 100%);
  --color-primary: #d4af37; /* Rich Gold */
  --color-primary-dark: #b8972e;
  --color-primary-light: #f4e9c7;
  --color-text-dark: #2c3e50; /* Charcoal */
  --color-text-muted: #627282;
  --color-card-bg: rgba(255, 255, 255, 0.75);
  --color-card-border: rgba(255, 255, 255, 0.45);
  --color-success: #6c8e75; /* Elegant Sage Green */
  --color-error: #c97a7a; /* Elegant Rose Terracotta */
  
  /* Shadow & Blur */
  --glass-shadow: 0 10px 30px rgba(184, 151, 46, 0.06), 0 1px 8px rgba(0, 0, 0, 0.04);
  --glass-blur: blur(12px);
  --border-radius-lg: 24px;
  --border-radius-md: 16px;
  --border-radius-sm: 8px;
  --transition-smooth: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Reset & Base Settings */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  width: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-gradient);
  color: var(--color-text-dark);
  min-height: 100vh;
  min-height: -webkit-fill-available;
  position: relative;
  overflow-x: clip;
  line-height: 1.5;
  width: 100%;
}

/* Floating Decorative Orbs */
.bg-circle {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  z-index: -1;
  opacity: 0.4;
  pointer-events: none;
}
.bg-circle-1 {
  width: 300px;
  height: 300px;
  background: var(--color-primary-light);
  top: -100px;
  right: -50px;
}
.bg-circle-2 {
  width: 400px;
  height: 400px;
  background: #ecd5b8;
  bottom: -150px;
  left: -150px;
}

/* App Container */
.app-container {
  max-width: 580px;
  margin: 0 auto;
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: -webkit-fill-available;
}

/* Header Styling */
.app-header {
  text-align: center;
  margin-bottom: 35px;
  position: relative;
}
.app-header .couple-names {
  font-family: var(--font-serif);
  font-size: 2.8rem;
  font-weight: 700;
  color: var(--color-text-dark);
  letter-spacing: -0.5px;
  margin-bottom: 6px;
  line-height: 1.2;
}
.app-header .couple-names::after {
  content: "";
  display: block;
  width: 60px;
  height: 1.5px;
  background: var(--color-primary);
  margin: 12px auto;
  border-radius: 2px;
}
.app-header .wedding-tag {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--color-primary-dark);
  font-weight: 600;
  margin-bottom: 15px;
}
.app-header .intro-text {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  max-width: 480px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Glassmorphism Cards */
.glass-card {
  background: var(--color-card-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--color-card-border);
  border-radius: var(--border-radius-lg);
  padding: 30px 24px;
  box-shadow: var(--glass-shadow);
  margin-bottom: 30px;
  transition: var(--transition-smooth);
}
.glass-card:hover {
  box-shadow: 0 15px 35px rgba(184, 151, 46, 0.1), 0 2px 10px rgba(0, 0, 0, 0.03);
}

.section-title {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  color: var(--color-text-dark);
  margin-bottom: 20px;
  font-weight: 600;
}
.text-center {
  text-align: center;
}

/* Drop Zone / Image Selector Area */
.file-drop-zone {
  border: 2px dashed rgba(212, 175, 55, 0.4);
  border-radius: var(--border-radius-md);
  padding: 35px 20px;
  text-align: center;
  background: rgba(253, 251, 247, 0.5);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: var(--transition-smooth);
  margin-bottom: 24px;
}
.file-drop-zone:hover {
  border-color: var(--color-primary);
  background: rgba(253, 251, 247, 0.8);
}
.file-drop-zone.dragover {
  border-color: var(--color-primary-dark);
  background: var(--color-primary-light);
  transform: scale(0.99);
}

.drop-zone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.upload-icon {
  color: var(--color-primary);
  transition: var(--transition-smooth);
}
.file-drop-zone:hover .upload-icon {
  transform: translateY(-4px);
}
.drop-instruction {
  font-size: 0.95rem;
  color: var(--color-text-muted);
}

/* Custom Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 14px 28px;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: white;
  border: none;
  border-radius: var(--border-radius-md);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
  transition: var(--transition-smooth);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(212, 175, 55, 0.45);
}
.btn-primary:active {
  transform: translateY(1px);
}

.btn-secondary {
  display: inline-block;
  padding: 8px 18px;
  background: white;
  color: var(--color-primary-dark);
  border: 1px solid rgba(212, 175, 55, 0.4);
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  transition: var(--transition-smooth);
}
.btn-secondary:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
}

/* Image Previews */
.preview-container {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(253, 251, 247, 0.95);
  z-index: 10;
  border-radius: var(--border-radius-md);
}
.preview-grid {
  display: flex;
  gap: 16px;
  padding: 24px;
  overflow-x: auto;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: flex-start;
}
.preview-item-container {
  position: relative;
  flex-shrink: 0;
}
.preview-item {
  width: 90px;
  height: 90px;
  border-radius: var(--border-radius-sm);
  object-fit: cover;
  border: 2px solid white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: block;
}
.btn-remove-item {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-error);
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: var(--transition-smooth);
  z-index: 15;
}
.btn-remove-item:hover {
  transform: scale(1.15) rotate(90deg);
  background: #b55f5f;
}
.preview-video-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: linear-gradient(135deg, #2c3e50, #34495e);
  color: white;
}
.preview-video-icon span {
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 1px;
}
.btn-remove-preview {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: var(--transition-smooth);
}
.btn-remove-preview:hover {
  background: rgba(201, 122, 122, 0.9);
  transform: rotate(90deg);
}

/* Form Styling */
.form-group {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-text-dark);
}
.form-group input[type="text"],
.form-group textarea,
.password-form-group input {
  font-family: var(--font-sans);
  padding: 12px 16px;
  font-size: 0.95rem;
  border-radius: var(--border-radius-md);
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: rgba(255, 255, 255, 0.6);
  color: var(--color-text-dark);
  outline: none;
  transition: var(--transition-smooth);
}
.form-group input[type="text"]:focus,
.form-group textarea:focus,
.password-form-group input:focus {
  border-color: var(--color-primary);
  background: white;
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15);
}
.form-group textarea {
  resize: vertical;
}

/* Alert Elements */
.alert {
  padding: 12px 16px;
  border-radius: var(--border-radius-md);
  font-size: 0.9rem;
  margin-bottom: 20px;
  display: none;
  line-height: 1.4;
}
.alert.success {
  background: #f1f6f2;
  color: var(--color-success);
  border: 1px solid rgba(108, 142, 117, 0.2);
  display: block;
}
.alert.error {
  background: #faf2f2;
  color: var(--color-error);
  border: 1px solid rgba(201, 122, 122, 0.2);
  display: block;
}

/* Progress Bar */
.upload-progress-container {
  display: none;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 20px;
}
.progress-bar-wrapper {
  height: 6px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 3px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--color-primary);
  border-radius: 3px;
  transition: width 0.1s linear;
}
.progress-text {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  text-align: right;
}

/* Loading Spinners */
.spinner {
  display: none;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 0.8s linear infinite;
  margin-left: 10px;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Gallery Section */
.gallery-section {
  margin-top: 40px;
}
.gallery-header {
  margin-bottom: 25px;
}
.gallery-subtitle {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-top: 4px;
}

.sync-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-text-dark);
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(8px);
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid rgba(0, 0, 0, 0.05);
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
}

/* Masonry-inspired Gallery Grid */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
@media (max-width: 400px) {
  .gallery-grid {
    grid-template-columns: 1fr;
  }
}

.gallery-card {
  background: white;
  border-radius: var(--border-radius-md);
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.03);
  transition: var(--transition-smooth);
  opacity: 0;
  transform: translateY(20px);
  animation: cardFadeIn 0.6s forwards;
}
@keyframes cardFadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.gallery-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 25px rgba(184, 151, 46, 0.1);
}

/* Batch Image Grid System */
.batch-grid {
  display: grid;
  gap: 2px;
  overflow: hidden;
  border-radius: var(--border-radius-md) var(--border-radius-md) 0 0;
}
.batch-grid-1 {
  grid-template-columns: 1fr;
}
.batch-grid-2 {
  grid-template-columns: 1fr 1fr;
}
.batch-grid-4,
.batch-grid-many {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}
.batch-img-wrapper {
  position: relative;
  padding-top: 100%;
  overflow: hidden;
  background: #fcfbf9;
}
.batch-grid-1 .batch-img-wrapper {
  padding-top: 110%;
}
.batch-grid-2 .batch-img-wrapper {
  padding-top: 120%;
}
.batch-img-wrapper img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition-smooth);
}
.gallery-card:hover .batch-img-wrapper img {
  transform: scale(1.04);
}
.batch-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 1px;
}
.gallery-card-count {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--color-primary-dark);
  background: var(--color-primary-light);
  padding: 2px 10px;
  border-radius: 12px;
  font-weight: 500;
}

.gallery-card-content {
  padding: 12px 14px;
  background: white;
}
.gallery-card-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-dark);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gallery-card-msg {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  line-height: 1.4;
  word-wrap: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Gallery Skeletons */
.gallery-skeleton {
  display: contents;
}
.skeleton-card {
  height: 240px;
  background: linear-gradient(90deg, #f0eae1 25%, #f8f4ee 50%, #f0eae1 75%);
  background-size: 200% 100%;
  animation: loadingSkeleton 1.5s infinite;
  border-radius: var(--border-radius-md);
}
@keyframes loadingSkeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* No Photos and Password Lock */
.no-photos {
  text-align: center;
  padding: 40px 20px;
  color: var(--color-text-muted);
  font-size: 0.95rem;
  background: var(--color-card-bg);
  border-radius: var(--border-radius-md);
  border: 1px dashed rgba(212, 175, 55, 0.3);
}

.password-lock-section {
  text-align: center;
}
.lock-desc {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-bottom: 20px;
}
.password-form-group {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.password-form-group input {
  flex: 1;
  min-width: 180px;
}
.password-form-group button {
  width: auto;
}

.hidden {
  display: none !important;
}

/* Lightbox Fullscreen Modal */
.lightbox-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.lightbox-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 10, 12, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  z-index: 10001;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: white;
  font-size: 2.2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
  transition: all 0.2s ease;
}
.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10001;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: white;
  font-size: 3rem;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
  transition: all 0.2s ease;
}
.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.35);
  transform: translateY(-50%) scale(1.1);
}
.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }

.lightbox-content {
  position: relative;
  z-index: 10000;
  max-width: 90vw;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.lightbox-img-wrapper {
  max-width: 100%;
  max-height: 72vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-img-wrapper img {
  max-width: 100%;
  max-height: 72vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  transition: opacity 0.2s ease;
}

.lightbox-info {
  margin-top: 14px;
  text-align: center;
  color: white;
  max-width: 500px;
  padding: 0 10px;
}

.lightbox-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 4px;
}

.lightbox-name {
  font-weight: 600;
  font-size: 1.05rem;
  color: #f3e5ab;
}

.lightbox-counter {
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 8px;
  border-radius: 10px;
}

.lightbox-msg {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.4;
}

@media (max-width: 600px) {
  .lightbox-nav {
    width: 40px;
    height: 40px;
    font-size: 2.2rem;
  }
  .lightbox-prev { left: 8px; }
  .lightbox-next { right: 8px; }
  .lightbox-close {
    top: 12px;
    right: 12px;
    width: 38px;
    height: 38px;
    font-size: 1.8rem;
  }
  .lightbox-img-wrapper img {
    max-height: 65vh;
  }
}

/* Footer Styling */
.app-footer {
  text-align: center;
  margin-top: auto;
  padding-top: 50px;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}
