/* ====== DESIGN TOKENS ====== */
:root {
  --bg-primary: #0a1628;
  --bg-secondary: #111d35;
  --bg-card: rgba(17, 29, 53, 0.85);
  --gold: #d4af37;
  --gold-light: #f0d060;
  --gold-dim: rgba(212, 175, 55, 0.2);
  --emerald: #10b77f;
  --emerald-dim: rgba(16, 183, 127, 0.15);
  --text-primary: #f0ece2;
  --text-secondary: #8a9bb5;
  --text-muted: #556680;
  --danger: #e74c5e;
  --glass: rgba(255, 255, 255, 0.04);
  --glass-border: rgba(255, 255, 255, 0.08);
  --font-arabic: 'Amiri', serif;
  --font-ui: 'Cairo', sans-serif;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ====== RESET & BASE ====== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
}

body {
  font-family: var(--font-ui);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ====== ISLAMIC GEOMETRIC PATTERN ====== */
.pattern-overlay {
  position: fixed;
  inset: 0;
  opacity: 0.03;
  pointer-events: none;
  z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80'%3E%3Cpath d='M40 0L80 40L40 80L0 40Z' fill='none' stroke='%23d4af37' stroke-width='0.5'/%3E%3Cpath d='M40 10L70 40L40 70L10 40Z' fill='none' stroke='%23d4af37' stroke-width='0.5'/%3E%3Cpath d='M40 20L60 40L40 60L20 40Z' fill='none' stroke='%23d4af37' stroke-width='0.3'/%3E%3Ccircle cx='40' cy='40' r='5' fill='none' stroke='%23d4af37' stroke-width='0.3'/%3E%3C/svg%3E");
  background-size: 80px 80px;
}

/* ====== PARTICLES ====== */
#particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.particle {
  position: absolute;
  width: 3px;
  height: 3px;
  background: var(--gold);
  border-radius: 50%;
  opacity: 0;
  animation: floatParticle 8s infinite ease-in-out;
}

@keyframes floatParticle {

  0%,
  100% {
    opacity: 0;
    transform: translateY(0) scale(0.5);
  }

  50% {
    opacity: 0.4;
    transform: translateY(-80px) scale(1);
  }
}

/* ====== APP LAYOUT ====== */
#app {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 20px;
}

/* ====== SCREENS ====== */
.screen {
  display: none;
  animation: fadeIn 0.4s ease;
}

.screen.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ====== HEADER ====== */
.app-header {
  text-align: center;
  padding: 30px 0 20px;
  position: relative;
}

.crescent-moon {
  font-size: 48px;
  color: var(--gold);
  filter: drop-shadow(0 0 20px rgba(212, 175, 55, 0.4));
  animation: gentleGlow 3s infinite ease-in-out alternate;
  line-height: 1;
}

@keyframes gentleGlow {
  from {
    filter: drop-shadow(0 0 15px rgba(212, 175, 55, 0.3));
  }

  to {
    filter: drop-shadow(0 0 25px rgba(212, 175, 55, 0.6));
  }
}

.app-title {
  font-family: var(--font-arabic);
  font-size: 2.2rem;
  color: var(--gold);
  margin: 8px 0 4px;
  font-weight: 700;
}

.app-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-family: var(--font-arabic);
}

.header-actions {
  position: absolute;
  top: 30px;
  left: 0;
  display: flex;
  gap: 8px;
}

.icon-btn {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  width: 42px;
  height: 42px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.icon-btn:hover {
  background: var(--gold-dim);
  color: var(--gold);
  border-color: rgba(212, 175, 55, 0.3);
}

/* ====== AZKAR GRID ====== */
.azkar-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 20px 0;
}

.azkar-card {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 20px 14px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px);
}

.azkar-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.05), transparent);
  opacity: 0;
  transition: var(--transition);
}

.azkar-card:hover::before,
.azkar-card:active::before {
  opacity: 1;
}

