/* ========================================
   QIBLA FINDER PAGE - COMPASS & DIRECTION
   ======================================== */

/* Root variables (inherited from index.css) */
:root {
  --bg-primary: linear-gradient(145deg, #f0fdf4 0%, #dcfce7 100%);
  --bg-surface: rgba(255, 255, 255, 0.92);
  --bg-card: rgba(255, 255, 255, 0.85);
  --text-primary: #064e3b;
  --text-secondary: #047857;
  --text-tertiary: #6b7280;
  --accent: #10b981;
  --accent-dark: #059669;
  --accent-glow: rgba(16, 185, 129, 0.5);
  --border-light: rgba(255, 255, 255, 0.3);
  --shadow-lg: 0 20px 35px -12px rgba(0, 0, 0, 0.1);
  --compass-bg: linear-gradient(135deg, #ffffff, #f8fafc);
  --needle-color: #ef4444;
  --shadow-inset: inset 0 0 20px rgba(255, 255, 255, 0.1);
}

body.dark {
  --bg-primary: linear-gradient(145deg, #0a0f1c 0%, #0f172a 100%);
  --bg-surface: rgba(17, 24, 39, 0.92);
  --bg-card: rgba(17, 24, 39, 0.85);
  --text-primary: #ecfdf5;
  --text-secondary: #a7f3d0;
  --text-tertiary: #94a3b8;
  --accent: #34d399;
  --accent-dark: #10b981;
  --accent-glow: rgba(52, 211, 153, 0.4);
  --border-light: rgba(255, 255, 255, 0.08);
  --shadow-lg: 0 20px 35px -12px rgba(0, 0, 0, 0.4);
  --compass-bg: linear-gradient(135deg, #1e293b, #111827);
  --shadow-inset: inset 0 0 20px rgba(255, 255, 255, 0.05);
}

body {
  font-family: 'Inter', 'Cairo', sans-serif;
  background: var(--bg-primary);
  min-height: 100vh;
}

/* ========================================
   QIBLA CONTAINER
   ======================================== */
.qibla-container {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px;
}

/* ========================================
   LIVE INDICATOR
   ======================================== */
.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  padding: 6px 12px;
  border-radius: 40px;
  font-size: 0.65rem;
  font-weight: 600;
  color: white;
  margin-bottom: 16px;
}
.live-dot {
  width: 8px;
  height: 8px;
  background: #ef4444;
  border-radius: 50%;
  animation: livePulse 1s infinite;
}
.live-badge {
  background: #10b981;
  padding: 2px 6px;
  border-radius: 20px;
  font-size: 0.6rem;
}
@keyframes livePulse {
  0%,100%{opacity:1;transform:scale(1);}
  50%{opacity:0.5;transform:scale(1.2);}
}

/* ========================================
   COMPASS CARD
   ======================================== */
.compass-card {
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  border-radius: 48px;
  padding: 24px 20px 28px;
  box-shadow: var(--shadow-lg);
  border: 0.5px solid var(--border-light);
}

/* ========================================
   COMPASS CONTAINER
   ======================================== */
.compass-container {
  position: relative;
  width: 280px;
  height: 280px;
  margin: 0 auto 24px;
  border-radius: 50%;
  background: var(--compass-bg);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2), var(--shadow-inset);
}
.compass-outer-ring {
  position: absolute;
  top: -5px;
  left: -5px;
  right: -5px;
  bottom: -5px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0.3;
}
.compass-inner-ring {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  bottom: 10px;
  border-radius: 50%;
  border: 1px solid var(--border-light);
}
.compass-rose { position: absolute; width: 100%; height: 100%; }
.direction-label {
  position: absolute;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
}
.N { top: 12px; left: 50%; transform: translateX(-50%); }
.NE { top: 20%; right: 20%; }
.E { right: 12px; top: 50%; transform: translateY(-50%); }
.SE { bottom: 20%; right: 20%; }
.S { bottom: 12px; left: 50%; transform: translateX(-50%); }
.SW { bottom: 20%; left: 20%; }
.W { left: 12px; top: 50%; transform: translateY(-50%); }
.NW { top: 20%; left: 20%; }

/* ========================================
   NEEDLE & POINTER
   ======================================== */
.needle-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.05s linear;
  z-index: 2;
}
.needle {
  position: relative;
  width: 4px;
  height: 110px;
  background: var(--needle-color);
  border-radius: 4px;
  box-shadow: 0 0 4px rgba(239, 68, 68, 0.5);
}
.needle::before {
  content: '';
  position: absolute;
  top: -14px;
  left: -7px;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-bottom: 18px solid var(--needle-color);
}
.needle::after {
  content: '';
  position: absolute;
  bottom: -14px;
  left: -7px;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-top: 18px solid #9ca3af;
}
.needle-center {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  background: var(--accent);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  box-shadow: 0 0 10px var(--accent-glow);
}
.qibla-pointer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transition: transform 0.05s linear;
  z-index: 3;
}
.pointer-icon {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 2rem;
  color: var(--accent);
  filter: drop-shadow(0 0 12px var(--accent-glow));
  z-index: 4;
}
.pointer-line {
  position: absolute;
  top: 30px;
  left: 50%;
  width: 2px;
  height: 100px;
  background: var(--accent);
  transform: translateX(-50%);
  opacity: 0.6;
}
.pointer-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 50px;
  height: 50px;
  background: var(--accent-glow);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: pulseGlow 1.5s infinite;
  opacity: 0.6;
}
@keyframes pulseGlow {
  0%,100%{transform:translate(-50%,-50%) scale(1);opacity:0.3;}
  50%{transform:translate(-50%,-50%) scale(1.4);opacity:0.7;}
}
.compass-center {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 24px;
  height: 24px;
  transform: translate(-50%, -50%);
  z-index: 6;
}
.center-dot {
  width: 100%;
  height: 100%;
  background: var(--text-primary);
  border-radius: 50%;
  box-shadow: 0 0 15px var(--accent-glow);
  border: 2px solid var(--accent);
}

