/* ==========================================================================
   Sacred Dhikr Display — Ambient Screensaver & Celestial Cloud Mode
   Featuring Hind Siliguri Bengali Font, English UI, & Drifting Azkar Cloud
   ========================================================================== */

/* Opt-in to Cross-Document View Transitions */
@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }
}

/* --- 1. Ambient Progress Bar --- */
.dhikr-progress-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.05);
  z-index: 100;
  pointer-events: none;
}

.dhikr-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #f59e0b, #fbbf24, #fef08a);
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.7);
  transition: width 0.1s linear;
}

/* --- 2. Ambient Viewport & Idle Hide in Fullscreen --- */
.ambient-dhikr-page {
  cursor: default;
}

/* When idle in fullscreen, hide UI controls smoothly */
body.fullscreen-idle .dhikr-top-bar,
body.fullscreen-idle .dhikr-dock,
body.fullscreen-idle .dhikr-footer {
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
}

.dhikr-top-bar,
.dhikr-dock,
.dhikr-footer {
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* --- 3. Top Header & Desk Widgets --- */
.dhikr-top-bar {
  width: 100%;
  max-width: 1300px;
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  justify-content: space-between !important;
  align-items: center !important;
  gap: 0.75rem;
}

.home-link-btn {
  text-decoration: none;
  flex-shrink: 0;
  white-space: nowrap;
}

.desk-clock-badge {
  font-size: 0.82rem;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

/* Header Right Actions (Always strictly horizontal & non-wrapping) */
.top-nav-actions {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 0.55rem;
  flex-shrink: 0 !important;
  white-space: nowrap !important;
}

/* Dhikr 3-Way Mode Pill */
.dhikr-mode-pill {
  display: inline-flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 0.45rem;
  padding: 0.45rem 1rem;
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid var(--card-border-glow);
  border-radius: 9999px;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-gold);
  cursor: pointer;
  transition: background 0.25s ease, transform 0.2s ease, box-shadow 0.25s ease;
  user-select: none;
  flex-shrink: 0 !important;
  white-space: nowrap !important;
}

.dhikr-mode-pill:hover {
  background: rgba(251, 191, 36, 0.22);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.25);
  color: #ffffff;
}

.mode-icon {
  font-size: 0.85rem;
}

/* Quick Desk Tasbih Counter */
.tasbih-badge {
  display: inline-flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 0.55rem;
  padding: 0.45rem 1.05rem;
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--card-border);
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-main);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  user-select: none;
  flex-shrink: 0 !important;
  white-space: nowrap !important;
}

.tasbih-badge:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--card-border-glow);
  transform: scale(1.03);
}

.tasbih-badge:active {
  transform: scale(0.96);
}

.tasbih-icon {
  font-size: 1rem;
  line-height: 1;
}

.tasbih-label {
  color: var(--text-muted);
  font-size: 0.76rem;
}

.tasbih-count {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--text-gold);
  min-width: 24px;
  text-align: center;
  font-size: 0.95rem;
}

.tasbih-reset {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.95rem;
  cursor: pointer;
  padding: 0 0.2rem;
  margin-left: 0.2rem;
  line-height: 1;
  transition: color 0.2s ease, transform 0.3s ease;
}

.tasbih-reset:hover {
  color: #ef4444;
  transform: rotate(180deg);
}

/* --- 4. Centerpiece Showcase & Card Layout --- */
.dhikr-showcase-center {
  position: relative;
  flex: 1;
  width: 100%;
  max-width: 1140px;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1200px;
  padding: 1rem 0;
}

.dhikr-card-wrapper {
  position: relative;
  width: 100%;
  transform-style: preserve-3d;
  transition: transform 0.2s ease-out;
}