.azkar-card:hover {
  border-color: rgba(212, 175, 55, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(212, 175, 55, 0.1);
}

.azkar-card:active {
  transform: scale(0.97);
}

.azkar-card .dhikr-name {
  font-family: var(--font-arabic);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.6;
}

.azkar-card .card-decorator {
  color: var(--gold);
  opacity: 0.3;
  font-size: 1.4rem;
  margin-bottom: 6px;
}

.azkar-card.custom {
  border-style: dashed;
}

.azkar-card .delete-dhikr {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(231, 76, 94, 0.15);
  color: var(--danger);
  font-size: 14px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.azkar-card.custom:hover .delete-dhikr {
  display: flex;
}

.azkar-card .delete-dhikr:hover {
  background: rgba(231, 76, 94, 0.3);
}

/* ====== ADD BUTTON ====== */
.add-btn {
  width: 100%;
  padding: 16px;
  border: 2px dashed rgba(212, 175, 55, 0.3);
  border-radius: var(--radius);
  background: transparent;
  color: var(--gold);
  font-family: var(--font-ui);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: var(--transition);
}

.add-btn:hover {
  background: var(--gold-dim);
  border-color: var(--gold);
}

.add-icon {
  font-size: 1.5rem;
  font-weight: 300;
}

/* ====== SETUP SCREEN ====== */
.back-btn {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  width: 42px;
  height: 42px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  margin-bottom: 20px;
}

.back-btn:hover {
  background: var(--gold-dim);
  color: var(--gold);
}

.setup-container {
  text-align: center;
}

.label {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.selected-dhikr-display {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 30px 20px;
  margin-bottom: 30px;
  backdrop-filter: blur(10px);
}

.dhikr-text-large {
  font-family: var(--font-arabic);
  font-size: 1.8rem;
  color: var(--gold);
  font-weight: 700;
  line-height: 1.8;
}

.target-section {
  margin-bottom: 30px;
}

.target-options {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.target-btn {
  padding: 10px 22px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  background: var(--glass);
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 1.1rem;
  cursor: pointer;
  transition: var(--transition);
}

.target-btn:hover {
  border-color: rgba(212, 175, 55, 0.3);
  color: var(--gold);
}

.target-btn.active {
  background: var(--gold-dim);
  border-color: var(--gold);
  color: var(--gold);
  font-weight: 700;
}

.custom-target input {
  width: 160px;
  padding: 10px 16px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  background: var(--glass);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 1rem;
  text-align: center;
  outline: none;
  transition: var(--transition);
}

.custom-target input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim);
}

.custom-target input::placeholder {
  color: var(--text-muted);
}

/* ====== PRIMARY / GHOST / DANGER BUTTONS ====== */
.primary-btn {
  padding: 14px 40px;
  background: linear-gradient(135deg, var(--gold), #c9a227);
  color: var(--bg-primary);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 16px rgba(212, 175, 55, 0.3);
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(212, 175, 55, 0.4);
}

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

.ghost-btn {
  padding: 14px 40px;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
}

.ghost-btn:hover {
  background: var(--glass);
}

.danger-btn {
  padding: 12px 30px;
  background: rgba(231, 76, 94, 0.1);
  color: var(--danger);
  border: 1px solid rgba(231, 76, 94, 0.3);
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 20px;
}

.danger-btn:hover {
  background: rgba(231, 76, 94, 0.2);
}

/* ====== PREV SESSIONS ====== */
.prev-sessions {
  margin-bottom: 24px;
}

.prev-session-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: var(--transition);
}

.prev-session-card:hover {
  border-color: rgba(16, 183, 127, 0.4);
  background: var(--emerald-dim);
}

.prev-session-info {
  text-align: right;
}

.prev-session-count {
  font-weight: 700;
  color: var(--emerald);
  font-size: 0.95rem;
}

.prev-session-date {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 2px;
}

.prev-session-resume {
  background: var(--emerald-dim);
  border: 1px solid rgba(16, 183, 127, 0.3);
  color: var(--emerald);
  border-radius: 8px;
  padding: 6px 14px;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
}

.prev-session-resume:hover {
  background: rgba(16, 183, 127, 0.25);
}

/* ====== COUNTER SCREEN ====== */
.counter-container {
  text-align: center;
  padding-top: 10px;
}

.counter-dhikr {
  font-family: var(--font-arabic);
  font-size: 1.6rem;
  color: var(--gold);
  font-weight: 700;
  margin-bottom: 20px;
  line-height: 1.8;
}

/* Progress Ring */
.progress-ring-container {
  position: relative;
  width: 220px;
  height: 220px;
  margin: 0 auto 30px;
}

.progress-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.progress-ring-bg {
  stroke: var(--glass-border);
}

.progress-ring-fill {
  stroke: url(#ring-grad);
  stroke-linecap: round;
  stroke-dasharray: 565.48;
  stroke-dashoffset: 565.48;
  transition: stroke-dashoffset 0.5s ease;
}

.counter-display {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: row;
  gap: 4px;
}

.count-number {
  font-size: 3rem;
  font-weight: 900;
  color: var(--text-primary);
  font-family: var(--font-ui);
  line-height: 1;
}

.count-separator {
  font-size: 1.5rem;
  color: var(--text-muted);
  margin: 0 2px;
}

.count-target {
  font-size: 1.2rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* Pulse animation on count */
@keyframes countPulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.15);
  }

  100% {
    transform: scale(1);
  }
}

.count-pulse {
  animation: countPulse 0.3s ease;
}

/* ====== VOICE SECTION ====== */
.voice-section {
  margin: 20px 0;
}

.voice-btn {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 2px solid var(--glass-border);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  position: relative;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

.voice-btn:hover {
  border-color: var(--emerald);
  color: var(--emerald);
  box-shadow: 0 0 20px rgba(16, 183, 127, 0.2);
}

.voice-btn.listening {
  border-color: var(--emerald);
  color: var(--emerald);
  background: var(--emerald-dim);
  box-shadow: 0 0 30px rgba(16, 183, 127, 0.3);
  animation: voicePulse 2s infinite;
}

@keyframes voicePulse {

  0%,
  100% {
    box-shadow: 0 0 20px rgba(16, 183, 127, 0.2);
  }

  50% {
    box-shadow: 0 0 40px rgba(16, 183, 127, 0.4);
  }
}

.voice-waves {
  position: absolute;
  display: flex;
  gap: 3px;
  align-items: center;
  height: 30px;
  opacity: 0;
  transition: opacity 0.3s;
}

.voice-waves.active {
  opacity: 1;
}

.voice-waves.active+.mic-icon {
  display: none;
}

.voice-waves span {
  width: 3px;
  background: var(--emerald);
  border-radius: 2px;
  animation: wave 0.8s infinite ease-in-out;
}

.voice-waves span:nth-child(1) {
  height: 8px;
  animation-delay: 0s;
}

.voice-waves span:nth-child(2) {
  height: 16px;
  animation-delay: 0.1s;
}

.voice-waves span:nth-child(3) {
  height: 24px;
  animation-delay: 0.2s;
}

.voice-waves span:nth-child(4) {
  height: 16px;
  animation-delay: 0.3s;
}

.voice-waves span:nth-child(5) {
  height: 8px;
  animation-delay: 0.4s;
}

@keyframes wave {

  0%,
  100% {
    transform: scaleY(0.5);
  }

  50% {
    transform: scaleY(1.2);
  }
}

.voice-status {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 12px;
}

.voice-result {
  color: var(--text-primary);
  font-family: var(--font-arabic);
  font-size: 1.3rem;
  margin-top: 10px;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  background: transparent;
  opacity: 0;
  transition: opacity 0.3s, background 0.3s, color 0.3s;
  line-height: 1.8;
}

.voice-result.show {
  opacity: 1;
  background: var(--glass);
}

.voice-result.matched {
  opacity: 1;
  color: var(--emerald);
  background: var(--emerald-dim);
  animation: matchFlash 0.5s ease;
}

@keyframes matchFlash {
  0% {
    transform: scale(1);
  }

  30% {
    transform: scale(1.05);
    background: rgba(16, 183, 127, 0.25);
  }

  100% {
    transform: scale(1);
  }
}

/* ====== COUNTER ACTIONS ====== */
.counter-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 24px;
}

.action-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: var(--transition);
  font-family: var(--font-ui);
  font-size: 0.7rem;
}

