/* ============================================
   IslamieBook Qibla Finder – Premium Design System
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
  --bg-primary: #0a0612;
  --bg-secondary: #110d1f;
  --bg-card: rgba(17, 13, 31, 0.65);
  --bg-glass: rgba(20, 15, 40, 0.55);
  --bg-glass-hover: rgba(25, 18, 50, 0.7);

  --purple-deep: #1a0f2e;
  --purple-mid: #2d1b69;
  --purple-light: #6b4fa2;
  --purple-lavender: #9b7fd4;
  --purple-soft: rgba(107, 79, 162, 0.15);

  --gold: #d4af37;
  --gold-light: #f5d77a;
  --gold-dark: #b8941f;
  --gold-glow: rgba(212, 175, 55, 0.25);
  --gold-soft: rgba(212, 175, 55, 0.08);

  --text-primary: #f0eef5;
  --text-secondary: #a8a0be;
  --text-muted: #6b6380;
  --text-gold: #d4af37;

  --border-subtle: rgba(212, 175, 55, 0.1);
  --border-glass: rgba(212, 175, 55, 0.12);
  --border-glow: rgba(212, 175, 55, 0.3);

  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.5);
  --shadow-gold: 0 0 30px rgba(212,175,55,0.15);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-pill: 50px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-serif: 'Amiri', Georgia, serif;

  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-med: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.6s cubic-bezier(0.4, 0, 0.2, 1);

  --compass-size: min(340px, 82vw);
  --header-height: 64px;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

img, svg {
  display: block;
  max-width: 100%;
}

/* --- Screen Overlay --- */
.screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
}

/* --- Loading Screen --- */
.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.loading-spinner {
  animation: spin 1.2s linear infinite;
  transform-origin: center;
}

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

.loading-text {
  font-size: 14px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.7;
}

/* --- Permission Screen --- */
.permission-container {
  text-align: center;
  padding: 40px 24px;
  max-width: 380px;
}

.permission-icon-wrap {
  margin-bottom: 28px;
  animation: fadeInUp 0.6s ease-out;
}

.permission-title {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.permission-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 32px;
  line-height: 1.7;
}

.permission-privacy {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
  font-size: 12px;
  color: var(--text-muted);
}

.permission-privacy svg {
  flex-shrink: 0;
}

/* --- Buttons --- */
.btn-primary {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 36px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: #0a0612;
  background: linear-gradient(135deg, var(--gold-light), var(--gold), var(--gold-dark));
  border-radius: var(--radius-pill);
  box-shadow: 0 4px 20px rgba(212, 175, 55, 0.3), inset 0 1px 0 rgba(255,255,255,0.2);
  transition: all var(--transition-med);
  overflow: hidden;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 30px rgba(212, 175, 55, 0.45), inset 0 1px 0 rgba(255,255,255,0.2);
}

.btn-primary:active {
  transform: translateY(0) scale(0.97);
}

.btn-primary:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.btn-shine {
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
  animation: btnShine 3s ease-in-out infinite;
  pointer-events: none;
}

@keyframes btnShine {
  0%, 100% { left: -100%; }
  50% { left: 100%; }
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gold);
  background: var(--gold-soft);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-pill);
  transition: all var(--transition-fast);
}

.btn-secondary:hover {
  background: rgba(212,175,55,0.14);
  border-color: var(--border-glow);
  transform: translateY(-1px);
}

.btn-secondary:active {
  transform: scale(0.97);
}

.btn-secondary:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.btn-secondary svg {
  flex-shrink: 0;
}

.btn-sm {
  padding: 7px 16px;
  font-size: 12px;
}

.btn-cta {
  margin-top: 8px;
}

.btn-icon {
  flex-shrink: 0;
}

