/* ═══════════════════════════════════════════════════════════
   KOMPAS & ARAH KIBLAT
═══════════════════════════════════════════════════════════ */

/* Location card */
.kiblat-location-card {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: white;
  border-radius: 16px;
  padding: 16px 20px;
  margin: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kiblat-location-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.kiblat-location-info i {
  font-size: 20px;
  opacity: 0.9;
}

.kiblat-location-info span {
  font-size: 15px;
  font-weight: 600;
  display: block;
}

.kiblat-location-info small {
  font-size: 11px;
  opacity: 0.8;
  display: block;
  margin-top: 2px;
}

/* Angle info card */
.kiblat-angle-card {
  display: flex;
  gap: 0;
  margin: 0 16px 14px;
  background: var(--card-bg, #fff);
  border-radius: 16px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.07);
  overflow: hidden;
}

.kiblat-angle-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 8px;
  gap: 6px;
  border-right: 1px solid #f3f4f6;
  text-align: center;
}

.kiblat-angle-item:last-child {
  border-right: none;
}

.kiblat-angle-item i {
  font-size: 18px;
  color: #dc2626;
}

.kiblat-angle-item span {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary, #111827);
  display: block;
}

.kiblat-angle-item small {
  font-size: 10px;
  color: var(--text-secondary, #6b7280);
  line-height: 1.3;
}

/* ── Kompas wrapper ─────────────────────────────────────── */
.compass-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 16px 16px;
}

.compass-container {
  position: relative;
  width: 260px;
  height: 260px;
  margin: 0 auto;
}

/* Ring berputar */
.compass-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid #e5e7eb;
  background: var(--card-bg, #fff);
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.12),
    inset 0 0 40px rgba(0, 0, 0, 0.03);
  transition: transform 0.15s ease-out;
  will-change: transform;
}

/* Label arah mata angin */
.compass-label {
  position: absolute;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary, #111827);
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.compass-label.north {
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  color: #dc2626;
  font-size: 15px;
}
.compass-label.south {
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
}
.compass-label.east {
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
}
.compass-label.west {
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
}

/* Ticks derajat */
.compass-ticks {
  position: absolute;
  inset: 0;
  border-radius: 50%;
}

.compass-tick {
  position: absolute;
  left: 50%;
  top: 0;
  width: 1px;
  transform-origin: bottom center;
  background: #d1d5db;
}

.compass-tick.tick-major {
  height: 16px;
  width: 2px;
  background: #6b7280;
  margin-left: -1px;
}
.compass-tick.tick-medium {
  height: 10px;
  background: #9ca3af;
}
.compass-tick.tick-minor {
  height: 6px;
  background: #e5e7eb;
}

/* Jarum kompas */
.compass-needle-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.compass-needle {
  position: relative;
  width: 8px;
  height: 160px;
  display: flex;
  flex-direction: column;
}

.needle-north {
  flex: 1;
  background: linear-gradient(to bottom, #dc2626, #ef4444);
  border-radius: 4px 4px 0 0;
  clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
}

.needle-south {
  flex: 1;
  background: linear-gradient(to top, #9ca3af, #d1d5db);
  border-radius: 0 0 4px 4px;
  clip-path: polygon(0% 0%, 100% 0%, 50% 100%);
}

/* Panah kiblat */
.compass-kiblat-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

/* 
  Teknik: icon berada di tengah kompas (top: 50%, left: 50%),
  di-offset ke atas dengan translateY(-100px) agar muncul di tepi atas,
  lalu transform rotate bekerja dari pusat kompas (transform-origin: center center
  relatif terhadap elemen wrap yang centered).
  Ini persis seperti cara jarum jam bekerja.
*/
.compass-kiblat-arrow {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 36px;
  height: 36px;
  margin-top: -18px;
  margin-left: -18px;
  background: linear-gradient(135deg, #16a34a, #15803d);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
  /* translateY(-100px) = offset ke tepi kompas, rotate dari pusat */
  transform: translateY(-100px);
  transition: transform 0.2s ease-out;
  will-change: transform;
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.4);
}

/* Center dot */
.compass-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  background: white;
  border: 3px solid #374151;
  border-radius: 50%;
  z-index: 10;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Legend */
.compass-legend {
  display: flex;
  gap: 20px;
  margin-top: 16px;
}

.legend-compass-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary, #6b7280);
}

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

.legend-dot.red {
  background: #dc2626;
}
.legend-dot.green {
  background: #16a34a;
}

/* Status card */
.kiblat-status-card {
  margin: 0 16px 12px;
  background: var(--card-bg, #fff);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
}

.kiblat-status-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-primary, #111827);
}

.kiblat-status-indicator i {
  font-size: 16px;
  flex-shrink: 0;
}

/* Distance card */
.kiblat-distance-card {
  margin: 0 16px 12px;
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  border: 1px solid #bbf7d0;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.dark-mode .kiblat-distance-card {
  background: linear-gradient(135deg, #052e16, #14532d);
  border-color: #166534;
}

.kiblat-distance-card i {
  font-size: 24px;
  color: #16a34a;
}

.kiblat-distance-card strong {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary, #111827);
  display: block;
}

.kiblat-distance-card small {
  font-size: 12px;
  color: var(--text-secondary, #6b7280);
}

/* No sensor message */
.kiblat-no-sensor {
  margin: 0 16px 16px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  color: #92400e;
}

.dark-mode .kiblat-no-sensor {
  background: #431407;
  border-color: #7c2d12;
  color: #fdba74;
}

.kiblat-no-sensor i {
  font-size: 28px;
  margin-bottom: 8px;
  display: block;
  color: #f59e0b;
}

.kiblat-no-sensor p {
  font-size: 13px;
  margin: 4px 0;
  line-height: 1.5;
}

/* Dark mode adjustments */
.dark-mode .compass-ring {
  background: #1f2937;
  border-color: #374151;
}

.dark-mode .compass-label {
  color: #f3f4f6;
}
.dark-mode .compass-label.north {
  color: #f87171;
}
.dark-mode .compass-tick {
  background: #4b5563;
}
.dark-mode .compass-tick.tick-major {
  background: #9ca3af;
}
.dark-mode .compass-tick.tick-medium {
  background: #6b7280;
}
.dark-mode .compass-center {
  background: #1f2937;
  border-color: #d1d5db;
}