.action-btn:hover {
  background: var(--gold-dim);
  color: var(--gold);
  border-color: rgba(212, 175, 55, 0.3);
}

.action-btn:active {
  transform: scale(0.9);
}

.manual-btn:hover {
  background: var(--emerald-dim);
  color: var(--emerald);
  border-color: rgba(16, 183, 127, 0.3);
}

.reset-btn:hover {
  background: rgba(231, 76, 94, 0.1);
  color: var(--danger);
  border-color: rgba(231, 76, 94, 0.3);
}

/* ====== SESSIONS SCREEN ====== */
.screen-title {
  font-family: var(--font-arabic);
  color: var(--gold);
  font-size: 1.5rem;
  margin-bottom: 20px;
  text-align: center;
}

.sessions-list {
  margin-bottom: 20px;
}

.session-card {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
  transition: var(--transition);
  backdrop-filter: blur(10px);
}

.session-card:hover {
  border-color: rgba(212, 175, 55, 0.2);
}

.session-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.session-dhikr {
  font-family: var(--font-arabic);
  font-size: 1.15rem;
  color: var(--text-primary);
  font-weight: 700;
}

.session-badge {
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 600;
}

.session-badge.completed {
  background: var(--emerald-dim);
  color: var(--emerald);
}

.session-badge.ongoing {
  background: var(--gold-dim);
  color: var(--gold);
}