/* --- Background Layers --- */
.bg-layers {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.bg-gradient {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% 40%, rgba(45, 27, 105, 0.2) 0%, transparent 70%),
    radial-gradient(ellipse 60% 50% at 20% 80%, rgba(26, 15, 46, 0.4) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 80% 20%, rgba(107, 79, 162, 0.08) 0%, transparent 50%),
    linear-gradient(180deg, #0a0612 0%, #0f0a1a 50%, #0a0612 100%);
}

.bg-stars {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.bg-pattern {
  position: absolute;
  inset: 0;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cpath d='M100 10 L115 45 L155 45 L122 67 L135 102 L100 80 L65 102 L78 67 L45 45 L85 45 Z' fill='none' stroke='%23d4af37' stroke-width='0.5'/%3E%3Ccircle cx='100' cy='100' r='85' fill='none' stroke='%23d4af37' stroke-width='0.3'/%3E%3Ccircle cx='100' cy='100' r='70' fill='none' stroke='%23d4af37' stroke-width='0.2'/%3E%3Cpath d='M100 15 L108 42 L138 42 L114 58 L122 85 L100 68 L78 85 L86 58 L62 42 L92 42 Z' fill='none' stroke='%23d4af37' stroke-width='0.3'/%3E%3C/svg%3E");
  background-size: 200px 200px;
  animation: patternDrift 120s linear infinite;
}

@keyframes patternDrift {
  from { transform: rotate(0deg) scale(1); }
  to { transform: rotate(360deg) scale(1); }
}

.bg-glow {
  position: absolute;
  top: 35%;
  left: 50%;
  width: 500px;
  height: 500px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(212, 175, 55, 0.04) 0%, transparent 70%);
  border-radius: 50%;
  animation: glowPulse 8s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 0.8; transform: translate(-50%, -50%) scale(1.08); }
}

.bg-particles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* --- Header --- */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--header-height);
  background: rgba(10, 6, 18, 0.4);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition-med);
}

.header.scrolled {
  background: rgba(10, 6, 18, 0.85);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--text-primary);
  transition: opacity var(--transition-fast);
}

.header-brand:hover {
  opacity: 0.85;
}

.brand-icon {
  flex-shrink: 0;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-link {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.3px;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
  position: relative;
}

.nav-link:hover,
.nav-link.active {
  color: var(--gold);
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 1.5px;
  background: var(--gold);
  border-radius: 1px;
}

/* Hamburger */
.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  z-index: 110;
}

.menu-toggle span {
  display: block;
  width: 22px;
  height: 1.5px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all var(--transition-fast);
}

.menu-toggle.open span:nth-child(1) {
  transform: rotate(45deg) translate(4px, 5px);
}

.menu-toggle.open span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.open span:nth-child(3) {
  transform: rotate(-45deg) translate(4px, -5px);
}

/* Mobile Menu */
.mobile-menu {
  display: none;
  position: absolute;
  top: var(--header-height);
  left: 0;
  right: 0;
  background: rgba(10, 6, 18, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 12px 0;
}

.mobile-menu.open {
  display: block;
}

.mobile-nav-link {
  display: block;
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.mobile-nav-link:hover,
.mobile-nav-link.active {
  color: var(--gold);
  background: var(--gold-soft);
}

/* --- Hero Section --- */
.hero {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 20px 40px;
  text-align: center;
}

.hero-content {
  max-width: 560px;
  animation: fadeInUp 0.8s ease-out 0.2s both;
}

.hero-label {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 3px;
  color: var(--gold);
  opacity: 0.7;
  margin-bottom: 20px;
}

.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(36px, 7vw, 56px);
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--gold-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: clamp(15px, 3vw, 17px);
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 36px;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}

/* Compass Section */
.compass-section {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(var(--header-height) + 20px) 20px 40px;
}

.compass-column {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.info-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 600px;
}

/* Compass Wrapper */
.compass-wrapper {
  position: relative;
  margin-bottom: 24px;
}

.compass-container {
  position: relative;
  width: var(--compass-size);
  height: var(--compass-size);
  border-radius: 50%;
}

/* Outer Glow */
.compass-outer-glow {
  position: absolute;
  inset: -30px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212, 175, 55, 0.06) 0%, transparent 70%);
  pointer-events: none;
  transition: opacity 0.6s ease;
}

/* Alignment Glow */
.alignment-glow {
  position: absolute;
  inset: -40px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212, 175, 55, 0.15) 0%, transparent 60%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.8s ease;
}

.alignment-glow.active {
  opacity: 1;
  animation: alignGlowPulse 2s ease-in-out infinite;
}

