/* ============================================
   Amal.my — Custom Styles
   ============================================ */

/* ── Semantic color tokens (Light mode) ── */
:root {
  --color-primary: #0d7a5f;
  --color-primary-light: #10a37f;
  --color-primary-dark: #095e49;
  --color-gold: #c4960a;
  --color-gold-light: #e6b412;
  --color-ramadan-from: #1a0a30;
  --color-ramadan-to: #2d1050;
  --radius-card: 16px;
  --radius-item: 10px;

  /* Semantic surfaces */
  --c-bg: #faf9f5;
  --c-surface: #ffffff;
  --c-surface-alt: #f9fafb;
  --c-surface-hover: #f3f4f6;
  --c-text: #1f2937;
  --c-text-secondary: #374151;
  --c-text-muted: #6b7280;
  --c-text-dim: #9ca3af;
  --c-border: #f3f4f6;
  --c-border-heavy: #e5e7eb;
  --c-input-bg: #f3f4f6;
  --c-unchecked-bg: #f3f4f6;
}

/* ── Dark mode tokens ── */
html.dark {
  --c-bg: #0f172a;
  --c-surface: #1e293b;
  --c-surface-alt: #1e293b;
  --c-surface-hover: #334155;
  --c-text: #e2e8f0;
  --c-text-secondary: #cbd5e1;
  --c-text-muted: #94a3b8;
  --c-text-dim: #64748b;
  --c-border: #334155;
  --c-border-heavy: #475569;
  --c-input-bg: #334155;
  --c-unchecked-bg: #334155;
  color-scheme: dark;
}

html.dark .ramadan-bg {
  background: linear-gradient(135deg, #0f0520, #1a0a35);
}

/* Hide Alpine.js elements until ready */
[x-cloak] {
  display: none !important;
}

/* Smooth page transitions */
html {
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

body {
  overscroll-behavior-y: contain;
  background-color: var(--c-bg);
  color: var(--c-text);
  transition: background-color 0.3s ease, color 0.3s ease;
  touch-action: manipulation;
}

/* Progress ring animation */
.progress-ring-circle {
  transition: stroke-dashoffset 0.4s ease;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}

/* Checkbox tap animation */
.check-item {
  transition: transform 0.15s ease, background-color 0.2s ease;
}

.check-item:active {
  transform: scale(0.96);
}

/* Streak fire glow */
.streak-glow {
  text-shadow: 0 0 8px rgba(196, 150, 10, 0.5);
}

/* Safe area insets for iOS PWA (no-op in regular browsers) */
#app {
  padding-top: env(safe-area-inset-top, 0px);
}

/* Bottom nav safe area */
.bottom-nav {
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* Card hover/press states */
.card-press {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card-press:active {
  transform: scale(0.98);
}

/* Heatmap cell */
.heatmap-cell {
  width: 14px;
  height: 14px;
  border-radius: 3px;
}

/* Ramadan gradient background */
.ramadan-bg {
  background: linear-gradient(135deg, var(--color-ramadan-from), var(--color-ramadan-to));
}

/* Arabic text styling */
.arabic-text {
  font-family: 'Amiri', serif;
  direction: rtl;
  line-height: 2;
}

/* Stat number styling */
.stat-number {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
}

/* Onboarding logo entrance */
@keyframes float-in {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.float-in {
  animation: float-in 0.5s ease-out;
}

/* Smooth bar/progress transitions */
.progress-bar {
  transition: width 0.5s ease-out;
}

/* Selection colour */
::selection {
  background: rgba(13, 122, 95, 0.2);
}

/* Focus visible for accessibility */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Scrollbar styling (webkit) */
::-webkit-scrollbar {
  width: 4px;
}

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

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 4px;
}

html.dark ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
}

/* Theme transition for cards and surfaces */
.surface-card {
  background-color: var(--c-surface);
  border-color: var(--c-border);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* Number-only input spinner hide */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type=number] {
  -moz-appearance: textfield;
}