.session-card-body {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.session-progress-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.session-progress-text strong {
  color: var(--text-primary);
}

.session-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.session-card-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}

.session-continue-btn {
  padding: 6px 16px;
  background: var(--emerald-dim);
  border: 1px solid rgba(16, 183, 127, 0.3);
  color: var(--emerald);
  border-radius: 8px;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
}

.session-continue-btn:hover {
  background: rgba(16, 183, 127, 0.25);
}

.session-delete-btn {
  padding: 6px 16px;
  background: rgba(231, 76, 94, 0.08);
  border: 1px solid rgba(231, 76, 94, 0.2);
  color: var(--danger);
  border-radius: 8px;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
}

.session-delete-btn:hover {
  background: rgba(231, 76, 94, 0.2);
}

.empty-sessions {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-sessions .empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

/* ====== MODALS ====== */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.3s ease;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 30px;
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.modal-content h3 {
  font-family: var(--font-arabic);
  color: var(--gold);
  font-size: 1.4rem;
  margin-bottom: 20px;
}

.dhikr-input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  background: var(--glass);
  color: var(--text-primary);
  font-family: var(--font-arabic);
  font-size: 1.2rem;
  text-align: center;
  outline: none;
  transition: var(--transition);
  margin-bottom: 20px;
}

.dhikr-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim);
}

.dhikr-input::placeholder {
  color: var(--text-muted);
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* Completion modal */
.completion .completion-icon {
  font-size: 4rem;
  margin-bottom: 10px;
  animation: completionBounce 0.6s ease;
}

@keyframes completionBounce {
  0% {
    transform: scale(0);
  }

  50% {
    transform: scale(1.3);
  }

  100% {
    transform: scale(1);
  }
}

.completion .completion-dua {
  color: var(--emerald);
  font-family: var(--font-arabic);
  font-size: 1.1rem;
  margin: 12px 0 20px;
}

/* ====== RIPPLE EFFECT ====== */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(212, 175, 55, 0.3);
  transform: scale(0);
  animation: rippleAnim 0.6s linear;
  pointer-events: none;
}

@keyframes rippleAnim {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* ====== SCROLLBAR ====== */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 4px;
}

/* ====== RESPONSIVE ====== */
@media (max-width: 400px) {
  .azkar-grid {
    grid-template-columns: 1fr;
  }

  .app-title {
    font-size: 1.8rem;
  }

  .dhikr-text-large {
    font-size: 1.5rem;
  }

  .count-number {
    font-size: 2.5rem;
  }
}
/* ====== FOOTER ====== */
.app-footer {
  margin-top: 40px;
  padding: 30px 20px;
  border-top: 1px solid var(--glass-border);
  text-align: center;
  border-radius: var(--radius);
  background: linear-gradient(to top, rgba(16, 183, 127, 0.05), transparent);
}

.footer-content h3 {
  font-family: var(--font-arabic);
  color: var(--gold);
  margin-bottom: 12px;
  font-size: 1.1rem;
}

.footer-content p {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.6;
  margin-bottom: 16px;
  max-width: 90%;
  margin-left: auto;
  margin-right: auto;
}

.copyright {
  font-size: 0.75rem !important;
  opacity: 0.6;
  margin-top: 20px;
  border-top: 1px solid var(--glass-border);
  padding-top: 16px;
  display: block;
}
