@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;600;700;800&family=Outfit:wght@400;600;700&display=swap');

:root {
  --primary: #00f2fe;
  --success: #00e676;
  --danger: #ff1744;
  --bg-hud: rgba(10, 15, 28, 0.75);
  --glass-blur: blur(12px);
  --border-hud: rgba(255, 255, 255, 0.15);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

html, body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: #000;
  font-family: 'Vazirmatn', 'Outfit', sans-serif;
  color: #fff;
  direction: rtl;
  text-align: right;
  position: fixed;
}

/* MindAR Video Container */
#ar-container {
  width: 100vw;
  height: 100vh;
  position: relative;
  overflow: hidden;
  direction: ltr !important;
  text-align: left !important;
}

#ar-container video {
  position: absolute;
  direction: ltr !important;
  max-width: none !important;
  max-height: none !important;
  z-index: 1 !important;
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
}

#ar-container canvas {
  position: absolute;
  left: 0 !important;
  top: 0 !important;
  width: 100% !important;
  height: 100% !important;
  direction: ltr !important;
  z-index: 2 !important;
  pointer-events: auto !important;
  cursor: pointer;
  background: transparent !important;
}

/* HUD Overlay */
.hud-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px 20px;
}

/* Top Bar */
.hud-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: auto;
}

.exp-badge {
  background: var(--bg-hud);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-hud);
  border-radius: 9999px;
  padding: 8px 18px;
  font-size: 0.9rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ffab00;
  box-shadow: 0 0 10px #ffab00;
  transition: all 0.3s ease;
}

.status-dot.active {
  background: var(--success);
  box-shadow: 0 0 12px var(--success);
}

.hud-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-hud);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-hud);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

/* Center Reticle / Scanning Frame */
.reticle-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 75vw;
  max-width: 320px;
  aspect-ratio: 1 / 1;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.reticle-container.locked {
  transform: translate(-50%, -50%) scale(0.92);
  opacity: 0.25;
}

.reticle-corners {
  position: absolute;
  inset: 0;
  border: 2px solid transparent;
}

/* Corner Brackets */
.corner {
  position: absolute;
  width: 28px;
  height: 28px;
  border-color: var(--primary);
  border-style: solid;
  transition: all 0.3s ease;
}

.top-left { top: 0; left: 0; border-width: 3px 0 0 3px; border-top-left-radius: 10px; }
.top-right { top: 0; right: 0; border-width: 3px 3px 0 0; border-top-right-radius: 10px; }
.bottom-left { bottom: 0; left: 0; border-width: 0 0 3px 3px; border-bottom-left-radius: 10px; }
.bottom-right { bottom: 0; right: 0; border-width: 0 3px 3px 0; border-bottom-right-radius: 10px; }

.reticle-container.locked .corner {
  border-color: var(--success);
}

/* Laser Scan Line Animation */
.scan-line {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--primary) 50%, transparent 100%);
  box-shadow: 0 0 12px var(--primary);
  animation: scanLaser 2.2s infinite ease-in-out;
}

.reticle-container.locked .scan-line {
  display: none;
}

@keyframes scanLaser {
  0% { top: 0%; opacity: 0; }
  15% { opacity: 1; }
  85% { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

/* Status Banner */
.hud-status-banner {
  margin-top: 12px;
  text-align: center;
}

.status-pill {
  display: inline-block;
  background: var(--bg-hud);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-hud);
  padding: 8px 20px;
  border-radius: 9999px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #f1f5f9;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  transition: all 0.3s ease;
}

.status-pill.locked {
  border-color: var(--success);
  color: var(--success);
  background: rgba(0, 230, 118, 0.15);
}

/* User Gesture Touch Banner (Autoplay policy) */
.gesture-unlock-modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 20, 0.9);
  backdrop-filter: blur(16px);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
  text-align: center;
  cursor: pointer;
  pointer-events: auto !important;
}

.gesture-unlock-modal.hidden {
  display: none;
}

.gesture-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(0, 242, 254, 0.15);
  border: 2px solid var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  color: var(--primary);
  margin-bottom: 24px;
  box-shadow: 0 0 30px rgba(0, 242, 254, 0.35);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.96); box-shadow: 0 0 15px rgba(0, 242, 254, 0.3); }
  50% { transform: scale(1.05); box-shadow: 0 0 35px rgba(0, 242, 254, 0.6); }
  100% { transform: scale(0.96); box-shadow: 0 0 15px rgba(0, 242, 254, 0.3); }
}

.gesture-title {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 10px;
  background: linear-gradient(135deg, #fff 0%, #00f2fe 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.gesture-desc {
  font-size: 0.9rem;
  color: #94a3b8;
  max-width: 320px;
  line-height: 1.6;
  margin-bottom: 28px;
}

.tap-prompt {
  background: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
  color: #050d1a;
  font-weight: 700;
  font-size: 1rem;
  padding: 14px 32px;
  border-radius: 9999px;
  box-shadow: 0 4px 20px rgba(0, 242, 254, 0.4);
  cursor: pointer;
  pointer-events: auto !important;
}

/* Fallback / Permission Denied Screen */
.error-screen {
  position: fixed;
  inset: 0;
  background: #0b0f19;
  z-index: 200;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
  text-align: center;
  pointer-events: auto !important;
}

.error-screen.visible {
  display: flex;
}

.error-icon {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: rgba(255, 23, 68, 0.15);
  border: 1px solid var(--danger);
  color: var(--danger);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin-bottom: 20px;
}

/* Company Action Banner */
.company-action-banner {
  position: absolute;
  bottom: 80px;
  left: 20px;
  right: 20px;
  max-width: 480px;
  margin: 0 auto;
  background: rgba(13, 22, 41, 0.9);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(0, 242, 254, 0.4);
  border-radius: 16px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(0, 242, 254, 0.25);
  pointer-events: auto;
  z-index: 30;
  animation: slideUpBanner 0.3s ease;
}

@keyframes slideUpBanner {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.company-banner-content {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
  flex: 1;
}

.company-banner-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(0, 242, 254, 0.15);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.company-banner-text {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.company-banner-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.company-banner-url {
  font-size: 0.74rem;
  color: var(--primary);
  direction: ltr;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-company-open {
  background: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
  color: #050d1a !important;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 8px 14px;
  border-radius: 8px;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 0 12px rgba(0, 242, 254, 0.4);
  transition: all 0.2s ease;
}

.btn-company-open:active {
  transform: scale(0.95);
}

.btn-company-close {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

/* In-Scanner Video File Modal */
.video-file-modal {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 18, 0.88);
  backdrop-filter: blur(16px);
  z-index: 150;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  pointer-events: auto !important;
}

.video-file-modal.open {
  display: flex;
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.video-modal-card {
  background: #0f172a;
  border: 1px solid rgba(0, 242, 254, 0.35);
  border-radius: 18px;
  width: 100%;
  max-width: 640px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(0, 242, 254, 0.2);
}

.video-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: rgba(15, 23, 42, 0.9);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.video-modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.video-modal-close {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.video-modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.video-modal-content {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  background: #000;
}

.video-modal-content video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

