/* ==========================================================================
   ZEM'S CAPITAL - Apple HIG & Fluid Motion Architecture
   Canvas #F2F2F7 / #F9FAFB • Surface #FFFFFF • Navy #0B1528 • Gold #C5A869
   ========================================================================== */

:root {
  --zems-navy: #0B1528;
  --zems-navy-hover: #14223E;
  --zems-gold: #C5A869;
  --zems-gold-light: #DFB743;
  --zems-gold-dark: #8B6B23;
  --zems-charcoal: #111827;
  --zems-muted: #6B7280;
  --zems-surface: #FFFFFF;
  --zems-canvas: #F9FAFB;
  --zems-border: #E5E7EB;

  /* iOS Semantic System Colors */
  --ios-green: #34C759;
  --ios-orange: #FF9500;
  --ios-red: #FF3B30;
  --ios-blue: #007AFF;
}

/* Base Smoothing */
html {
  scroll-behavior: smooth;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
  background-color: var(--zems-canvas);
  color: var(--zems-charcoal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  width: 100%;
  position: relative;
}

/* Ensure images never overflow container */
img, svg, video {
  max-width: 100%;
  height: auto;
}

/* Touch scrolling for mobile table and list containers */
.overflow-x-auto, .overflow-y-auto {
  -webkit-overflow-scrolling: touch;
}

/* Prevent iOS Safari unwanted auto-zoom on form focus while keeping compact look on desktop */
@media screen and (max-width: 640px) {
  .hig-input, input, select, textarea {
    font-size: 16px !important;
  }
}

/* Custom Minimalist Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #D1D5DB;
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #9CA3AF;
}

/* iOS Widget Squircle Card Styling */
.hig-card {
  background: #FFFFFF;
  border: 1px solid var(--zems-border);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease;
  will-change: transform;
}

.hig-card:hover {
  border-color: #D1D5DB;
  box-shadow: 0 12px 30px -4px rgba(0, 0, 0, 0.07), 0 4px 12px -2px rgba(0, 0, 0, 0.02);
}

/* 3D Tilt Card Container */
.tilt-card {
  transform-style: preserve-3d;
  transition: transform 0.15s ease-out, box-shadow 0.25s ease;
  will-change: transform;
}

/* Scroll Reveal States */
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.reveal-on-scroll.is-revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Delays for Staggered Grids */
.reveal-delay-100 { transition-delay: 100ms; }
.reveal-delay-200 { transition-delay: 200ms; }
.reveal-delay-300 { transition-delay: 300ms; }
.reveal-delay-400 { transition-delay: 400ms; }

/* Gentle Floating Micro-Animation */
@keyframes floatSlow {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-8px);
  }
}

.animate-float-slow {
  animation: floatSlow 5s ease-in-out infinite;
}

.animate-float-delayed {
  animation: floatSlow 6s ease-in-out infinite;
  animation-delay: 2.5s;
}

/* Range Slider */
input[type="range"].loan-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 9999px;
  background: #E5E7EB;
  outline: none;
  cursor: pointer;
}

input[type="range"].loan-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #C5A869;
  cursor: grab;
  border: 2.5px solid #FFFFFF;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  transition: transform 0.15s ease, background-color 0.15s ease;
}

input[type="range"].loan-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  background: #B49553;
}

input[type="range"].loan-slider::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.25);
}

/* Input Fields */
.hig-input {
  background: #F9FAFB;
  border: 1px solid var(--zems-border);
  color: #111827;
  border-radius: 0.75rem;
  transition: all 0.15s ease;
}

.hig-input:focus {
  outline: none;
  background: #FFFFFF;
  border-color: var(--zems-navy);
  box-shadow: 0 0 0 2px rgba(11, 21, 40, 0.08);
}

/* iOS Status Badges */
.badge-active {
  background-color: #ECFDF5;
  color: #047857;
  border: 1px solid #A7F3D0;
}

.badge-pending {
  background-color: #FFFBEB;
  color: #B45309;
  border: 1px solid #FDE68A;
}

.badge-overdue {
  background-color: #FEF2F2;
  color: #B91C1C;
  border: 1px solid #FECACA;
}

.badge-settled {
  background-color: #EFF6FF;
  color: #1D4ED8;
  border: 1px solid #BFDBFE;
}

.badge-declined {
  background-color: #F3F4F6;
  color: #4B5563;
  border: 1px solid #E5E7EB;
}

/* Subtle Shimmer for High-Priority CTAs */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.btn-shimmer {
  background: linear-gradient(90deg, #0B1528 0%, #1A263D 50%, #0B1528 100%);
  background-size: 200% 100%;
  animation: shimmer 4s ease infinite;
}