@keyframes alignGlowPulse {
  0%, 100% { opacity: 0.7; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.03); }
}

/* Outer Ring */
.compass-outer-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid var(--border-glass);
  box-shadow:
    0 0 40px rgba(212, 175, 55, 0.05),
    inset 0 0 40px rgba(212, 175, 55, 0.03);
  pointer-events: none;
  transition: border-color 0.6s ease, box-shadow 0.6s ease;
}

.compass-container.aligned .compass-outer-ring {
  border-color: var(--border-glow);
  box-shadow:
    0 0 50px rgba(212, 175, 55, 0.12),
    inset 0 0 50px rgba(212, 175, 55, 0.06);
}

/* Compass Card (rotates) */
.compass-card {
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  will-change: transform;
}

.compass-dial {
  width: 100%;
  height: 100%;
}

/* Qibla Arrow Container - positioned at center, arrow extends upward */
.qibla-arrow-container {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 60px;
  height: 200px;
  margin-left: -30px;
  margin-top: -200px;
  transform-origin: 30px 200px;
  will-change: transform;
  z-index: 5;
  pointer-events: none;
  transition: transform 0.3s ease-out;
}

.qibla-arrow {
  filter: drop-shadow(0 0 8px rgba(212, 175, 55, 0.4));
  transition: filter 0.6s ease;
}

.compass-container.aligned .qibla-arrow {
  filter: drop-shadow(0 0 16px rgba(212, 175, 55, 0.7));
}

/* Kaaba Center */
.kaaba-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  animation: kaabaFloat 4s ease-in-out infinite;
}

.kaaba-img {
  width: calc(var(--compass-size) * 0.18);
  height: calc(var(--compass-size) * 0.18);
  object-fit: contain;
  display: block;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(20, 15, 40, 0.55) 0%, rgba(20, 15, 40, 0) 70%);
  box-shadow: 0 0 24px rgba(212, 175, 55, 0.28), inset 0 0 18px rgba(10, 6, 18, 0.45);
  border: 1.5px solid rgba(212, 175, 55, 0.35);
  padding: 4%;
  -webkit-user-drag: none;
  user-select: none;
}

@keyframes kaabaFloat {
  0%, 100% { transform: translate(-50%, -50%) translateY(-2px); }
  50% { transform: translate(-50%, -50%) translateY(2px); }
}

@keyframes kaabaFloatSmall {
  0%, 100% { transform: translate(-50%, -50%) translateY(-1px); }
  50% { transform: translate(-50%, -50%) translateY(1px); }
}

.compass-container.aligned .kaaba-center .kaaba-img {
  box-shadow: 0 0 32px rgba(212, 175, 55, 0.55), inset 0 0 18px rgba(10, 6, 18, 0.45);
  border-color: rgba(245, 215, 122, 0.7);
}

@media (max-width: 480px) {
  .kaaba-center { animation-name: kaabaFloatSmall; }
  .kaaba-img { width: calc(var(--compass-size) * 0.22); height: calc(var(--compass-size) * 0.22); padding: 5%; }
}

/* North Indicator */
.compass-north-indicator {
  position: absolute;
  top: -2px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  opacity: 0.6;
}

/* --- Qibla Info Bar --- */
.qibla-info-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.qibla-bearing-display,
.heading-display {
  text-align: center;
}

.bearing-value,
.heading-value {
  display: block;
  font-size: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--gold);
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.heading-value {
  color: var(--text-primary);
}

.bearing-label,
.heading-label {
  display: block;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Alignment Status */
.alignment-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition-med);
}

.alignment-status.facing {
  background: rgba(212, 175, 55, 0.1);
  border-color: var(--border-glow);
  color: var(--gold);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background var(--transition-med);
}

.alignment-status.facing .status-dot {
  background: var(--gold);
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.6);
  animation: dotPulse 1.5s ease-in-out infinite;
}

@keyframes dotPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(212, 175, 55, 0.4); }
  50% { box-shadow: 0 0 16px rgba(212, 175, 55, 0.8); }
}

/* --- Turn Instruction --- */
.turn-instruction {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  margin-bottom: 20px;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 500;
  color: var(--gold);
  animation: fadeInUp 0.3s ease-out;
}