.dhikr-glass-card {
  position: relative;
  width: 100%;
  padding: clamp(2.4rem, 5.5dvh, 4.4rem) clamp(1.6rem, 5dvw, 4.2rem);
  background: var(--card-bg);
  backdrop-filter: blur(32px) saturate(190%);
  -webkit-backdrop-filter: blur(32px) saturate(190%);
  border: 1px solid var(--card-border);
  border-radius: clamp(2rem, 4vw, 3rem);
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  transition: border-color 0.8s ease, box-shadow 0.8s ease;
  animation: dhikrFadeIn 0.75s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes dhikrFadeIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Meta Header */
.dhikr-meta-header {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: clamp(0.72rem, 1.1vw, 0.82rem);
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: clamp(1rem, 2dvh, 1.8rem);
}

.dhikr-number {
  color: var(--text-gold);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.meta-separator {
  opacity: 0.4;
  font-size: 0.7rem;
}

/* Large Sacred Arabic Calligraphy */
.dhikr-arabic-wrapper {
  margin-bottom: clamp(1rem, 2.2dvh, 1.8rem);
  width: 100%;
}

.dhikr-arabic-text {
  font-family: var(--font-arabic);
  font-size: clamp(2.2rem, 4.8vw + 0.6rem, 4.4rem);
  font-weight: 700;
  line-height: 1.45;
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 40px var(--gold-glow);
  word-break: break-word;
  transition: filter 0.4s ease;
}

.dhikr-arabic-text:hover {
  filter: brightness(1.25) drop-shadow(0 0 20px var(--gold-glow));
}

/* English Transliteration */
.dhikr-transliteration {
  font-family: var(--font-body);
  font-size: clamp(1.1rem, 1.8vw, 1.55rem);
  font-style: italic;
  letter-spacing: 0.08em;
  color: var(--text-gold);
  margin-bottom: clamp(0.8rem, 1.8dvh, 1.4rem);
  opacity: 0.95;
  max-width: 900px;
  line-height: 1.45;
}

/* Ornament Divider */
.dhikr-ornament-divider {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  width: clamp(160px, 35vw, 280px);
  margin-bottom: clamp(0.8rem, 1.8dvh, 1.4rem);
  opacity: 0.65;
}

/* English Translation */
.dhikr-english-translation {
  font-family: var(--font-serif);
  font-size: clamp(1.05rem, 1.7vw, 1.4rem);
  font-weight: 400;
  line-height: 1.55;
  color: var(--text-main);
  max-width: 860px;
  margin-bottom: 0.6rem;
}

/* Bengali Translation: Beautiful Hind Siliguri Font */
.dhikr-bengali-translation {
  font-family: 'Hind Siliguri', 'Segoe UI', system-ui, sans-serif;
  font-size: clamp(1.1rem, 1.6vw, 1.35rem);
  font-weight: 500;
  line-height: 1.65;
  color: var(--text-muted);
  max-width: 860px;
  margin-bottom: clamp(1rem, 2.2dvh, 1.8rem);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  letter-spacing: 0.01em;
}

/* Hadith Reference & Fadilah Pill */
.dhikr-fadilah-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 1.4rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border-glow);
  border-radius: 9999px;
  font-size: clamp(0.75rem, 1.1vw, 0.85rem);
  font-weight: 500;
  color: var(--text-main);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  max-width: 95%;
  line-height: 1.4;
}

.fadilah-sparkle {
  color: var(--text-gold);
  font-size: 0.75rem;
  flex-shrink: 0;
}

/* ==========================================================================
   --- 5. Mode 3: Royal Floating Azkar Medallions (নূরানি ক্রিস্টাল মেডেলিয়ন ফলক) ---
   ========================================================================== */
.dhikr-cloud-stage {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  pointer-events: none;
  z-index: 15;
}

/* Individual Floating Sacred Medallion / Jewel Glass Tablet */
.cloud-dhikr-item {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: clamp(0.75rem, 1.4vh, 1rem) clamp(1.1rem, 1.8vw, 1.6rem);
  min-width: clamp(180px, 14vw, 240px);
  max-width: clamp(230px, 19vw, 300px);
  
  /* Precision Royal Crystal Glass Bevel */
  border-radius: 1.3rem;
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.10) 0%, 
    rgba(5, 30, 22, 0.76) 45%, 
    rgba(2, 18, 12, 0.90) 100%
  );
  backdrop-filter: blur(28px) saturate(200%);
  -webkit-backdrop-filter: blur(28px) saturate(200%);
  
  /* Gilded Gold Filigree Edges */
  border: 1px solid rgba(251, 191, 36, 0.32);
  border-top: 1.6px solid rgba(251, 191, 36, 0.75);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  
  /* Luminous Volumetric Depth & Starlight Halo */
  box-shadow: 
    0 16px 45px rgba(0, 0, 0, 0.7),
    inset 0 1.5px 2px rgba(255, 255, 255, 0.4),
    inset 0 0 20px rgba(251, 191, 36, 0.06),
    0 0 25px rgba(251, 191, 36, 0.14);
    
  pointer-events: auto;
  cursor: pointer;
  user-select: none;
  will-change: transform;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275),
              background 0.35s ease,
              border-color 0.35s ease,
              box-shadow 0.35s ease;
}

