@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Metal+Mania&family=Permanent+Marker&family=Caveat:wght@400;700&display=swap');

:root {
  font-family: 'Inter', system-ui, sans-serif;
}

.font-metal {
  font-family: 'Metal Mania', cursive;
}

.font-graffiti {
  font-family: 'Permanent Marker', cursive;
}

.font-hand {
  font-family: 'Caveat', cursive;
}

/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Range Input Styling */
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  height: 16px;
  width: 16px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.5);
  cursor: pointer;
  margin-top: -6px;
  /* You need to specify a margin in Chrome, but in Firefox and IE it is automatic */
}

input[type="range"]::-webkit-slider-runnable-track {
  width: 100%;
  height: 4px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
}

/* Animations */
@keyframes pulse-glow {

  0%,
  100% {
    box-shadow: 0 0 5px rgba(34, 197, 94, 0.2);
  }

  50% {
    box-shadow: 0 0 15px rgba(34, 197, 94, 0.6);
  }
}

.engine-active {
  background-color: #22c55e !important;
  animation: pulse-glow 2s infinite;
}

/* Safe Area Dashed Lines */
.safe-grid-v {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(255, 255, 255, 0.1);
}

.safe-grid-h {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}

/* Toast Animation */
.toast-enter {
  transform: translateX(100%);
  opacity: 0;
}

.toast-enter-active {
  transform: translateX(0);
  opacity: 1;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast-exit {
  transform: translateX(0);
  opacity: 1;
}

.toast-exit-active {
  transform: translateX(100%);
  opacity: 0;
  transition: all 0.3s ease-in;
}

/* --- Advanced Video Effects --- */

/* 1. Glitch Effect */
.effect-glitch {
  animation: glitch-anim 2s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
  0% {
    transform: translate(0);
  }

  20% {
    transform: translate(-2px, 2px) skew(0deg);
  }

  40% {
    transform: translate(-2px, -2px) skew(0deg);
  }

  60% {
    transform: translate(2px, 2px) skew(0deg);
  }

  80% {
    transform: translate(2px, -2px) skew(0deg);
  }

  100% {
    transform: translate(0) skew(0deg);
  }
}

/* 2. VHS Effect */
.effect-vhs {
  filter: sepia(0.5) hue-rotate(-30deg) saturate(1.8) contrast(1.2) blur(0.5px);
}

.effect-vhs::after {
  content: " ";
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
  background-size: 100% 2px, 3px 100%;
  pointer-events: none;
  z-index: 50;
}

/* 3. CRT Effect */
.effect-crt {
  filter: contrast(1.4) brightness(1.2) saturate(1.2);
  overflow: hidden;
}

.effect-crt::before {
  content: " ";
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.1) 50%);
  background-size: 100% 4px;
  /* Scanlines */
  z-index: 50;
  pointer-events: none;
}

/* 4. Cinema Noir */
.effect-cinema {
  filter: grayscale(100%) contrast(1.2) brightness(0.9);
}

.effect-cinema::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.05'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 40;
}

/* 5. RGB Split */
.effect-rgb {
  text-shadow: 2px 0 rgba(255, 0, 0, 0.5), -2px 0 rgba(0, 255, 255, 0.5);
  filter: drop-shadow(4px 4px 0px rgba(255, 0, 0, 0.3));
}

.album-art-shake {
  will-change: transform;
}

/* --- 3D STAGE VISUALIZER --- */
.stage-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotateZ(-15deg);
  width: 300px;
  height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-style: preserve-3d;
  transition: transform 0.3s ease;
  pointer-events: none;
  /* Let clicks pass through */
  opacity: 0;
  transition: opacity 0.3s ease;
}

.stage-container.visible {
  opacity: 1;
}

.stage-container.stage-straight {
  transform: translate(-50%, -50%) rotateZ(0deg);
}

#dynamicTextLayer {
  position: absolute;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
}

.album-art-wrapper {
  position: absolute;
  width: 220px;
  height: 220px;
  transform-style: preserve-3d;
  transition: transform 0.05s linear;
}

.album-art-3d {
  width: 100%;
  height: 100%;
  background-color: #333;
  background-size: cover;
  background-position: center;
  border-radius: 24px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
}

/* Orbit Mode */
.orbit-spinner {
  position: absolute;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  animation: spin 14s infinite linear;
}