.turn-arrow {
  flex-shrink: 0;
}

.turn-instruction.turn-left .turn-arrow {
  transform: rotate(-90deg);
}

.turn-instruction.turn-right .turn-arrow {
  transform: rotate(90deg);
}

/* --- View Toggle --- */
.view-toggle {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 24px;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
}

.toggle-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius-pill);
  transition: all var(--transition-fast);
}

.toggle-btn:hover {
  color: var(--text-secondary);
}

.toggle-btn.active {
  color: var(--gold);
  background: rgba(212, 175, 55, 0.1);
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.08);
}

.toggle-btn svg {
  flex-shrink: 0;
}

/* --- Info Cards --- */
.info-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
  max-width: 600px;
  margin-bottom: 20px;
}

.info-card {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 20px 14px;
  text-align: center;
  transition: all var(--transition-med);
}

.info-card:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-glow);
  transform: translateY(-3px);
  box-shadow: var(--shadow-gold);
}

.card-icon {
  margin-bottom: 12px;
  display: flex;
  justify-content: center;
}

.card-icon svg {
  transition: transform var(--transition-med);
}

.info-card:hover .card-icon svg {
  transform: scale(1.1);
}

.card-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}

.card-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* --- Map Display --- */
.map-display {
  width: 100%;
  max-width: 700px;
  margin-bottom: 20px;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 16px;
  overflow: hidden;
}

.qibla-map {
  width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
}

.map-legend {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.user-dot {
  background: #5b8def;
  box-shadow: 0 0 6px rgba(91, 141, 239, 0.5);
}

.kaaba-dot {
  background: var(--gold);
  box-shadow: 0 0 6px rgba(212, 175, 55, 0.5);
}

/* --- Location Card --- */
.location-card {
  width: 100%;
  max-width: 400px;
  margin-bottom: 20px;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 20px;
}

.location-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.location-header svg {
  flex-shrink: 0;
}

.location-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(212, 175, 55, 0.05);
}

.location-row:last-child {
  border-bottom: none;
}

.location-label {
  font-size: 12px;
  color: var(--text-muted);
}

.location-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

#btn-update-location {
  margin-top: 14px;
  width: 100%;
  justify-content: center;
}

/* --- Calibration Card --- */
.calibration-card {
  width: 100%;
  max-width: 400px;
  margin-bottom: 20px;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  overflow: hidden;
  animation: fadeInUp 0.4s ease-out;
}

.calibration-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 14px;
  font-weight: 600;
}

.calibration-header svg {
  flex-shrink: 0;
}

.calibration-body {
  padding: 20px;
  text-align: center;
}

.calibration-phone {
  margin-bottom: 16px;
  display: flex;
  justify-content: center;
}

.calibration-motion {
  animation: figureEight 2s ease-in-out infinite;
  transform-origin: center;
}

@keyframes figureEight {
  0% { transform: rotate(0deg) translateX(0); }
  25% { transform: rotate(15deg) translateX(5px); }
  50% { transform: rotate(0deg) translateX(0); }
  75% { transform: rotate(-15deg) translateX(-5px); }
  100% { transform: rotate(0deg) translateX(0); }
}

.calibration-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
}

/* --- Accuracy Warning --- */
.accuracy-warning {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  max-width: 400px;
  margin-bottom: 20px;
  padding: 16px 20px;
  background: rgba(230, 168, 23, 0.06);
  border: 1px solid rgba(230, 168, 23, 0.15);
  border-radius: var(--radius-md);
  animation: fadeInUp 0.4s ease-out;
}

.accuracy-warning svg {
  flex-shrink: 0;
  margin-top: 2px;
}

.accuracy-warning strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #e6a817;
  margin-bottom: 4px;
}

.accuracy-warning p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* --- About Section --- */
.about-section {
  position: relative;
  z-index: 1;
  padding: 80px 20px;
}

.about-inner {
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
  position: relative;
}

.about-decoration {
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0.4;
  pointer-events: none;
}

.about-title {
  font-family: var(--font-serif);
  font-size: clamp(26px, 5vw, 34px);
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text-primary);
}

