/* ============================================
   FinScope Design System v1.0
   فین اسکوپ - ابزارهای مالی حرفه‌ای
   ============================================ */

/* === FONTS === */
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800;900&display=swap');

/* === CSS VARIABLES === */
:root {
  /* Background */
  --bg-primary: #06080f;
  --bg-secondary: #0c1021;
  --bg-tertiary: #111733;
  
  /* Glass */
  --glass-bg: rgba(15, 22, 50, 0.6);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-hover: rgba(25, 35, 70, 0.7);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  
  /* Accent Colors */
  --accent-green: #22c55e;
  --accent-green-light: #4ade80;
  --accent-teal: #00d4aa;
  --accent-gold: #f0b90b;
  --accent-purple: #7b61ff;
  --accent-pink: #ff4f8c;
  
  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #22c55e, #4ade80);
  --gradient-gold: linear-gradient(135deg, #f0b90b, #ff8c00);
  --gradient-teal: linear-gradient(135deg, #00d4aa, #22c55e);
  --gradient-purple: linear-gradient(135deg, #7b61ff, #22c55e);
  --gradient-bg: radial-gradient(ellipse at 20% 50%, rgba(34, 197, 94, 0.08) 0%, transparent 50%),
                    radial-gradient(ellipse at 80% 20%, rgba(74, 222, 128, 0.06) 0%, transparent 50%),
                    radial-gradient(ellipse at 50% 80%, rgba(0, 212, 170, 0.04) 0%, transparent 50%);
  
  /* Text */
  --text-primary: #e8eaf0;
  --text-secondary: #8890a8;
  --text-muted: #555a70;
  --text-accent: #22c55e;
  
  /* Input */
  --input-bg: rgba(10, 14, 30, 0.7);
  --input-border: rgba(255, 255, 255, 0.08);
  --input-focus: rgba(34, 197, 94, 0.3);
  
  /* Sizing */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  
  /* Transitions */
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Spacing */
  --container-max: 900px;
  --section-gap: 3rem;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Vazirmatn', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  direction: rtl;
  text-align: right;
  line-height: 1.8;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: var(--gradient-bg);
  pointer-events: none;
  z-index: 0;
}

/* === ANIMATED BACKGROUND PARTICLES === */
.bg-particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.bg-particles .orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.3;
  animation: orbFloat 20s ease-in-out infinite;
}

.bg-particles .orb:nth-child(1) {
  width: 400px; height: 400px;
  background: var(--accent-green);
  top: -100px; right: -100px;
  animation-delay: 0s;
}
.bg-particles .orb:nth-child(2) {
  width: 300px; height: 300px;
  background: var(--accent-purple);
  bottom: -50px; left: -50px;
  animation-delay: -7s;
  animation-duration: 25s;
}
.bg-particles .orb:nth-child(3) {
  width: 250px; height: 250px;
  background: var(--accent-teal);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -14s;
  animation-duration: 30s;
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(30px, -40px) scale(1.05); }
  50% { transform: translate(-20px, 20px) scale(0.95); }
  75% { transform: translate(40px, 30px) scale(1.02); }
}

/* === LAYOUT === */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 1.5rem;
  position: relative;
  z-index: 1;
}

/* === HEADER / NAVBAR === */
.finscope-header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 1rem 0;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  background: rgba(6, 8, 15, 0.75);
  border-bottom: 1px solid var(--glass-border);
  transition: var(--transition-normal);
}

.finscope-header .header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--text-primary);
}

.brand-logo {
  width: 38px;
  height: 38px;
  background: var(--gradient-primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.1rem;
  color: #fff;
  box-shadow: 0 4px 15px rgba(34, 197, 94, 0.3);
  transition: var(--transition-normal);
}

.brand:hover .brand-logo {
  transform: rotate(-5deg) scale(1.05);
  box-shadow: 0 6px 25px rgba(34, 197, 94, 0.4);
}

.brand-name {
  font-size: 1.2rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.brand-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: -2px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-primary);
  background: rgba(34, 197, 94, 0.1);
}

/* === PAGE HERO === */
.page-hero {
  text-align: center;
  padding: 3rem 0 2rem;
}