/* Corner Star Accents (۞ Rub el Hizb) */
.cloud-dhikr-item .star-accent {
  position: absolute;
  font-size: 0.65rem;
  color: var(--text-gold);
  opacity: 0.6;
  line-height: 1;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.cloud-dhikr-item .star-accent.tl {
  top: 7px;
  left: 9px;
}

.cloud-dhikr-item .star-accent.tr {
  top: 7px;
  right: 9px;
}

/* Hover Elevation & Radiant Golden Glow */
.cloud-dhikr-item:hover,
.cloud-dhikr-item:focus-visible {
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.18) 0%, 
    rgba(16, 185, 129, 0.28) 45%, 
    rgba(4, 28, 20, 0.94) 100%
  );
  border-color: rgba(251, 191, 36, 0.85);
  border-top-color: #fde68a;
  box-shadow: 
    0 24px 60px rgba(0, 0, 0, 0.85),
    inset 0 2px 4px rgba(255, 255, 255, 0.65),
    0 0 45px rgba(251, 191, 36, 0.45),
    0 0 22px rgba(16, 185, 129, 0.3);
  transform: scale(1.10) !important;
  z-index: 50 !important;
}

.cloud-dhikr-item:hover .star-accent {
  opacity: 1;
  transform: rotate(45deg) scale(1.15);
}

/* Sacred Arabic Calligraphy */
.floating-arabic {
  font-family: var(--font-arabic);
  font-size: clamp(1.25rem, 1.75vw, 1.75rem);
  font-weight: 700;
  line-height: 1.3;
  background: linear-gradient(180deg, #ffffff 0%, #fef3c7 40%, #fbbf24 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  white-space: nowrap;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.55));
  margin-bottom: 0.18rem;
}

/* English Transliteration */
.floating-translit {
  font-family: var(--font-body);
  font-size: clamp(0.7rem, 0.82vw, 0.8rem);
  font-weight: 600;
  font-style: italic;
  color: #fef3c7;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
  white-space: nowrap;
  margin-bottom: 0.22rem;
}

/* Delicate Golden Star Divider */
.floating-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 55%;
  max-width: 100px;
  margin-bottom: 0.22rem;
  opacity: 0.6;
}

.floating-divider .f-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(251, 191, 36, 0.6), transparent);
}

.floating-divider .f-sparkle {
  color: var(--text-gold);
  font-size: 0.6rem;
  line-height: 1;
}

/* Bengali Meaning in Hind Siliguri Font */
.floating-bengali {
  font-family: 'Hind Siliguri', 'Segoe UI', sans-serif;
  font-size: clamp(0.68rem, 0.78vw, 0.78rem);
  font-weight: 500;
  color: #e2e8f0;
  opacity: 0.92;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.75);
  white-space: nowrap;
  letter-spacing: 0.01em;
}

/* Theme Adaptations for Floating Medallions */
body[data-theme="lapis"] .cloud-dhikr-item {
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.10) 0%, 
    rgba(10, 25, 52, 0.76) 45%, 
    rgba(3, 11, 26, 0.90) 100%
  );
  border-color: rgba(96, 165, 250, 0.35);
  border-top-color: rgba(147, 197, 253, 0.75);
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.7), inset 0 1.5px 2px rgba(255, 255, 255, 0.4), 0 0 25px rgba(96, 165, 250, 0.15);
}

body[data-theme="kiswa"] .cloud-dhikr-item {
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.10) 0%, 
    rgba(18, 18, 18, 0.80) 45%, 
    rgba(8, 8, 8, 0.94) 100%
  );
  border-color: rgba(251, 191, 36, 0.35);
  border-top-color: rgba(251, 191, 36, 0.8);
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.85), inset 0 1.5px 2px rgba(255, 255, 255, 0.4), 0 0 25px rgba(251, 191, 36, 0.16);
}

body[data-theme="amber"] .cloud-dhikr-item {
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.10) 0%, 
    rgba(38, 20, 8, 0.76) 45%, 
    rgba(18, 9, 3, 0.90) 100%
  );
  border-color: rgba(245, 158, 11, 0.35);
  border-top-color: rgba(251, 191, 36, 0.8);
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.7), inset 0 1.5px 2px rgba(255, 255, 255, 0.4), 0 0 25px rgba(245, 158, 11, 0.16);
}

/* Floating Dhikr Inspection Modal / Preview */
.cloud-inspection-card {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.92);
  width: 90%;
  max-width: 580px;
  padding: 2.4rem 2rem 2rem;
  background: var(--card-bg);
  backdrop-filter: blur(35px) saturate(190%);
  -webkit-backdrop-filter: blur(35px) saturate(190%);
  border: 1px solid var(--card-border-glow);
  border-radius: 2.2rem;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.9), 0 0 50px var(--gold-glow);
  text-align: center;
  z-index: 80;
  pointer-events: auto;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), visibility 0.3s;
}

