/*
 * CubeTesseract65 – Frontend Styles
 * @version 1.0.0
 */

/* ── Widget wrapper ─────────────────────────────────────────────────────── */
.ct65-widget-wrap {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 4px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

/* ── Canvas ──────────────────────────────────────────────────────────────── */
.ct65-canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  position: absolute;
  inset: 0;
  cursor: grab;
}
.ct65-canvas:active { cursor: grabbing; }

/* ── Loader ──────────────────────────────────────────────────────────────── */
.ct65-loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: rgba(255,255,255,0.8);
  font-family: monospace;
  font-size: 13px;
  letter-spacing: 2px;
  z-index: 10;
  background: inherit;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.ct65-loader-cube {
  width: 40px;
  height: 40px;
  position: relative;
  transform-style: preserve-3d;
  animation: ct65-spinCube 1.6s linear infinite;
}

.ct65-loader-cube div {
  position: absolute;
  width: 40px;
  height: 40px;
  border: 2px solid rgba(78, 205, 196, 0.7);
  border-radius: 2px;
}
.ct65-loader-cube div:nth-child(1) { transform: rotateX(0deg)   translateZ(20px); }
.ct65-loader-cube div:nth-child(2) { transform: rotateX(90deg)  translateZ(20px); }
.ct65-loader-cube div:nth-child(3) { transform: rotateX(180deg) translateZ(20px); }
.ct65-loader-cube div:nth-child(4) { transform: rotateX(270deg) translateZ(20px); }

@keyframes ct65-spinCube {
  0%   { transform: rotateX(0deg) rotateY(0deg); }
  100% { transform: rotateX(360deg) rotateY(360deg); }
}

/* ── Controls ────────────────────────────────────────────────────────────── */
.ct65-controls {
  position: absolute;
  bottom: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 5;
}

.ct65-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(0,0,0,0.45);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.15s;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.ct65-btn:hover { background: rgba(255,255,255,0.2); transform: scale(1.1); }
.ct65-btn.active { background: rgba(78,205,196,0.4); border-color: #4ecdc4; }

/* ── FPS overlay ─────────────────────────────────────────────────────────── */
.ct65-fps {
  position: absolute;
  top: 8px;
  left: 8px;
  color: #4ecdc4;
  font: 11px/1 monospace;
  background: rgba(0,0,0,0.5);
  padding: 2px 6px;
  border-radius: 3px;
  pointer-events: none;
  z-index: 5;
}

/* ════════════════════════════════════════════════════════
   LIGHTBOX
   ════════════════════════════════════════════════════════ */
.ct65-lightbox {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.ct65-lightbox.open { opacity: 1; }
.ct65-lightbox[hidden] { display: none !important; }

/* Overlay */
.ct65-lb-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* Container */
.ct65-lb-container {
  position: relative;
  max-width: 92vw;
  max-height: 94vh;
  width: 860px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  z-index: 1;
}

/* Image wrap */
.ct65-lb-image-wrap {
  position: relative;
  max-width: 100%;
  max-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 6px;
}

.ct65-lb-img {
  display: block;
  max-width: 100%;
  max-height: 60vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
  will-change: transform, opacity;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Transitions */
.ct65-lb-img.trans-out { opacity: 0; }
.ct65-lb-img.trans-out.trans-slide { transform: translateX(-30px); }
.ct65-lb-img.trans-out.trans-zoom  { transform: scale(0.85); }
.ct65-lb-img.trans-out.trans-flip  { transform: rotateY(90deg); }
.ct65-lb-img.trans-in  { opacity: 1; transform: none; }

/* Navigation */
.ct65-lb-prev,
.ct65-lb-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.12);
  border: none;
  color: #fff;
  font-size: 2.2rem;
  width: 46px;
  height: 60px;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  z-index: 2;
}
.ct65-lb-prev { left: -58px; }
.ct65-lb-next { right: -58px; }
.ct65-lb-prev:hover,
.ct65-lb-next:hover { background: rgba(255,255,255,0.25); }

/* Close */
.ct65-lb-close {
  position: absolute;
  top: -44px;
  right: 0;
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 1.6rem;
  cursor: pointer;
  transition: color 0.2s, transform 0.15s;
}
.ct65-lb-close:hover { color: #fff; transform: scale(1.2); }

/* Info */
.ct65-lb-info { text-align: center; color: #fff; width: 100%; }
.ct65-lb-title { margin: 0 0 4px; font-size: 1rem; font-weight: 600; }
.ct65-lb-desc  { margin: 0; font-size: 0.82rem; color: rgba(255,255,255,0.65); }

/* Counter */
.ct65-lb-counter {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.5);
  font-family: monospace;
}

/* Toolbar */
.ct65-lb-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

.ct65-lb-toolbar a,
.ct65-lb-toolbar button {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s;
}
.ct65-lb-toolbar a:hover,
.ct65-lb-toolbar button:hover { background: rgba(255,255,255,0.22); }

.ct65-share-fb  { color: #1877f2 !important; }
.ct65-share-tw  { color: #1da1f2 !important; }
.ct65-share-wa  { color: #25d366 !important; }
.ct65-share-pin { color: #e60023 !important; }

/* Thumbnail strip */
.ct65-lb-thumbs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  max-width: 100%;
  padding: 4px 0;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}
.ct65-lb-thumb {
  flex: 0 0 52px;
  width: 52px;
  height: 42px;
  object-fit: cover;
  border-radius: 3px;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.2s, transform 0.15s;
  border: 2px solid transparent;
}
.ct65-lb-thumb:hover   { opacity: 0.85; }
.ct65-lb-thumb.active  { opacity: 1; border-color: #4ecdc4; transform: scale(1.08); }

/* ── Mobile adjustments ──────────────────────────────────────────────────── */
@media (max-width: 680px) {
  .ct65-lb-prev { left: 2px; }
  .ct65-lb-next { right: 2px; }
  .ct65-lb-container { max-width: 100vw; max-height: 100dvh; border-radius: 0; padding: 8px; }
  .ct65-lb-image-wrap,
  .ct65-lb-img { max-height: 50vh; }
  .ct65-controls { bottom: 10px; right: 10px; }
  .ct65-btn { width: 32px; height: 32px; font-size: 14px; }
}

/* ── Reduced motion ──────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .ct65-loader-cube    { animation: none; }
  .ct65-lb-img         { transition: none; }
  .ct65-lightbox       { transition: none; }
}
