/* =========================================================
   K-POP DEMON HUNTERS - WEBAR FILTER STYLES
   ========================================================= */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #0b0714;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #ffffff;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* App Container (Responsive 9:16 aspect ratio or fullscreen on mobile) */
.app-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  max-width: 500px;
  max-height: 900px;
  background: #000000;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(180, 50, 240, 0.2);
  overflow: hidden;
  border-radius: 0px;
  display: flex;
  flex-direction: column;
}

@media (min-width: 550px) and (min-height: 800px) {
  .app-container {
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    height: 95vh;
  }
}

/* Viewport */
.viewport {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0d0818;
}

/* Main Canvas */
#outputCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}

/* Top Header (Clean Logo without Primark) */
.top-header {
  position: absolute;
  top: 18px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
  pointer-events: none;
  padding: 0 16px;
  transition: opacity 0.3s ease;
}

.brand-logo {
  /* Le logo est deja dessine sur le canvas (app.js) pour figurer dans les
     captures : on masque la copie HTML qui se superposait a l'ecran. */
  display: none;
  max-width: 260px;
  width: 60%;
  height: auto;
  filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.85)) drop-shadow(0 0 10px rgba(255, 255, 255, 0.25));
  transition: transform 0.3s ease;
}

/* Status Pill */
.status-pill {
  position: absolute;
  top: 92px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 10, 25, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  color: #e0d0ff;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff0077;
  box-shadow: 0 0 8px #ff0077;
  animation: pulseDot 1.5s infinite;
}

.status-pill.ready .status-dot {
  background: #00ffcc;
  box-shadow: 0 0 8px #00ffcc;
  animation: none;
}

@keyframes pulseDot {
  0% { transform: scale(0.8); opacity: 0.6; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.8); opacity: 0.6; }
}

/* Right Side Actions (TikTok Style) */
.side-actions {
  position: absolute;
  top: 140px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  z-index: 12;
}

.side-btn {
  background: rgba(20, 15, 30, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #ffffff;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  padding: 4px;
}

.side-btn span {
  font-size: 8px;
  margin-top: 1px;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.side-btn:hover {
  background: rgba(255, 0, 128, 0.3);
  border-color: rgba(255, 0, 128, 0.6);
  transform: scale(1.08);
}

.side-btn:active {
  transform: scale(0.92);
}

/* Bottom Controls */
.bottom-controls {
  position: absolute;
  bottom: 24px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 0 16px;
  z-index: 12;
}

/* Gallery Upload Button */
.gallery-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: #fff;
  cursor: pointer;
  background: rgba(20, 15, 30, 0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  width: 52px;
  height: 52px;
  border-radius: 14px;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
}

.gallery-btn:hover {
  background: rgba(180, 50, 240, 0.4);
  transform: scale(1.05);
}

/* Mode Selectors Carousel */
.mode-selector-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

.filter-mode-btn {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-avatar-wrapper {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  padding: 3px;
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid transparent;
  transition: all 0.25s ease;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.btn-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.mode-label {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.8);
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
  letter-spacing: 0.5px;
}

.filter-mode-btn.active .btn-avatar-wrapper {
  border-color: #ff00aa;
  background: linear-gradient(135deg, #ff00aa, #8000ff);
  box-shadow: 0 0 20px rgba(255, 0, 170, 0.8), 0 4px 12px rgba(0,0,0,0.6);
  transform: scale(1.15);
}

.filter-mode-btn#modeBlueBtn.active .btn-avatar-wrapper {
  border-color: #00d4ff;
  background: linear-gradient(135deg, #00d4ff, #0044ff);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.8), 0 4px 12px rgba(0,0,0,0.6);
}

.filter-mode-btn.active .mode-label {
  color: #ffffff;
  text-shadow: 0 0 8px rgba(255, 0, 170, 0.9);
}

.filter-mode-btn#modeBlueBtn.active .mode-label {
  text-shadow: 0 0 8px rgba(0, 212, 255, 0.9);
}

/* Shutter Red Button */
.shutter-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.shutter-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 4px solid #ffffff;
  background: transparent;
  padding: 4px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.shutter-core {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #fe2c55;
  transition: all 0.2s ease;
  box-shadow: 0 0 12px rgba(254, 44, 85, 0.6);
}

.shutter-btn:hover {
  transform: scale(1.06);
}

.shutter-btn:active {
  transform: scale(0.94);
}

.shutter-btn.recording .shutter-core {
  width: 45%;
  height: 45%;
  border-radius: 6px;
  background: #ff0033;
  animation: pulseRec 1s infinite;
}

@keyframes pulseRec {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.shutter-hint {
  font-size: 10px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}

/* Recording Badge */
.recording-badge {
  position: absolute;
  top: -45px;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  align-items: center;
  gap: 8px;
  background: rgba(255, 0, 50, 0.85);
  backdrop-filter: blur(8px);
  padding: 4px 14px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(255, 0, 50, 0.4);
}

.rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffffff;
  animation: pulseDot 1s infinite;
}

/* Flash Overlay */
.flash-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #ffffff;
  opacity: 0;
  pointer-events: none;
  z-index: 50;
  transition: opacity 0.15s ease-out;
}

.flash-overlay.active {
  opacity: 0.85;
}

/* Settings Modal */
.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-panel {
  width: 100%;
  background: #161028;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 24px 24px 0 0;
  padding: 24px;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.8);
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.modal-backdrop.open .modal-panel {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 12px;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: #ff80df;
}

.close-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.setting-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.setting-item label {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
}

.setting-item input[type="range"] {
  width: 100%;
  accent-color: #ff00aa;
}

.switch-item {
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.2);
  transition: .3s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #ff00aa;
}

input:checked + .slider:before {
  transform: translateX(20px);
}