.orbit-text {
  position: absolute;
  top: 50%;
  left: 50%;
  font-size: 1.8rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  white-space: nowrap;
  transform-origin: center center;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 0;
  height: 0;
  backface-visibility: visible;
  /* Ensure text doesn't flip upside down if we don't want it to, 
     but for orbit it should face outward. 
     If it's "helicoptering" (spinning on Z), check transform assignment in JS. */
}

@keyframes spin {
  from {
    transform: rotateY(0deg);
  }

  to {
    transform: rotateY(360deg);
  }
}

/* Wall Mode */
.mode-wall-wrapper {
  position: absolute;
  width: 200%;
  height: 200%;
  top: -50%;
  left: -50%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 15px;
  opacity: 0.6;
  transform: translateZ(-50px);
}

.wall-row {
  display: flex;
  white-space: nowrap;
  font-size: 2.5rem;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
}

.wall-text-item {
  margin-right: 30px;
}

.scroll-left {
  animation: scrollLeft 12s linear infinite;
}

.scroll-right {
  animation: scrollRight 12s linear infinite;
}

@keyframes scrollLeft {
  0% {
    transform: translateX(0);
  }

  100% {
    transform: translateX(-20%);
  }
}

@keyframes scrollRight {
  0% {
    transform: translateX(-20%);
  }

  100% {
    transform: translateX(0);
  }
}

/* --- FILM VISUALIZER STYLES (User Template Aligned) --- */
#filmContainer {
  display: none;
  opacity: 0;
  transition: opacity 0.5s ease;
  background-color: #000;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 10;
}

#filmContainer.visible {
  display: flex;
  opacity: 1;
}

.film-col-wrapper {
  flex: 1;
  height: 100%;
  position: relative;
  overflow: hidden;
  transition: flex 0.2s;
}

.film-col-left {
  filter: grayscale(100%) contrast(1.1);
}

.film-col-right {
  filter: contrast(1.1) saturate(1.1);
}

/* Center Spine - Exact Template Match */
.film-spine {
  width: 24px;
  height: 100%;
  background: #111;
  border-left: 2px solid #333;
  border-right: 2px solid #333;
  /* Template has 2px solid #333 */
  background-image: radial-gradient(#444 40%, transparent 45%);
  background-size: 16px 20px;
  background-position: center;
  background-repeat: repeat-y;
  z-index: 10;
  transition: width 0.1s;
  flex-shrink: 0;
}

.film-scroller {
  width: 100%;
  display: flex;
  flex-direction: column;
}

.film-move-up {
  animation: scrollUp linear infinite;
}

.film-move-down {
  animation: scrollDown linear infinite;
}

@keyframes scrollUp {
  from {
    transform: translateY(0);
  }

  to {
    transform: translateY(-50%);
  }
}

@keyframes scrollDown {
  from {
    transform: translateY(-50%);
  }

  to {
    transform: translateY(0);
  }
}

.film-frame {
  position: relative;
  width: 100%;
  padding: 10px;
  background: #000;
  display: flex;
  justify-content: center;
  align-items: center;
}

.film-photo-wrapper {
  width: 90%;
  aspect-ratio: 4/5;
  position: relative;
  background: #222;
  overflow: hidden;
  border: 1px solid #333;
}

.film-photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Meta Text */
.film-meta-side {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 15px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: #fca311;
  font-size: 9px;
  font-family: 'Courier New', monospace;
  font-weight: bold;
  pointer-events: none;
}

.film-meta-left {
  left: 0;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.film-meta-right {
  right: 0;
  writing-mode: vertical-rl;
}

/* Overlays - Template Exact */
.film-vertical-text {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%) rotate(180deg);
  z-index: 40;
  pointer-events: none;
  writing-mode: vertical-rl;
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-weight: 500;
  font-size: 60px;
  /* User template specified 60px */
  color: rgba(255, 255, 255, 0.8);
  letter-spacing: 5px;
  text-shadow: 2px 2px 10px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
}

.film-center-card {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 240px;
  /* User template: 240px */
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  z-index: 50;
  padding: 10px 10px 15px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-family: 'Inter', sans-serif;
}

.film-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.film-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #eee;
  object-fit: cover;
}

.film-username {
  font-size: 10px;
  font-weight: 600;
  color: #000;
}