.page-hero .hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.2);
  border-radius: 100px;
  padding: 0.35rem 1rem;
  font-size: 0.78rem;
  color: var(--accent-green-light);
  font-weight: 500;
  margin-bottom: 1.2rem;
  animation: fadeInDown 0.6s ease;
}

.page-hero h1 {
  font-size: 2.2rem;
  font-weight: 900;
  line-height: 1.4;
  margin-bottom: 0.8rem;
  animation: fadeInDown 0.6s ease 0.1s both;
}

.page-hero h1 .highlight {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-hero p {
  color: var(--text-secondary);
  font-size: 1rem;
  max-width: 600px;
  margin: 0 auto;
  animation: fadeInDown 0.6s ease 0.2s both;
}

/* === GLASS CARD === */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--glass-shadow);
  transition: var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.glass-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
}

.glass-card:hover {
  background: var(--glass-hover);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
  transform: translateY(-2px);
}

.glass-card + .glass-card {
  margin-top: 1.5rem;
}

/* === FORM ELEMENTS === */
.form-group {
  margin-bottom: 1.2rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
  transition: var(--transition-fast);
}

.form-group:focus-within label {
  color: var(--accent-green-light);
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper input,
.input-wrapper select,
.input-wrapper textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--input-bg);
  border: 1.5px solid var(--input-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  transition: var(--transition-normal);
  outline: none;
  direction: ltr;
  text-align: left;
}

.input-wrapper input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

.input-wrapper input:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.input-wrapper input:focus,
.input-wrapper select:focus,
.input-wrapper textarea:focus {
  border-color: var(--accent-green);
  box-shadow: 0 0 0 3px var(--input-focus), 0 0 20px rgba(34, 197, 94, 0.1);
}

.input-unit {
  position: absolute;
  left: 1rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  pointer-events: none;
}

.input-wrapper input.has-unit {
  padding-left: 3.5rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem 2rem;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
  opacity: 0;
  transition: var(--transition-fast);
}

.btn:hover::before {
  opacity: 1;
}

.btn-primary {
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: 0 4px 20px rgba(34, 197, 94, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(34, 197, 94, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(34, 197, 94, 0.1);
  color: var(--accent-green);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.btn-secondary:hover {
  background: rgba(34, 197, 94, 0.2);
  border-color: rgba(34, 197, 94, 0.4);
}

.btn-gold {
  background: var(--gradient-gold);
  color: #000;
  box-shadow: 0 4px 20px rgba(240, 185, 11, 0.3);
}

.btn-gold:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(240, 185, 11, 0.4);
}

.btn-group {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* === RESULT SECTION === */
.result-container {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--glass-border);
  animation: fadeInUp 0.5s ease;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.result-item {
  background: rgba(10, 14, 30, 0.5);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 1.2rem;
  text-align: center;
  transition: var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.result-item::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-primary);
  transform: scaleX(0);
  transition: transform 0.4s ease;
}

.result-item:hover::after {
  transform: scaleX(1);
}

.result-item:hover {
  border-color: rgba(34, 197, 94, 0.2);
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.result-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 0.4rem;
}

.result-value {
  font-size: 1.5rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  direction: ltr;
}

.result-value.gold {
  background: var(--gradient-gold);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.result-value.teal {
  background: var(--gradient-teal);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* === EDUCATION / INFO SECTION === */
.edu-section {
  margin-top: var(--section-gap);
}

.edu-section h2 {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.edu-section h2 .icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.edu-block {
  background: rgba(15, 22, 50, 0.4);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 1rem;
  transition: var(--transition-normal);
}

.edu-block:hover {
  border-color: rgba(34, 197, 94, 0.15);
}

.edu-block h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
  color: var(--accent-green-light);
}

.edu-block p,
.edu-block li {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.9;
}

.edu-block ul {
  list-style: none;
  padding: 0;
}

.edu-block ul li {
  padding-right: 1.2rem;
  position: relative;
  margin-bottom: 0.3rem;
}

.edu-block ul li::before {
  content: '◆';
  position: absolute;
  right: 0;
  color: var(--accent-green);
  font-size: 0.5rem;
  top: 0.5em;
}

.formula-box {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(34, 197, 94, 0.15);
  border-radius: var(--radius-sm);
  padding: 1rem 1.5rem;
  margin: 0.8rem 0;
  font-family: 'Courier New', monospace;
  font-size: 0.95rem;
  color: var(--accent-green-light);
  direction: ltr;
  text-align: center;
  letter-spacing: 1px;
  overflow-x: auto;
}

/* === TOOL CARDS (Index Page) === */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.2rem;
  margin-top: 2rem;
}

.tool-card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-decoration: none;
  color: inherit;
  transition: var(--transition-normal);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.tool-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-primary);
  transform: scaleX(0);
  transition: transform 0.4s ease;
  transform-origin: right;
}

.tool-card:hover::before {
  transform: scaleX(1);
}

.tool-card:hover {
  transform: translateY(-6px);
  border-color: rgba(34, 197, 94, 0.2);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4), 0 0 30px rgba(34, 197, 94, 0.08);
}