.cloud-inspection-card.active {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.cloud-close-btn {
  position: absolute;
  top: 1.2rem;
  right: 1.4rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--card-border);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.2s ease, color 0.2s ease;
}

.cloud-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.cloud-card-arabic {
  font-family: var(--font-arabic);
  font-size: clamp(2.2rem, 4vw, 3.2rem);
  font-weight: 700;
  line-height: 1.35;
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.6rem;
}

.cloud-card-translit {
  font-family: var(--font-body);
  font-size: 1.2rem;
  font-style: italic;
  color: var(--text-gold);
  margin-bottom: 0.6rem;
}

.cloud-card-english {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: var(--text-main);
  line-height: 1.5;
  margin-bottom: 0.5rem;
}

.cloud-card-bengali {
  font-family: 'Hind Siliguri', 'Segoe UI', sans-serif;
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1.2rem;
}

.cloud-card-fadilah {
  display: inline-block;
  padding: 0.4rem 1.1rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border-glow);
  border-radius: 9999px;
  font-size: 0.78rem;
  color: var(--text-gold);
  font-weight: 500;
}

/* --- 6. Controls Dock & Fullscreen Primary Button --- */
.dhikr-dock {
  margin-bottom: 0.8dvh;
}

.fullscreen-primary-btn {
  background: rgba(251, 191, 36, 0.15) !important;
  border-color: var(--card-border-glow) !important;
  color: var(--text-gold) !important;
  font-weight: 600;
}

.fullscreen-primary-btn:hover {
  background: rgba(251, 191, 36, 0.28) !important;
  transform: translateY(-2px) scale(1.04);
}

/* Compact Unified Audio Button */
.compact-audio-btn {
  padding: 0.45rem 0.8rem;
}

.compact-switch-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  padding: 0.15rem 0.45rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--card-border);
  border-radius: 9999px;
  color: var(--text-gold);
  margin-left: 0.35rem;
  transition: transform 0.25s ease, background 0.2s ease, border-color 0.2s ease;
  line-height: 1;
}

.compact-switch-badge:hover {
  background: rgba(251, 191, 36, 0.25);
  border-color: var(--card-border-glow);
  transform: rotate(180deg);
}

/* Desk Keyboard Hint */
@media (min-width: 900px) {
  .dhikr-glass-card::after {
    content: "Space: Tasbih / Pause • Arrow Keys: Navigate • M: Mode Switch • F11: Fullscreen";
    position: absolute;
    bottom: 8px;
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    opacity: 0.45;
  }
}

/* --- 7. Mobile Responsiveness --- */
@media (max-width: 768px) {
  .desk-clock-badge {
    display: none !important;
  }

  /* Top Bar strictly horizontal & side-by-side */
  .dhikr-top-bar {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 0.4rem !important;
    width: 100% !important;
  }

  .top-nav-actions {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 0.35rem !important;
    flex-shrink: 0 !important;
    white-space: nowrap !important;
  }

  .dhikr-mode-pill {
    padding: 0.35rem 0.65rem !important;
    font-size: 0.72rem !important;
    gap: 0.3rem !important;
    flex-shrink: 0 !important;
    white-space: nowrap !important;
  }

  .tasbih-badge {
    padding: 0.35rem 0.65rem !important;
    font-size: 0.72rem !important;
    gap: 0.35rem !important;
    flex-shrink: 0 !important;
    white-space: nowrap !important;
  }

  .home-link-btn {
    padding: 0.35rem 0.55rem !important;
    font-size: 0.72rem !important;
    flex-shrink: 1 !important;
    min-width: 0 !important;
  }

  .dhikr-glass-card {
    padding: 2.2rem 1.2rem;
    border-radius: 1.8rem;
  }

  .dhikr-fadilah-pill {
    padding: 0.4rem 1rem;
    font-size: 0.75rem;
  }
}

@media (max-width: 480px) {
  /* On small phones, streamline labels so buttons always stay side-by-side */
  .home-link-btn .dock-label {
    display: none !important; /* Compact clean back button */
  }

  .tasbih-badge .tasbih-label {
    display: none !important; /* Compact: 📿 [count] ↺ */
  }

  .top-nav-actions {
    gap: 0.25rem !important;
  }

  .dhikr-mode-pill {
    padding: 0.32rem 0.52rem !important;
    font-size: 0.7rem !important;
  }

  .tasbih-badge {
    padding: 0.32rem 0.52rem !important;
    font-size: 0.7rem !important;
  }
}