.film-card-image-box {
  width: 100%;
  aspect-ratio: 4/5;
  background: #eee;
  border-radius: 6px;
  overflow: hidden;
}

.film-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: object-position 0.1s ease;
}

.film-card-footer {
  font-size: 9px;
  color: #666;
  margin-top: 2px;
}

/* --- Film Center Shape Mods --- */
.film-center-card.shape-mode {
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  overflow: visible;
}

.film-center-card.shape-mode .film-card-header,
.film-center-card.shape-mode .film-card-footer {
  display: none;
}

.film-center-card.shape-mode .film-card-image-box {
  width: 240px;
  /* Force size */
  height: 240px;
  background: transparent;
  border-radius: 0;
  overflow: hidden;
  /* Center img inside box logic */
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Shape Classes Applied to Image Box */
.film-shape-square .film-card-image-box {
  aspect-ratio: 1/1;
  border-radius: 0;
}

.film-shape-circle .film-card-image-box {
  aspect-ratio: 1/1;
  border-radius: 50%;
}

.film-shape-star .film-card-image-box {
  aspect-ratio: 1/1;
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  border-radius: 0;
}

.film-shape-heart .film-card-image-box {
  aspect-ratio: 1/1;
  clip-path: path('M120 213.5l-14.5-13.2C54 153.6 20 122.8 20 85 20 54.2 44.2 30 75 30c17.4 0 34.1 8.1 45 20.9C130.9 38.1 147.6 30 165 30c30.8 0 55 24.2 55 55 0 37.8-34 68.6-85.5 115.4L120 213.5z');
  border-radius: 0;
}

/* --- Receipt Visualizer Styles --- */
/* Font Imports specific to receipt */
@import url('https://fonts.googleapis.com/css2?family=VT323&family=Courier+Prime:wght@400;700&display=swap');

.receipt-container {
  width: 320px;
  height: 80vh;
  position: absolute;
  bottom: -80vh;
  /* Start hidden/low? No, this is container. */
  left: 50%;
  transform: translateX(-50%);
  display: none;
  /* Default hidden */
  flex-direction: column;
  justify-content: flex-end;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.2));
  transition: transform 0.05s linear;
  z-index: 15;
}

.receipt-container.visible {
  display: flex;
  bottom: 0;
  /* Align to bottom for printing up effect */
  top: auto;
  transform: translateX(-50%);
  /* Maintain center */
}

/* Beat Hit Effect moved to paper-body to avoid conflict with container transform */
.paper-body.beat-hit {
  transform: translateY(-15px);
}

.paper-body {
  background: #f8f9fa;
  width: 100%;
  padding: 20px;
  padding-bottom: 60px;
  color: #1d1d1d;
  font-family: 'Courier Prime', monospace;
  transition: transform 0.05s ease;
  /* Zig-Zag Clip Path */
  clip-path: polygon(0% 10px, 5% 0px, 10% 10px, 15% 0px, 20% 10px, 25% 0px, 30% 10px, 35% 0px,
      40% 10px, 45% 0px, 50% 10px, 55% 0px, 60% 10px, 65% 0px, 70% 10px, 75% 0px,
      80% 10px, 85% 0px, 90% 10px, 95% 0px, 100% 10px,
      100% 100%, 0% 100%);
  background-image: repeating-linear-gradient(transparent, transparent 2px, rgba(0, 0, 0, 0.02) 3px);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.receipt-header {
  text-align: center;
  border-bottom: 2px dashed #1d1d1d;
  padding-bottom: 15px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.store-name {
  font-size: 24px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: -1px;
}

.meta-info {
  font-size: 10px;
  display: flex;
  justify-content: space-between;
  text-transform: uppercase;
}

.item-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}

.line-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  font-size: 12px;
  font-weight: bold;
  animation: printLine 0.2s steps(5);
}

@keyframes printLine {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.item-qty {
  width: 30px;
}

.item-desc {
  flex: 1;
  text-transform: uppercase;
  line-height: 1.2;
}

.item-price {
  width: 50px;
  text-align: right;
}

.barcode {
  height: 40px;
  width: 100%;
  margin-top: 20px;
  background: repeating-linear-gradient(to right,
      #1d1d1d 0px, #1d1d1d 2px,
      transparent 2px, transparent 4px,
      #1d1d1d 4px, #1d1d1d 5px,
      transparent 5px, transparent 9px);
}