/* ===================================================================
   iOS 18 & Lovelace Cupertino Design System Tokens
   Strictly NO EMOJIS - Only Pure Apple SF Symbols SVGs
   =================================================================== */

:root {
  /* iOS System Colors */
  --ios-blue: #007aff;
  --ios-blue-dark: #0a84ff;
  --ios-green: #34c759;
  --ios-green-dark: #30d158;
  --ios-indigo: #5856d6;
  --ios-orange: #ff9500;
  --ios-pink: #ff2d55;
  --ios-purple: #af52de;
  --ios-red: #ff3b30;
  --ios-teal: #5ac8fa;
  --ios-yellow: #ffcc00;

  /* Current Active Accent */
  --accent-color: #007aff;
  --accent-rgb: 0, 122, 255;

  /* Typography */
  --font-ios: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, monospace;

  /* Squircles & Radii */
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --radius-full: 9999px;

  /* Smooth Spring Easing */
  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 200ms;
  --duration-normal: 350ms;
}

/* Light Mode Tokens (Default) */
[data-theme="light"] {
  --bg-system: #f2f2f7;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f2f2f7;
  --bg-grouped: #f2f2f7;
  --bg-glass: rgba(255, 255, 255, 0.78);
  --bg-glass-card: rgba(255, 255, 255, 0.88);
  --bg-glass-heavy: rgba(255, 255, 255, 0.92);
  --bg-input: rgba(118, 118, 128, 0.12);
  --bg-segmented: rgba(118, 118, 128, 0.12);
  --bg-segmented-active: #ffffff;

  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-light: rgba(0, 0, 0, 0.04);
  --border-glass: rgba(255, 255, 255, 0.6);
  --separator: rgba(60, 60, 67, 0.18);

  --text-primary: #000000;
  --text-secondary: #6e6e73;
  --text-tertiary: #86868b;
  --text-quaternary: #aeaeb2;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-float: 0 16px 36px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-segmented: 0 2px 6px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.06);

  --status-bar-text: #000000;
  --apple-pay-bg: #000000;
  --apple-pay-text: #ffffff;
  --wallpaper-overlay: rgba(242, 242, 247, 0.5);
}

/* Dark Mode Tokens */
[data-theme="dark"] {
  --bg-system: #000000;
  --bg-secondary: #1c1c1e;
  --bg-tertiary: #2c2c2e;
  --bg-grouped: #000000;
  --bg-glass: rgba(28, 28, 30, 0.75);
  --bg-glass-card: rgba(28, 28, 30, 0.85);
  --bg-glass-heavy: rgba(28, 28, 30, 0.94);
  --bg-input: rgba(118, 118, 128, 0.24);
  --bg-segmented: rgba(118, 118, 128, 0.24);
  --bg-segmented-active: #636366;

  --border-subtle: rgba(255, 255, 255, 0.12);
  --border-light: rgba(255, 255, 255, 0.06);
  --border-glass: rgba(255, 255, 255, 0.14);
  --separator: rgba(84, 84, 88, 0.45);

  --text-primary: #ffffff;
  --text-secondary: #a1a1a6;
  --text-tertiary: #8e8e93;
  --text-quaternary: #48484a;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4), 0 1px 4px rgba(0, 0, 0, 0.3);
  --shadow-float: 0 16px 40px rgba(0, 0, 0, 0.6), 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-segmented: 0 2px 6px rgba(0, 0, 0, 0.4);

  --status-bar-text: #ffffff;
  --apple-pay-bg: #ffffff;
  --apple-pay-text: #000000;
  --wallpaper-overlay: rgba(0, 0, 0, 0.65);
}

/* Light Mode Automatic Color Overrides */
[data-theme="light"] body {
  color: var(--text-primary);
  background-color: var(--bg-system);
}

[data-theme="light"] .ios-live-time {
  color: var(--text-primary) !important;
}

[data-theme="light"] .text-white {
  color: var(--text-primary) !important;
}

[data-theme="light"] .text-zinc-400 {
  color: var(--text-secondary) !important;
}

[data-theme="light"] .text-zinc-300 {
  color: var(--text-primary) !important;
}

[data-theme="light"] .text-zinc-500 {
  color: var(--text-tertiary) !important;
}

[data-theme="light"] .bg-zinc-900,
[data-theme="light"] .bg-zinc-800,
[data-theme="light"] .bg-zinc-800\/40,
[data-theme="light"] .bg-zinc-800\/50,
[data-theme="light"] .bg-zinc-800\/60,
[data-theme="light"] .bg-zinc-900\/50,
[data-theme="light"] .bg-zinc-900\/60,
[data-theme="light"] .bg-zinc-900\/70,
[data-theme="light"] .bg-zinc-900\/80 {
  background-color: var(--bg-secondary) !important;
}

[data-theme="light"] .border-white\/10,
[data-theme="light"] .border-white\/5 {
  border-color: var(--border-subtle) !important;
}