.about-text {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 16px;
}

.about-cta {
  margin-top: 32px;
}

/* --- SEO Content Sections --- */
.seo-section {
  position: relative;
  z-index: 1;
  padding: 56px 20px;
  border-top: 1px solid var(--border-subtle);
}
.seo-inner {
  max-width: 660px;
  margin: 0 auto;
  text-align: left;
}
.seo-h2 {
  font-family: var(--font-serif);
  font-size: clamp(22px, 4.5vw, 28px);
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--text-primary);
  position: relative;
  padding-bottom: 10px;
}
.seo-h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 44px;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--gold), var(--gold-dark));
}
.seo-h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-gold);
  margin: 22px 0 8px;
}
.seo-p {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 14px;
}
.seo-list {
  margin: 0 0 14px;
  padding-left: 22px;
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.9;
}
.seo-list li { margin-bottom: 6px; }
.seo-list strong { color: var(--text-primary); }
.seo-link { color: var(--gold); text-decoration: underline; text-underline-offset: 2px; }
.seo-link:hover { color: var(--gold-light); }

/* --- FAQ --- */
.faq-list {
  margin-top: 8px;
}
.faq-item {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  margin-bottom: 12px;
  overflow: hidden;
}
.faq-item summary {
  cursor: pointer;
  list-style: none;
  padding: 16px 18px;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  user-select: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  font-size: 22px;
  line-height: 1;
  color: var(--gold);
  transition: transform 0.25s ease;
  flex-shrink: 0;
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item .faq-a {
  padding: 0 18px 16px;
  color: var(--text-secondary);
  font-size: 14.5px;
  line-height: 1.8;
}

/* --- Breadcrumbs --- */
.breadcrumb {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 660px;
  margin: 22px auto 0;
  padding: 0 20px;
  text-align: left;
}
.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 6px;
}
.breadcrumb li { display: inline-flex; align-items: center; }
.breadcrumb li + li::before {
  content: "›";
  margin-right: 6px;
  color: var(--text-muted);
}
.breadcrumb a { color: var(--gold); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .crumb-here { color: var(--text-secondary); }

@media (max-width: 480px) {
  .seo-section { padding: 42px 16px; }
  .breadcrumb { padding: 0 16px; }
}


/* --- Footer --- */
.site-footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--border-subtle);
  padding: 40px 20px;
}

.footer-inner {
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--text-primary);
}

.footer-nav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 20px;
}

