/* ==========================================================================
   Sena & Mert - Anı Filtresi (Photo Filter Camera Booth)
   Theme: Derin Bordo (#5c0111), Altın (#D4AF37), Fildişi Krem (#FDFBF7)
   Fonts: ConeriaScript, Great Vibes, Playfair Display, Cormorant Garamond
   ========================================================================== */

@font-face {
  font-family: 'ConeriaScript';
  src: url('Demo_ConeriaScript.ttf') format('truetype'),
       url('../Demo_ConeriaScript.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg-bordo: #5c0111;
  --bg-bordo-deep: #40000c;
  --bg-bordo-dark: #2d0008;
  --gold: #D4AF37;
  --gold-light: #F3E5AB;
  --gold-gradient: linear-gradient(135deg, #f9f0c7 0%, #D4AF37 50%, #aa8014 100%);
  --cream: #fbf9f5;
  --white: #ffffff;
  --text-dark: #222222;
  --font-script: 'ConeriaScript', 'Great Vibes', cursive;
  --font-serif: 'Playfair Display', 'Cormorant Garamond', Georgia, serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 20px);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-bordo-dark);
  font-family: var(--font-sans);
  color: var(--white);
  position: fixed;
}

/* ================= Top Navigation Bar ================= */
.filter-top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 50;
  background: linear-gradient(to bottom, rgba(45, 0, 8, 0.85) 0%, rgba(45, 0, 8, 0.4) 70%, transparent 100%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.top-bar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--white);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.top-bar-btn:active {
  transform: scale(0.96);
  background: rgba(255, 255, 255, 0.25);
}

.top-bar-title {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold-light);
  font-weight: 600;
}

/* ================= Viewfinder Container ================= */
.camera-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000000;
}

.viewfinder-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 540px;
  max-height: 960px;
  overflow: hidden;
  background: #111111;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Video Feed */
#camera-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#camera-video.mirrored {
  transform: scaleX(-1);
}

/* ================= Live Filter Overlays ================= */
.filter-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 80px 20px 140px;
  transition: opacity 0.3s ease;
}

/* Style 1: Romantik Bordo & Altın (Default) */
.filter-overlay.style-classic {
  border: 10px solid transparent;
}

.overlay-frame-border {
  position: absolute;
  top: 70px;
  left: 14px;
  right: 14px;
  bottom: 130px;
  border: 1.5px solid rgba(212, 175, 55, 0.75);
  border-radius: 8px;
  pointer-events: none;
}

.overlay-frame-border::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  right: 4px;
  bottom: 4px;
  border: 1px solid rgba(243, 229, 171, 0.4);
  border-radius: 6px;
}

/* Corner Ornaments */
.overlay-flower-tr {
  position: absolute;
  top: 55px;
  right: 0;
  width: 110px;
  opacity: 0.9;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
  pointer-events: none;
}

.overlay-flower-bl {
  position: absolute;
  bottom: 115px;
  left: 0;
  width: 100px;
  opacity: 0.9;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
  pointer-events: none;
}

/* Bottom Souvenir Badge */
.overlay-badge-bottom {
  position: absolute;
  bottom: 145px;
  left: 20px;
  right: 20px;
  text-align: center;
  background: linear-gradient(180deg, rgba(92, 1, 17, 0.85) 0%, rgba(64, 0, 12, 0.92) 100%);
  border: 1px solid rgba(212, 175, 55, 0.85);
  border-radius: 14px;
  padding: 14px 18px 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.overlay-title-script {
  font-family: var(--font-script);
  font-size: 2.6rem;
  line-height: 1;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6), 0 0 12px rgba(212, 175, 55, 0.6);
  margin-bottom: 3px;
  letter-spacing: 0.5px;
}

.overlay-ceremony-tag {
  font-family: var(--font-serif);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 3.5px;
  text-transform: uppercase;
  color: var(--gold-light);
  margin-bottom: 4px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
}