[data-theme="light"] .ios-blur-card {
  background-color: var(--bg-glass-card);
  border-color: var(--border-subtle);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .ios-blur-nav {
  background-color: rgba(255, 255, 255, 0.88);
  border-color: rgba(60, 60, 67, 0.12);
}

[data-theme="light"] .ios-btn-circle {
  background-color: rgba(0, 0, 0, 0.06);
  color: var(--text-primary);
}

[data-theme="light"] .ios-btn-secondary {
  background-color: rgba(0, 0, 0, 0.06);
  color: var(--text-primary);
  border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .ios-bottom-sheet {
  background-color: #ffffff;
  color: #000000;
}

[data-theme="light"] .ios-grouped-list {
  background-color: #ffffff;
  border-color: rgba(60, 60, 67, 0.12);
}

[data-theme="light"] .ios-grouped-item {
  border-color: rgba(60, 60, 67, 0.12);
}

[data-theme="light"] footer.ios-blur {
  background-color: rgba(255, 255, 255, 0.85);
  border-color: rgba(60, 60, 67, 0.15);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}


/* HomeKit Wallpaper Variants */
[data-wallpaper="dark-blue"] {
  --custom-wallpaper: url('/assets/wallpapers/homekit-bg-dark-blue.jpg');
}
[data-wallpaper="light-blue"] {
  --custom-wallpaper: url('/assets/wallpapers/homekit-bg-light-blue.jpg');
}
[data-wallpaper="orange"] {
  --custom-wallpaper: url('/assets/wallpapers/homekit-bg-orange.jpg');
  --accent-color: #ff9500;
  --accent-rgb: 255, 149, 0;
}
[data-wallpaper="dark-green"] {
  --custom-wallpaper: url('/assets/wallpapers/homekit-bg-dark-green.jpg');
  --accent-color: #34c759;
  --accent-rgb: 52, 199, 89;
}
[data-wallpaper="red"] {
  --custom-wallpaper: url('/assets/wallpapers/homekit-bg-red.jpg');
  --accent-color: #ff3b30;
  --accent-rgb: 255, 59, 48;
}
[data-wallpaper="none"] {
  --custom-wallpaper: none;
}

/* Base Styles */
* {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-ios);
  background-color: var(--bg-system);
  color: var(--text-primary);
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  letter-spacing: -0.015em;
  transition: background-color var(--duration-normal) var(--ease-spring),
              color var(--duration-normal) var(--ease-spring);
}

/* Background Wallpaper Layer */
.ios-wallpaper-layer {
  position: fixed;
  inset: 0;
  background-image: var(--custom-wallpaper, none);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 0;
  pointer-events: none;
  transition: opacity var(--duration-normal) ease;
}

.ios-wallpaper-overlay {
  position: fixed;
  inset: 0;
  background: var(--wallpaper-overlay);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 0;
  pointer-events: none;
}

/* Frosted Glass Utilities */
.ios-blur {
  backdrop-filter: blur(28px) saturate(190%);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  background-color: var(--bg-glass);
}

.ios-blur-card {
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  background-color: var(--bg-glass-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: transform var(--duration-fast) var(--ease-spring),
              box-shadow var(--duration-fast) var(--ease-spring),
              border-color var(--duration-fast) ease;
}

.ios-blur-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-float);
  border-color: rgba(var(--accent-rgb), 0.35);
}

.ios-blur-nav {
  backdrop-filter: blur(32px) saturate(200%);
  -webkit-backdrop-filter: blur(32px) saturate(200%);
  background-color: var(--bg-glass-heavy);
  border-bottom: 0.5px solid var(--separator);
}

/* Segmented Control */
.ios-segmented {
  display: inline-flex;
  position: relative;
  background-color: var(--bg-segmented);
  padding: 3px;
  border-radius: var(--radius-sm);
  user-select: none;
}

.ios-segmented-indicator {
  position: absolute;
  top: 3px;
  bottom: 3px;
  background-color: var(--bg-segmented-active);
  border-radius: calc(var(--radius-sm) - 2px);
  box-shadow: var(--shadow-segmented);
  transition: all 0.28s var(--ease-spring);
  z-index: 1;
}

.ios-segmented-btn {
  position: relative;
  z-index: 2;
  border: none;
  background: transparent;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: calc(var(--radius-sm) - 2px);
  transition: color 0.2s ease;
  white-space: nowrap;
}

.ios-segmented-btn.active {
  color: var(--text-primary);
  font-weight: 600;
}

/* Native iOS Switch Toggle */
.ios-switch {
  position: relative;
  display: inline-block;
  width: 51px;
  height: 31px;
}

.ios-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.ios-switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: rgba(120, 120, 128, 0.32);
  transition: 0.3s var(--ease-spring);
  border-radius: 31px;
}

.ios-switch-slider::before {
  position: absolute;
  content: "";
  height: 27px;
  width: 27px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: 0.3s var(--ease-spring);
  border-radius: 50%;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 1px 1px rgba(0, 0, 0, 0.06);
}

.ios-switch input:checked + .ios-switch-slider {
  background-color: var(--ios-green);
}