.footer-nav a {
  font-size: 13px;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.footer-nav a:hover {
  color: var(--gold);
}

.footer-copy {
  font-size: 12px;
  color: var(--text-muted);
  opacity: 0.6;
}

/* --- Animations --- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Page Load Animation */
.hero-content { animation: fadeInUp 0.8s ease-out 0.3s both; }

.compass-section .compass-wrapper {
  animation: scaleIn 0.7s ease-out 0.1s both;
}

.compass-section .qibla-info-bar {
  animation: fadeInUp 0.6s ease-out 0.3s both;
}

.compass-section .info-cards {
  animation: fadeInUp 0.6s ease-out 0.4s both;
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .bg-pattern { animation: none; }
  .bg-glow { animation: none; }
  .btn-shine { animation: none; }
  .kaaba-center { animation: none; }

  .compass-card {
    transition: none;
  }
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Mobile: <= 480px */
@media (max-width: 480px) {
  :root {
    --compass-size: min(300px, 85vw);
    --header-height: 56px;
  }

  .header-nav { display: none; }
  .menu-toggle { display: flex; }

  .hero {
    padding: 70px 16px 30px;
    min-height: auto;
  }

  .hero-title {
    font-size: 32px;
  }

  .hero-subtitle {
    font-size: 14px;
  }

  .compass-section {
    padding: calc(var(--header-height) + 12px) 12px 30px;
  }

  .qibla-info-bar {
    gap: 12px;
  }

  .bearing-value,
  .heading-value {
    font-size: 24px;
  }

  .info-cards {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .info-card {
    padding: 14px 8px;
  }

  .card-value {
    font-size: 16px;
  }

  .card-label {
    font-size: 9px;
    letter-spacing: 0.5px;
  }

  .card-icon svg {
    width: 20px;
    height: 20px;
  }

  .location-card {
    padding: 16px;
  }

  .view-toggle {
    margin-bottom: 16px;
  }

  .toggle-btn {
    padding: 8px 14px;
    font-size: 12px;
  }

  .turn-instruction {
    font-size: 13px;
    padding: 10px 18px;
  }

  .about-section {
    padding: 50px 16px;
  }

  .footer-nav {
    gap: 14px;
  }
}

/* Small mobile: <= 360px */
@media (max-width: 360px) {
  :root {
    --compass-size: min(260px, 88vw);
  }

  .hero-title {
    font-size: 28px;
  }

  .bearing-value,
  .heading-value {
    font-size: 20px;
  }

  .info-cards {
    gap: 6px;
  }

  .info-card {
    padding: 12px 6px;
  }

  .card-value {
    font-size: 14px;
  }
}

/* Tablet: 481px - 768px */
@media (min-width: 481px) and (max-width: 768px) {
  :root {
    --compass-size: min(360px, 75vw);
  }

  .menu-toggle { display: flex; }
  .header-nav { display: none; }
}

/* Desktop: >= 769px */
@media (min-width: 769px) {
  :root {
    --compass-size: 360px;
  }

  .compass-section {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: center;
    gap: 48px;
    padding-top: calc(var(--header-height) + 40px);
    max-width: 1300px;
    margin: 0 auto;
  }

  .compass-column {
    flex-shrink: 0;
    position: sticky;
    top: calc(var(--header-height) + 30px);
  }

  .info-panel {
    flex: 1;
    max-width: 480px;
    align-items: stretch;
  }

  .view-toggle {
    align-self: center;
  }

  .info-cards {
    max-width: none;
    width: 100%;
  }

  .location-card,
  .calibration-card,
  .accuracy-warning {
    max-width: none;
  }
}

/* Large desktop: >= 1200px */
@media (min-width: 1200px) {
  :root {
    --compass-size: 400px;
  }

  .compass-section {
    gap: 60px;
  }
}

/* --- Utility --- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* --- Print --- */
@media print {
  .bg-layers, .header, .bg-pattern, .bg-glow, .bg-particles, #star-canvas {
    display: none !important;
  }

  body {
    background: white;
    color: black;
  }
}

/* ============================================
   PWA Install Banner + iOS Modal + Standalone app
   ============================================ */

/* Install banner (bottom, mobile-first) */
.install-banner {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 1000;
  padding: 0 12px 12px;
  display: none;
}
.install-banner-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(17, 13, 31, 0.95);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.install-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  flex-shrink: 0;
}
.install-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.install-info strong {
  color: var(--text-primary);
  font-size: 1rem;
}
.install-info span {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 2px;
}
.install-btn {
  background: linear-gradient(135deg, var(--gold-light), var(--gold), var(--gold-dark));
  color: #0a0612;
  border: none;
  border-radius: var(--radius-pill);
  padding: 10px 18px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  flex-shrink: 0;
}
.install-btn:active { transform: scale(0.96); }
.install-dismiss {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 6px;
  flex-shrink: 0;
}

/* iOS Add-to-Home-Screen modal */
.ios-install-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(6, 3, 12, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.ios-modal-card {
  width: 100%;
  max-width: 360px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-xl);
  padding: 22px 20px;
  box-shadow: var(--shadow-lg);
}
.ios-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  color: var(--text-primary);
  font-size: 1.1rem;
  margin-bottom: 10px;
}
.ios-modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
}
.ios-modal-text {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 12px;
}
.ios-modal-steps {
  margin: 0 0 18px;
  padding-left: 22px;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.7;
}
.share-ico {
  font-size: 1.1rem;
  color: var(--gold);
}

/* Safe-area handling for standalone (notched phones) */
@media (display-mode: standalone) {
  .header .header-inner {
    padding-top: max(12px, env(safe-area-inset-top));
  }
  .install-banner {
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
  }
}

@media (min-width: 769px) {
  .install-banner {
    left: 50%;
    transform: translateX(-50%);
    width: 420px;
    right: auto;
  }
}