.overlay-date-tag {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 2px;
  color: rgba(255, 255, 255, 0.9);
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.overlay-date-tag::before,
.overlay-date-tag::after {
  content: '•';
  font-size: 0.65rem;
  color: var(--gold);
}

/* Style 2: Polaroid / Fotoğraf Kabini */
.filter-overlay.style-polaroid .overlay-frame-border,
.filter-overlay.style-polaroid .overlay-flower-tr,
.filter-overlay.style-polaroid .overlay-flower-bl,
.filter-overlay.style-polaroid .overlay-badge-bottom {
  display: none;
}

.polaroid-chin {
  display: none;
  position: absolute;
  bottom: 125px;
  left: 12px;
  right: 12px;
  background: #FAF8F5;
  color: var(--text-dark);
  border-radius: 4px 4px 8px 8px;
  padding: 16px 14px 12px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  border-top: 1px solid #ECE7E1;
}

.filter-overlay.style-polaroid .polaroid-chin {
  display: block;
}

.polaroid-title-script {
  font-family: var(--font-script);
  font-size: 2.5rem;
  color: var(--bg-bordo);
  line-height: 1;
  margin-bottom: 2px;
}

.polaroid-sub {
  font-family: var(--font-serif);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 2.5px;
  color: #555;
  text-transform: uppercase;
}

.polaroid-date {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: var(--gold);
  margin-top: 2px;
}

/* Style 3: Minimalist Altın */
.minimal-header,
.minimal-footer {
  display: none;
}

.filter-overlay.style-minimal .overlay-frame-border,
.filter-overlay.style-minimal .overlay-flower-tr,
.filter-overlay.style-minimal .overlay-flower-bl,
.filter-overlay.style-minimal .overlay-badge-bottom,
.filter-overlay.style-minimal .polaroid-chin {
  display: none;
}

.filter-overlay.style-minimal .minimal-header {
  display: block;
  position: absolute;
  top: 75px;
  left: 20px;
  right: 20px;
  text-align: center;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
}

.filter-overlay.style-minimal .minimal-footer {
  display: block;
  position: absolute;
  bottom: 140px;
  left: 20px;
  right: 20px;
  text-align: center;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
}

.minimal-title-script {
  font-family: var(--font-script);
  font-size: 2.8rem;
  color: var(--gold-light);
  line-height: 1;
}

.minimal-sub {
  font-family: var(--font-serif);
  font-size: 0.8rem;
  letter-spacing: 3.5px;
  text-transform: uppercase;
  color: #fff;
  font-weight: 600;
}

.minimal-date {
  font-family: var(--font-sans);
  font-size: 0.74rem;
  letter-spacing: 2px;
  color: var(--gold);
  margin-top: 4px;
}

/* ================= Bottom Controls Bar ================= */
.camera-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: linear-gradient(to top, rgba(45, 0, 8, 0.95) 0%, rgba(45, 0, 8, 0.75) 65%, transparent 100%);
  padding: 10px 20px calc(var(--safe-bottom) + 12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

/* Style Selector Pills */
.filter-style-selector {
  display: flex;
  gap: 8px;
  background: rgba(0, 0, 0, 0.4);
  padding: 4px;
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.style-pill {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.style-pill.active {
  background: var(--bg-bordo);
  color: var(--gold-light);
  border: 1px solid rgba(212, 175, 55, 0.6);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Shutter & Action Buttons */
.controls-row {
  width: 100%;
  max-width: 420px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 10px;
}

.ctrl-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: var(--white);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.ctrl-btn:active {
  transform: scale(0.9);
  background: rgba(255, 255, 255, 0.3);
}

/* Main Shutter Button */
.shutter-btn {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: transparent;
  border: 4px solid var(--white);
  padding: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.35);
}

.shutter-btn-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--white);
  transition: all 0.15s ease;
}

.shutter-btn:active {
  transform: scale(0.92);
}

.shutter-btn:active .shutter-btn-inner {
  transform: scale(0.88);
  background: var(--gold-light);
}

/* ================= Flash Animation Effect ================= */
.camera-flash-screen {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #ffffff;
  opacity: 0;
  pointer-events: none;
  z-index: 100;
  transition: opacity 0.08s ease-out;
}

.camera-flash-screen.flashing {
  opacity: 0.95;
}

/* ================= Preview Modal (Captured Photo) ================= */
.preview-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(45, 0, 8, 0.96);
  z-index: 200;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 20px 16px calc(var(--safe-bottom) + 16px);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

.preview-top-bar {
  width: 100%;
  max-width: 500px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.preview-title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: var(--gold-light);
  letter-spacing: 1px;
}

.preview-close-btn {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.preview-img-container {
  flex: 1;
  width: 100%;
  max-width: 440px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 0;
  min-height: 0;
}

.preview-rendered-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(212, 175, 55, 0.4);
}

/* Actions in Preview */
.preview-actions {
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.btn-primary-action {
  flex: 1;
  background: var(--gold-gradient);
  color: #2b1704;
  font-weight: 700;
  border: none;
  padding: 14px 18px;
  border-radius: 14px;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(212, 175, 55, 0.35);
  transition: all 0.2s ease;
}

.btn-primary-action:active {
  transform: scale(0.97);
}

.btn-secondary-action {
  flex: 1;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: var(--white);
  font-weight: 600;
  padding: 14px 18px;
  border-radius: 14px;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary-action:active {
  transform: scale(0.97);
  background: rgba(255, 255, 255, 0.2);
}

.btn-tertiary-action {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.85rem;
  padding: 6px;
  cursor: pointer;
  text-decoration: underline;
  text-align: center;
}

/* ================= Upload to Drive Sheet inside Preview ================= */
.gallery-upload-box {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 2px;
  width: 100%;
  box-sizing: border-box;
}

.gallery-name-input {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  padding: 10px 14px;
  color: #fff;
  font-size: 0.88rem;
  outline: none;
  font-family: inherit;
}

.gallery-name-input::placeholder {
  color: rgba(255, 255, 255, 0.55);
}

.gallery-name-input:focus {
  border-color: var(--gold);
  background: rgba(255, 255, 255, 0.15);
}

.btn-upload-drive {
  width: 100%;
  box-sizing: border-box;
  background: var(--gold-gradient);
  color: #2b1704;
  font-weight: 700;
  border: none;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.25);
  transition: all 0.2s ease;
}

.btn-upload-drive:active {
  transform: scale(0.98);
}

.btn-upload-drive:disabled {
  opacity: 0.75;
  cursor: not-allowed;
}

/* ================= Toast Notification ================= */
.filter-toast {
  position: fixed;
  top: 76px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: rgba(20, 20, 20, 0.95);
  border: 1px solid rgba(212, 175, 55, 0.6);
  color: #fff;
  padding: 10px 20px;
  border-radius: 24px;
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 300;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

/* ================= Camera Fallback (Denied Permission / Desktop) ================= */
.camera-fallback-card {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 380px;
  background: #FAF8F5;
  color: var(--text-dark);
  border-radius: 16px;
  padding: 32px 22px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
  z-index: 40;
  display: none;
}

.fallback-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto 16px;
  background: #f4eaec;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bg-bordo);
}

.fallback-title {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: var(--bg-bordo);
  margin-bottom: 8px;
}

.fallback-desc {
  font-size: 0.88rem;
  color: #666;
  line-height: 1.5;
  margin-bottom: 20px;
}

.btn-fallback-gallery {
  display: inline-block;
  width: 100%;
  background: var(--bg-bordo);
  color: #fff;
  font-weight: 600;
  padding: 13px;
  border-radius: 12px;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-fallback-gallery:active {
  background: var(--bg-bordo-deep);
}

.btn-fallback-retry {
  display: inline-block;
  margin-top: 10px;
  color: #888;
  font-size: 0.82rem;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
}