.ios-switch input:checked + .ios-switch-slider::before {
  transform: translateX(20px);
}

/* iOS Buttons */
.ios-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background-color: var(--accent-color);
  color: #ffffff;
  font-weight: 600;
  font-size: 15px;
  padding: 12px 22px;
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  transition: transform 0.15s var(--ease-spring), filter 0.2s ease, opacity 0.2s ease;
}

.ios-btn-primary:active {
  transform: scale(0.96);
  filter: brightness(0.92);
}

.ios-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background-color: var(--bg-input);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-light);
  cursor: pointer;
  transition: transform 0.15s var(--ease-spring), background-color 0.2s ease;
}

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

.ios-btn-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-input);
  color: var(--text-primary);
  border: none;
  cursor: pointer;
  transition: transform 0.15s var(--ease-spring), background-color 0.2s ease;
}

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

/* Apple Pay Button */
.apple-pay-button {
  background-color: var(--apple-pay-bg);
  color: var(--apple-pay-text);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 28px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  width: 100%;
  transition: transform 0.15s var(--ease-spring), opacity 0.2s ease;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.apple-pay-button:active {
  transform: scale(0.97);
  opacity: 0.9;
}

/* Sleek iOS 18 Notification Toast */
.ios-toast {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  opacity: 0;
  backdrop-filter: blur(28px) saturate(190%);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  background-color: var(--bg-glass-heavy);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 8px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-float);
  z-index: 1000;
  pointer-events: none;
  transition: all 0.35s var(--ease-spring);
}

.ios-toast.active {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Bottom Sheet Modal */
.ios-modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.ios-modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.ios-bottom-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 640px;
  margin: 0 auto;
  background-color: var(--bg-secondary);
  border-top-left-radius: 32px;
  border-top-right-radius: 32px;
  z-index: 1050;
  box-shadow: 0 -12px 48px rgba(0, 0, 0, 0.28);
  transform: translateY(105%);
  transition: transform 0.42s var(--ease-spring), visibility 0.42s ease;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  border-bottom: none;
  visibility: hidden;
  pointer-events: none;
}

.ios-bottom-sheet.active {
  transform: translateY(0);
  visibility: visible;
  pointer-events: auto;
}

.ios-sheet-grabber {
  width: 36px;
  height: 5px;
  background-color: rgba(120, 120, 128, 0.35);
  border-radius: 3px;
  margin: 10px auto 4px auto;
  cursor: grab;
}

/* Inset Grouped List Styles */
.ios-grouped-list {
  background-color: var(--bg-secondary);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.ios-grouped-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 0.5px solid var(--separator);
}

.ios-grouped-item:last-child {
  border-bottom: none;
}

/* Native Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: rgba(120, 120, 128, 0.25);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(120, 120, 128, 0.45);
}

/* Animations */
@keyframes pulseSubtle {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.pulse-badge {
  animation: pulseSubtle 2s infinite ease-in-out;
}

/* Hide scrollbar for clean iOS feel */
.no-scrollbar::-webkit-scrollbar {
  display: none !important;
}
.no-scrollbar {
  -ms-overflow-style: none !important;
  scrollbar-width: none !important;
}

/* Paydisini QRIS Card Container */
.qris-card {
  background: #ffffff;
  padding: 16px;
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.qris-img {
  width: 220px;
  height: 220px;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

/* Pulsing Live Dot */
.pulse-dot-green {
  width: 8px;
  height: 8px;
  background-color: #34c759;
  border-radius: 9999px;
  box-shadow: 0 0 10px #34c759;
  animation: pulseDot 1.5s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.3); }
}

/* Copyable Credential Field */
.ios-credential-box {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ios-credential-box:hover {
  border-color: rgba(0, 122, 255, 0.5);
}

/* ===================================================================
   iOS 18 Native Floating Tab Bar & Mobile Layout System
   =================================================================== */
.ios-floating-tab-bar {
  position: fixed;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  width: min(94%, 420px);
  padding: 5px 6px;
  border-radius: 9999px;
  backdrop-filter: blur(28px) saturate(190%);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  background-color: rgba(22, 22, 26, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55), 0 0 1px rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

[data-theme="light"] .ios-floating-tab-bar {
  background-color: rgba(255, 255, 255, 0.90);
  border-color: rgba(60, 60, 67, 0.15);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}

.ios-tab-btn {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px 1px;
  border-radius: 16px;
  user-select: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
}

.ios-tab-btn span {
  font-size: 10px;
  font-weight: 600;
  line-height: 1.1;
  white-space: nowrap;
  letter-spacing: -0.01em;
  max-width: 100%;
}

.ios-tab-btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.ios-tab-btn:active {
  transform: scale(0.92);
}

/* Mobile Viewport Refinements */
@media (max-width: 639px) {
  .ios-bottom-sheet {
    border-top-left-radius: 26px;
    border-top-right-radius: 26px;
    max-height: 94vh;
  }
  
  .ios-sheet-grabber {
    margin: 8px auto 2px auto;
  }
}

