/* Global styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  background-color: #000;
  color: #fff;
  overflow: hidden; /* Prevent body scrolling, only container scrolls */
}

.container {
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 60px 0 0 0; /* Only top padding */
  position: relative;
}

/* Header styles */
header {
  position: fixed;
  top: 20px;
  left: 0;
  width: 100%;
  text-align: center;
  z-index: 10;
  padding: 0 20px;
}

header h1 {
  font-size: 28px;
  font-weight: bold;
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

#fullscreen-btn {
  position: fixed;
  top: 20px;
  right: 20px;
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 20;
  transition: background-color 0.3s;
}

#fullscreen-btn:hover {
  background-color: rgba(0, 0, 0, 0.7);
}

.hidden {
  display: none !important;
}

/* Loading and error styles */
.loading-container, .error-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 100;
  text-align: center;
  background-color: rgba(0, 0, 0, 0.7);
  padding: 20px;
  border-radius: 10px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
  margin: 0 auto 10px;
}

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

.error-container {
  color: #ff6b6b;
}

/* QR Grid styles */
.qr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 4px;
  width: 100%;
  max-width: 100%;
  padding-bottom: 20px;
}

@media screen and (min-width: 1600px) {
  .qr-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
}

@media screen and (max-width: 768px) {
  .qr-grid {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  }
}

/* QR Grid Container */
#qr-grid-container {
  width: 100%;
  height: calc(100vh - 160px);
  overflow-y: scroll !important; /* Force scrolling */
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
  padding: 10px 0;
  position: relative;
}

/* Fullscreen mode adjustments */
.fullscreen-mode #qr-grid-container {
  height: calc(100vh - 100px);
  overflow-y: scroll !important;
}

/* Cube styles */
.cube-wrapper {
  width: 100%;
  aspect-ratio: 1;
  perspective: 1000px;
  position: relative;
}

.cube {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s;
  --tile-color: #d4af37; /* Default gold color, can be overridden */
}

.cube-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f5f5f5;
  border: 1px solid #d0d0d0;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.cube-face-front {
  transform: rotateY(0deg);
  background-color: #f5f5f5;
}

.cube-face-back {
  transform: rotateY(180deg);
  background-color: #e0e0e0;
}

.qr-code {
  position: relative;
  transform: scale(0.9);
}

.scanned-label {
  position: absolute;
  bottom: -20px;
  left: 0;
  width: 100%;
  text-align: center;
  color: #4ade80;
  font-size: 12px;
  font-weight: bold;
  text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

/* Flip animations */
@keyframes flip {
  0%, 15% {
    transform: rotateY(0deg);
  }
  20%, 35% {
    transform: rotateY(180deg);
  }
  40%, 55% {
    transform: rotateY(0deg);
  }
  100% {
    transform: rotateY(0deg);
  }
}

@keyframes flipDelayed {
  0%, 35% {
    transform: rotateY(0deg);
  }
  40%, 55% {
    transform: rotateY(180deg);
  }
  60%, 75% {
    transform: rotateY(0deg);
  }
  100% {
    transform: rotateY(0deg);
  }
}

@keyframes flipMoreDelayed {
  0%, 55% {
    transform: rotateY(0deg);
  }
  60%, 75% {
    transform: rotateY(180deg);
  }
  80%, 95% {
    transform: rotateY(0deg);
  }
  100% {
    transform: rotateY(0deg);
  }
}

.animate-flip {
  animation: flip 8s infinite;
}

.animate-flip-delayed {
  animation: flipDelayed 8s infinite;
}

.animate-flip-more-delayed {
  animation: flipMoreDelayed 8s infinite;
}

.scanned-cube {
  opacity: 1;
  box-shadow: 0 0 15px rgba(74, 222, 128, 0.5);
}

/* Gold tile styles */
.gold-tile .cube-face-back {
  background-color: #d4af37;
}

.gold-tile .cube-face-front {
  background-color: #f5f5f5;
}

/* Custom color tile styles */
.cube .cube-face-back {
  background-color: var(--tile-color);
}

.cube .cube-face-front {
  background-color: #f5f5f5;
}

/* Custom color class to override gold-tile */
.custom-color.gold-tile .cube-face-back {
  background-color: var(--tile-color) !important;
}

/* Scanned QR code with custom color */
.custom-color.scanned-cube .cube {
  transform: rotateY(180deg);
}

/* Footer styles */
footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  text-align: center;
  font-family: monospace;
  z-index: 10;
  background-color: rgba(0, 0, 0, 0.7);
  padding: 10px 0;
}

.footer-content {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* Fullscreen mode */
.fullscreen-mode {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1000;
  background-color: #000;
  overflow-y: auto !important;
  overflow-x: hidden;
  padding-bottom: 100px;
}

/* Responsive QR code sizing */
@media screen and (min-width: 1920px) {
  .qr-code {
    transform: scale(1);
  }
}

@media screen and (max-width: 1366px) {
  .qr-code {
    transform: scale(0.85);
  }
}

@media screen and (max-width: 768px) {
  .qr-code {
    transform: scale(0.75);
  }
} 