/* ========================================
   QIBLA STATUS
   ======================================== */
.qibla-status { text-align: center; margin-bottom: 20px; }
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  padding: 8px 20px;
  border-radius: 60px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  border: 0.5px solid var(--border-light);
}
.status-badge.on-target {
  background: var(--accent);
  color: white;
  animation: successPulse 0.5s ease;
}
@keyframes successPulse {
  0%,100%{transform:scale(1);}
  50%{transform:scale(1.05);}
}

/* ========================================
   INFO PANEL
   ======================================== */
.info-panel {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.info-item {
  background: var(--bg-card);
  padding: 12px;
  border-radius: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0.5px solid var(--border-light);
}
.info-item i {
  font-size: 1.2rem;
  color: var(--accent);
  width: 32px;
  text-align: center;
}
.info-text { display: flex; flex-direction: column; }
.info-label {
  font-size: 0.65rem;
  color: var(--text-tertiary);
}
.info-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ========================================
   REALTIME STATUS
   ======================================== */
.realtime-status {
  background: var(--bg-card);
  border-radius: 24px;
  padding: 12px 16px;
  margin-bottom: 12px;
  border: 0.5px solid var(--border-light);
}
.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 0.75rem;
}
.status-led {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #6b7280;
}
.status-led.active {
  background: #10b981;
  box-shadow: 0 0 5px #10b981;
  animation: ledPulse 1s infinite;
}
@keyframes ledPulse {
  0%,100%{opacity:1;}
  50%{opacity:0.5;}
}

/* ========================================
   CALIBRATION HINT
   ======================================== */
.calibration-hint {
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-tertiary);
  padding: 12px;
  background: var(--bg-card);
  border-radius: 30px;
  margin-top: 8px;
}
.calibration-hint i {
  margin-right: 6px;
  color: var(--accent);
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 480px) {
  .compass-container { width: 240px; height: 240px; }
  .needle { height: 90px; }
  .pointer-line { height: 80px; }
  .pointer-icon { font-size: 1.5rem; top: -8px; }
}