/* ==========================================================================
   Tarazino - Luxury White & Purple Aesthetic Design System
   Inspired by landkhooneh.com: Pure White, Royal Purple, Crisp Typography & Squircles
   ========================================================================== */

@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-Medium.ttf') format('truetype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-Black.ttf') format('truetype');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

img, svg {
  max-width: 100%;
}

#tarazis-splash img,
header img,
#modal-onboarding img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

:root {
  --font-sans: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  
  --bg-app: #F8F9FE;
  --bg-card: #FFFFFF;
  --bg-card-elevated: #FAF8FF;
  
  --purple-deep: #1E1338;
  --purple-text: #2D1F4B;
  --purple-muted: #6B5E85;
  
  --purple-primary: #7C1ED4;
  --purple-vibrant: #9333EA;
  --purple-accent: #A855F7;
  --purple-soft: #FAF5FF;
  --purple-border: #E9D5FF;
  --purple-border-light: #F3E8FF;
  
  --purple-gradient: linear-gradient(135deg, #7C1ED4 0%, #9333EA 50%, #A855F7 100%);
  --purple-gradient-subtle: linear-gradient(135deg, #FAF5FF 0%, #F5EDFF 100%);
  --purple-glow: rgba(124, 30, 212, 0.22);
  
  --radius-sm: 14px;
  --radius-md: 20px;
  --radius-lg: 28px;
  --radius-xl: 36px;
  --radius-full: 9999px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

input, textarea {
  user-select: auto;
}

body, input, textarea, select, button, .font-sans {
  font-family: var(--font-sans);
  font-feature-settings: "ss01" 1, "locl" 1;
  -webkit-font-feature-settings: "ss01" 1, "locl" 1;
}

html, body {
  margin: 0;
  padding: 0;
  background-color: #F8F9FE !important;
  color: var(--purple-text);
  direction: rtl;
  text-align: right;
  overflow-x: hidden;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

/* Absolute Scrollbar Annihilation (Eliminates the purple line / scrollbar completely on all platforms) */
*, *::before, *::after {
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

*::-webkit-scrollbar {
  display: none !important;
  width: 0px !important;
  height: 0px !important;
  background: transparent !important;
  opacity: 0 !important;
}

*::-webkit-scrollbar-thumb {
  display: none !important;
  background: transparent !important;
}

*::-webkit-scrollbar-track {
  display: none !important;
  background: transparent !important;
}

/* Scroll Lock on Modals (Locks scrolling WITHOUT jumping or resetting scroll position) */
body.modal-open {
  overflow: hidden !important;
  touch-action: none !important;
  overscroll-behavior: none !important;
}

/* Safe Area Insets for Notch & Status Bar & Bottom Navigation (No giant void) */
.main-content-container {
  padding-top: 10px !important;
  padding-bottom: calc(75px + env(safe-area-inset-bottom, 10px)) !important;
}

/* White & Purple Cards */
.oneui-card {
  background: var(--bg-card);
  border: 1px solid var(--purple-border-light);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 20px -2px rgba(124, 30, 212, 0.05), 0 1px 3px 0 rgba(0, 0, 0, 0.02);
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.2s ease, border-color 0.2s ease;
}

.oneui-card:hover {
  border-color: var(--purple-border);
  box-shadow: 0 8px 24px -4px rgba(124, 30, 212, 0.08);
}

.oneui-btn-primary {
  background: var(--purple-gradient);
  color: #FFFFFF;
  border-radius: var(--radius-full);
  font-weight: 700;
  box-shadow: 0 6px 20px var(--purple-glow);
  transition: all 0.15s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.oneui-btn-primary:active {
  transform: scale(0.96);
  box-shadow: 0 2px 8px var(--purple-glow);
}

/* Now Bar Pill (کپسول هوشمند زنده) */
.now-bar {
  background: var(--purple-gradient-subtle);
  border: 1px solid var(--purple-border);
  border-radius: var(--radius-full);
  box-shadow: 0 6px 20px -4px rgba(124, 30, 212, 0.08);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.now-bar:active {
  transform: scale(0.98);
}

/* Keypad Grid for Fast Expense Entry */
.keypad-btn {
  background: #FFFFFF;
  border: 1px solid var(--purple-border-light);
  border-radius: var(--radius-md);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--purple-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 54px;
  box-shadow: 0 2px 6px rgba(124, 30, 212, 0.04);
  transition: all 0.12s ease;
}

.keypad-btn:active {
  transform: scale(0.92);
  background: var(--purple-soft);
  border-color: var(--purple-primary);
}

/* Category squircle chips */
.category-chip {
  border-radius: var(--radius-md);
  border: 1px solid var(--purple-border-light);
  background: #FFFFFF;
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.category-chip.selected {
  border-color: var(--purple-primary);
  background: var(--purple-soft);
  box-shadow: 0 0 12px rgba(124, 30, 212, 0.15);
}

/* Custom Styled Dropdown (حل مشکل دراپ‌داون ساده) */
.custom-select-trigger {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: #FFFFFF;
  border: 1.5px solid var(--purple-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px -2px rgba(124, 30, 212, 0.06);
}

.custom-select-trigger:hover,
.custom-select-trigger.active {
  border-color: var(--purple-primary);
  box-shadow: 0 0 0 3px rgba(124, 30, 212, 0.12);
}

.custom-select-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #FFFFFF;
  border: 1.5px solid var(--purple-border);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 36px rgba(30, 19, 56, 0.15);
  z-index: 70;
  max-height: 240px;
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.custom-select-menu.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.custom-select-option {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  border-bottom: 1px solid var(--purple-border-light);
  transition: background 0.15s ease;
}

.custom-select-option:last-child {
  border-bottom: none;
}

.custom-select-option:hover,
.custom-select-option.selected {
  background: var(--purple-soft);
}

/* Virtual Credit Card Mini Preview */
.virtual-card {
  border-radius: var(--radius-md);
  padding: 14px;
  color: #FFFFFF;
  position: relative;
  overflow: hidden;
  box-shadow: 0 6px 20px -2px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease;
}

.virtual-card:hover {
  transform: translateY(-2px);
}

.virtual-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 70%);
  pointer-events: none;
}

/* ======================================================== */
/* ======================================================== */
/* FLAGSHIP DOCKED ONE UI 8.5 NAVIGATION BAR (True Glassmorphism Dock) */
/* ======================================================== */
.bottom-nav {
  position: fixed;
  bottom: max(12px, env(safe-area-inset-bottom, 12px));
  left: 14px;
  right: 14px;
  width: calc(100% - 28px);
  max-width: 440px;
  height: 64px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.76) !important;
  backdrop-filter: blur(28px) saturate(210%) !important;
  -webkit-backdrop-filter: blur(28px) saturate(210%) !important;
  border: 1px solid rgba(255, 255, 255, 0.95) !important;
  border-top: 1.5px solid rgba(255, 255, 255, 1) !important;
  border-radius: 32px !important;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 5px 8px;
  z-index: 45;
  box-shadow: 0 10px 30px -4px rgba(124, 30, 212, 0.08), 0 2px 6px rgba(0, 0, 0, 0.02), inset 0 1px 1px rgba(255, 255, 255, 0.95) !important;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
}

.nav-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  height: 50px;
  color: #64748B;
  font-size: 0.72rem;
  font-weight: 700;
  gap: 2px;
  padding: 4px 8px;
  border-radius: 24px;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  position: relative;
  border: none;
  background: transparent;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.nav-tab .nav-icon {
  width: 20px;
  height: 20px;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-tab span {
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  letter-spacing: -0.01em;
}

/* Luxury Modern Frosted Glass Active Capsule */
.nav-tab.active {
  background: rgba(124, 30, 212, 0.12) !important;
  color: #7C1ED4 !important;
  border: 1px solid rgba(124, 30, 212, 0.2) !important;
  box-shadow: 0 4px 14px rgba(124, 30, 212, 0.08), inset 0 1px 1px rgba(255, 255, 255, 0.9) !important;
  transform: scale(1.02);
}

.nav-tab.active .nav-icon {
  color: #7C1ED4 !important;
  background: transparent !important;
  padding: 0;
  transform: scale(1.08);
}

.nav-tab.active span {
  color: #7C1ED4 !important;
  font-weight: 900 !important;
}

/* Inactive Hover & Tap Effect */
.nav-tab:not(.active):hover {
  color: #7C1ED4;
  background: rgba(124, 30, 212, 0.04);
}

.nav-tab:not(.active):active {
  transform: scale(0.95);
  background: rgba(124, 30, 212, 0.06);
}

/* Virtual Cards Persian Typography */
.virtual-card,
.virtual-card * {
  font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, sans-serif !important;
  font-feature-settings: "ss01" 1, "locl" 1 !important;
}

/* Modal Bottom Sheets - Zero Shadow when Closed (Fixes bottom dark bar bug) */
.modal-bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 600px;
  margin: 0 auto;
  background: #FFFFFF;
  border-radius: 34px 34px 0 0;
  border-top: 1px solid var(--purple-border);
  z-index: 60;
  transform: translateY(100%);
  visibility: hidden;
  pointer-events: none;
  opacity: 0;
  box-shadow: none !important;
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease, visibility 0.32s;
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.modal-bottom-sheet.open {
  transform: translateY(0);
  visibility: visible;
  pointer-events: auto;
  opacity: 1;
  box-shadow: 0 -12px 36px rgba(124, 30, 212, 0.16) !important;
}

.modal-bottom-sheet.modal-fullscreen {
  height: 100%;
  max-height: 100vh;
  max-height: 100dvh;
  border-radius: 0;
  top: 0;
  bottom: 0;
  z-index: 80;
}

.z-70 { z-index: 70 !important; }
.z-80 { z-index: 80 !important; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(30, 19, 56, 0.4);
  backdrop-filter: blur(6px);
  z-index: 55;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

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

.sheet-handle {
  width: 44px;
  height: 5px;
  background: #D8B4FE;
  border-radius: 999px;
  margin: 12px auto 6px auto;
}

/* Animations */
.animate-pulse-subtle {
  animation: pulse-subtle 3s infinite ease-in-out;
}

@keyframes pulse-subtle {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.85;
    transform: scale(0.98);
  }
}

/* Landkhooneh Luxury Royal Purple Primary Action Button (Fixed Hover) */
.btn-tarazis-primary {
  background: linear-gradient(135deg, #7C1ED4 0%, #6815B6 100%) !important;
  color: #FFFFFF !important;
  box-shadow: 0 4px 14px rgba(124, 30, 212, 0.3) !important;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
  border: none !important;
  text-decoration: none !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-tarazis-primary:hover {
  background: linear-gradient(135deg, #6815B6 0%, #520F92 100%) !important;
  box-shadow: 0 6px 20px rgba(124, 30, 212, 0.45) !important;
  color: #FFFFFF !important;
  transform: translateY(-1px);
}

.btn-tarazis-primary:active {
  transform: scale(0.97) translateY(0) !important;
  box-shadow: 0 2px 8px rgba(124, 30, 212, 0.2) !important;
}

/* Loan Filter Tabs */
.loan-filter-btn {
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.loan-filter-btn.active {
  background: #7C1ED4 !important;
  color: #FFFFFF !important;
  box-shadow: 0 3px 12px rgba(124, 30, 212, 0.3) !important;
}

/* Custom Account Type Pill */
.acc-type-pill {
  transition: all 0.18s ease;
}

.acc-type-pill.active {
  background: #7C1ED4 !important;
  color: #FFFFFF !important;
  border-color: #7C1ED4 !important;
  box-shadow: 0 2px 8px rgba(124, 30, 212, 0.25) !important;
}

/* ======================================================== */
/* FLUID TAB TRANSITIONS (One UI 7 / iOS 18 Micro-Spring)  */
/* ======================================================== */
.tab-content {
  display: none;
  opacity: 0;
  will-change: opacity, transform;
}

.tab-content.active {
  display: block;
  animation: tabFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes tabFadeIn {
  0% {
    opacity: 0;
    transform: translateY(14px) scale(0.99);
    filter: blur(4px);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

/* ======================================================== */
/* HIGH-Z-INDEX ULTRA TOAST (Always Above Modals, No Wrap) */
/* ======================================================== */
#oneui-toast {
  z-index: 99999 !important;
  max-width: 92vw !important;
  white-space: nowrap !important;
  box-shadow: 0 14px 40px -4px rgba(124, 30, 212, 0.25), 0 4px 12px rgba(0, 0, 0, 0.08) !important;
}

/* Amount Input Formatting (Natural Persian Input Caret Alignment) */
.amount-input-field {
  font-family: 'Vazirmatn', sans-serif !important;
  direction: ltr !important;
  text-align: center !important;
}

/* ======================================================== */
/* CINEMATIC FLAGSHIP SPLASH SCREEN                         */
/* ======================================================== */
#tarazis-splash {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: linear-gradient(180deg, #FDFBFF 0%, #F5F1FD 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.5s;
}

#tarazis-splash.hidden-splash {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* ======================================================== */
/* OLED LUXURY DARK MODE STYLES                             */
/* ======================================================== */
body.dark-mode {
  background-color: #0C0816 !important;
  color: #F1EDFC !important;
}

body.dark-mode .bg-[#F8F9FE],
body.dark-mode .bg-white {
  background-color: #150F24 !important;
}

body.dark-mode .oneui-card {
  background-color: #171028 !important;
  border-color: rgba(147, 51, 234, 0.2) !important;
  box-shadow: 0 6px 24px -2px rgba(0, 0, 0, 0.5) !important;
}

body.dark-mode .text-[#1E1338],
body.dark-mode .text-purple-950 {
  color: #F3EEFF !important;
}

body.dark-mode .text-slate-800,
body.dark-mode .text-slate-700 {
  color: #E2D9F3 !important;
}

body.dark-mode .text-slate-500,
body.dark-mode .text-slate-600 {
  color: #A79BC2 !important;
}

body.dark-mode .border-purple-100,
body.dark-mode .border-purple-200,
body.dark-mode .border-purple-50 {
  border-color: rgba(147, 51, 234, 0.22) !important;
}

body.dark-mode .bg-purple-50,
body.dark-mode .bg-slate-50 {
  background-color: #1E1535 !important;
}

body.dark-mode .modal-bottom-sheet {
  background-color: #171028 !important;
  border-top-color: rgba(168, 85, 247, 0.3) !important;
  color: #F3EEFF !important;
}

body.dark-mode input,
body.dark-mode select {
  background-color: #1F1636 !important;
  color: #FFFFFF !important;
  border-color: rgba(147, 51, 234, 0.3) !important;
}

body.dark-mode .bottom-nav {
  background: rgba(21, 15, 36, 0.85) !important;
  border-color: rgba(147, 51, 234, 0.3) !important;
  border-top-color: rgba(192, 132, 252, 0.35) !important;
  box-shadow: 0 10px 30px -4px rgba(0, 0, 0, 0.7) !important;
}

body.dark-mode .nav-tab {
  color: #A396BF;
}

body.dark-mode .nav-tab.active {
  background: rgba(147, 51, 234, 0.2) !important;
  color: #C084FC !important;
  border-color: rgba(192, 132, 252, 0.3) !important;
}

body.dark-mode .nav-tab.active .nav-icon {
  color: #C084FC !important;
}

body.dark-mode .nav-tab.active span {
  color: #C084FC !important;
}

body.dark-mode #tarazis-splash {
  background: #0C0816 !important;
}