.tool-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.tool-card-icon.blue { background: rgba(34, 197, 94, 0.15); }
.tool-card-icon.gold { background: rgba(240, 185, 11, 0.15); }
.tool-card-icon.teal { background: rgba(0, 212, 170, 0.15); }
.tool-card-icon.purple { background: rgba(123, 97, 255, 0.15); }
.tool-card-icon.pink { background: rgba(255, 79, 140, 0.15); }

.tool-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
}

.tool-card p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.tool-card .card-arrow {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: var(--accent-green);
  font-weight: 600;
  transition: var(--transition-fast);
}

.tool-card:hover .card-arrow {
  gap: 0.6rem;
}

/* === CATEGORY SECTION === */
.category-section {
  margin-bottom: 3rem;
}

.category-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.category-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--glass-border);
  margin-right: 1rem;
}

/* === ANIMATIONS === */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-15px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes countUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 20px rgba(34, 197, 94, 0.1); }
  50% { box-shadow: 0 0 40px rgba(34, 197, 94, 0.2); }
}

.animate-in {
  animation: fadeInUp 0.5s ease both;
}

.animate-in:nth-child(1) { animation-delay: 0.05s; }
.animate-in:nth-child(2) { animation-delay: 0.1s; }
.animate-in:nth-child(3) { animation-delay: 0.15s; }
.animate-in:nth-child(4) { animation-delay: 0.2s; }
.animate-in:nth-child(5) { animation-delay: 0.25s; }
.animate-in:nth-child(6) { animation-delay: 0.3s; }

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

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: rgba(34, 197, 94, 0.2);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(34, 197, 94, 0.4);
}

/* === TOOLTIP / HELP TEXT === */
.help-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

/* === TABS === */
.tabs {
  display: flex;
  gap: 0.3rem;
  padding: 0.3rem;
  background: rgba(10, 14, 30, 0.5);
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  border: 1px solid var(--glass-border);
}

.tab-btn {
  flex: 1;
  padding: 0.6rem 1rem;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}

.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: 0 2px 10px rgba(34, 197, 94, 0.3);
}

/* === FOOTER === */
.finscope-footer {
  text-align: center;
  padding: 2rem 0;
  margin-top: 4rem;
  border-top: 1px solid var(--glass-border);
  color: var(--text-muted);
  font-size: 0.8rem;
}

.finscope-footer a {
  color: var(--accent-green);
  text-decoration: none;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .tools-grid {
    grid-template-columns: 1fr;
  }
  
  .result-grid {
    grid-template-columns: 1fr 1fr;
  }
  
  .page-hero h1 {
    font-size: 1.6rem;
  }
  
  .glass-card {
    padding: 1.5rem;
  }
  
  .nav-links {
    display: none;
  }
  
  .header-inner {
    flex-direction: column;
    gap: 0.5rem;
  }
}

@media (max-width: 480px) {
  .result-grid {
    grid-template-columns: 1fr;
  }
  
  html {
    font-size: 14px;
  }
}

/* === NUMBER ANIMATION === */
.animated-number {
  display: inline-block;
  transition: var(--transition-normal);
}

/* === BACK TO TOP === */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--gradient-primary);
  border: none;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(20px);
  transition: var(--transition-normal);
  z-index: 99;
  box-shadow: 0 4px 15px rgba(34, 197, 94, 0.3);
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
}

.back-to-top:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(34, 197, 94, 0.4);
}

/* === SELECTION === */
::selection {
  background: rgba(34, 197, 94, 0.3);
  color: #fff;
}