/* SmartInvoiceGen Custom Styles — CSS-Only Animations */

/* ========== BASE ========== */
html {
  scroll-behavior: smooth;
}

/* Custom scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #F8FAFC; }
::-webkit-scrollbar-thumb { background: #94A3B8; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #64748B; }

/* ========== ENTRANCE ANIMATIONS (CSS-only, no JS) ========== */

/* Fade-in-up — triggers on page load via animation */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

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

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

/* Base animation class — applied to elements that should animate on load */
.anim-fade-up {
  animation: fadeInUp 0.7s ease-out both;
}

.anim-fade-in {
  animation: fadeIn 0.7s ease-out both;
}

.anim-scale-in {
  animation: scaleIn 0.6s ease-out both;
}

.anim-slide-right {
  animation: slideInRight 0.6s ease-out both;
}

/* Staggered delays for sequential animation */
.anim-delay-1  { animation-delay: 0.1s; }
.anim-delay-2  { animation-delay: 0.2s; }
.anim-delay-3  { animation-delay: 0.3s; }
.anim-delay-4  { animation-delay: 0.4s; }
.anim-delay-5  { animation-delay: 0.5s; }
.anim-delay-6  { animation-delay: 0.6s; }
.anim-delay-7  { animation-delay: 0.7s; }
.anim-delay-8  { animation-delay: 0.8s; }
.anim-delay-9  { animation-delay: 0.9s; }
.anim-delay-10 { animation-delay: 1.0s; }

/* Stagger container — children animate sequentially */
.stagger > * {
  animation: fadeInUp 0.5s ease-out both;
}
.stagger > *:nth-child(1)  { animation-delay: 0.05s; }
.stagger > *:nth-child(2)  { animation-delay: 0.15s; }
.stagger > *:nth-child(3)  { animation-delay: 0.25s; }
.stagger > *:nth-child(4)  { animation-delay: 0.35s; }
.stagger > *:nth-child(5)  { animation-delay: 0.45s; }
.stagger > *:nth-child(6)  { animation-delay: 0.55s; }
.stagger > *:nth-child(7)  { animation-delay: 0.65s; }
.stagger > *:nth-child(8)  { animation-delay: 0.75s; }
.stagger > *:nth-child(9)  { animation-delay: 0.85s; }
.stagger > *:nth-child(10) { animation-delay: 0.95s; }

/* Keep old classes for backward compatibility — now driven by CSS animation */
.fade-in {
  animation: fadeInUp 0.7s ease-out both;
}

.stagger-children > * {
  animation: fadeInUp 0.5s ease-out both;
}
.stagger-children > *:nth-child(1)  { animation-delay: 0.05s; }
.stagger-children > *:nth-child(2)  { animation-delay: 0.15s; }
.stagger-children > *:nth-child(3)  { animation-delay: 0.25s; }
.stagger-children > *:nth-child(4)  { animation-delay: 0.35s; }
.stagger-children > *:nth-child(5)  { animation-delay: 0.45s; }
.stagger-children > *:nth-child(6)  { animation-delay: 0.55s; }

/* Card entrance — used standalone or inside stagger containers */
.animate-card {
  animation: fadeInUp 0.6s ease-out both;
}

/* ========== HERO PARTICLES (CSS-only) ========== */
.particles-container {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.particle {
  position: absolute;
  font-size: 24px;
  animation: floatParticle linear infinite;
  opacity: 0;
}

/* Create 15 static particles via CSS — each with unique position/delay/duration */
.particle:nth-child(1)  { left: 5%;  animation-duration: 14s; animation-delay: 0s; font-size: 20px; }
.particle:nth-child(2)  { left: 12%; animation-duration: 18s; animation-delay: 2s; font-size: 26px; }
.particle:nth-child(3)  { left: 22%; animation-duration: 12s; animation-delay: 4s; font-size: 18px; }
.particle:nth-child(4)  { left: 30%; animation-duration: 16s; animation-delay: 1s; font-size: 28px; }
.particle:nth-child(5)  { left: 40%; animation-duration: 20s; animation-delay: 5s; font-size: 22px; }
.particle:nth-child(6)  { left: 48%; animation-duration: 13s; animation-delay: 3s; font-size: 24px; }
.particle:nth-child(7)  { left: 55%; animation-duration: 17s; animation-delay: 0s; font-size: 20px; }
.particle:nth-child(8)  { left: 62%; animation-duration: 15s; animation-delay: 6s; font-size: 30px; }
.particle:nth-child(9)  { left: 70%; animation-duration: 19s; animation-delay: 2s; font-size: 18px; }
.particle:nth-child(10) { left: 78%; animation-duration: 14s; animation-delay: 4s; font-size: 22px; }
.particle:nth-child(11) { left: 85%; animation-duration: 16s; animation-delay: 1s; font-size: 26px; }
.particle:nth-child(12) { left: 92%; animation-duration: 11s; animation-delay: 7s; font-size: 20px; }
.particle:nth-child(13) { left: 15%; animation-duration: 18s; animation-delay: 8s; font-size: 24px; }
.particle:nth-child(14) { left: 35%; animation-duration: 13s; animation-delay: 3s; font-size: 28px; }
.particle:nth-child(15) { left: 50%; animation-duration: 21s; animation-delay: 5s; font-size: 16px; }

/* Alternate animation direction for variety */
.particle:nth-child(odd)  { animation-name: floatParticle; }
.particle:nth-child(even) { animation-name: floatParticleAlt; }

@keyframes floatParticle {
  0%   { transform: translateY(0) translateX(0) rotate(0deg); opacity: 0; }
  10%  { opacity: 0.1; }
  90%  { opacity: 0.1; }
  100% { transform: translateY(-110vh) translateX(40px) rotate(360deg); opacity: 0; }
}

@keyframes floatParticleAlt {
  0%   { transform: translateY(0) translateX(0) rotate(0deg); opacity: 0; }
  10%  { opacity: 0.08; }
  90%  { opacity: 0.08; }
  100% { transform: translateY(-110vh) translateX(-30px) rotate(-360deg); opacity: 0; }
}

/* ========== CARD & BUTTON EFFECTS ========== */
.card-hover {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.btn-pulse {
  animation: btnPulse 2s infinite;
}

@keyframes btnPulse {
  0%   { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4); }
  70%  { box-shadow: 0 0 0 15px rgba(37, 99, 235, 0); }
  100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

/* ========== FAQ — Native <details>/<summary> Accordion ========== */
details.faq-item {
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  overflow: hidden;
  background: white;
  margin-bottom: 4px;
  transition: border-color 0.2s;
}
details.faq-item[open] {
  border-color: #2563EB;
}
details.faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  font-weight: 500;
  color: #1E293B;
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: color 0.2s;
}
details.faq-item summary:hover {
  color: #2563EB;
}
details.faq-item summary::-webkit-details-marker {
  display: none;
}
details.faq-item summary::after {
  content: '+';
  font-size: 22px;
  font-weight: 700;
  color: #2563EB;
  flex-shrink: 0;
  margin-left: 16px;
  transition: transform 0.25s ease;
}
details.faq-item[open] summary::after {
  content: '\2212';
  transform: rotate(0deg);
}
details.faq-item .faq-body {
  padding: 0 24px 20px;
  font-size: 14px;
  color: #64748B;
  line-height: 1.7;
}

/* ========== NAVBAR SCROLL (CSS-only) ========== */
#navbar {
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

/* ========== INVOICE PREVIEW STYLES ========== */
.invoice-preview {
  background: white;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  padding: 32px;
  font-family: 'Segoe UI', system-ui, sans-serif;
  color: #1E293B;
  font-size: 14px;
  line-height: 1.6;
}
.invoice-preview h2 {
  font-size: 28px;
  font-weight: 700;
  color: #1E293B;
  margin-bottom: 8px;
}
.invoice-preview table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
}
.invoice-preview table th {
  background: #2563EB;
  color: white;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.invoice-preview table td {
  padding: 10px 12px;
  border-bottom: 1px solid #E2E8F0;
  font-size: 13px;
}
.invoice-preview table tr:last-child td {
  border-bottom: none;
}
.invoice-preview .total-row {
  font-weight: 700;
  font-size: 16px;
  color: #2563EB;
}
.invoice-preview .preview-logo {
  max-width: 120px;
  max-height: 60px;
  object-fit: contain;
}

/* ========== FORMS & UPLOAD ========== */
.logo-upload-area {
  border: 2px dashed #CBD5E1;
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}
.logo-upload-area:hover {
  border-color: #2563EB;
  background-color: #EFF6FF;
}
.logo-upload-area.has-logo {
  border-style: solid;
  border-color: #22C55E;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #2563EB;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ========== PRINT STYLES ========== */
@media print {
  body * { visibility: hidden; }
  .print-area, .print-area * { visibility: visible; }
  .print-area { position: absolute; left: 0; top: 0; width: 100%; padding: 20px; }
  .no-print { display: none !important; }
}

/* ========== MOBILE MENU ========== */
.mobile-menu {
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.mobile-menu.open {
  transform: translateX(0);
  opacity: 1;
}

/* ========== TOOLTIP ========== */
.tooltip {
  position: relative;
}
.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #1E293B;
  color: white;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.tooltip:hover::after {
  opacity: 1;
}

/* ========== AD PLACEMENTS ========== */
.ad-container {
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  overflow: hidden;
  margin: 24px 0;
}
.ad-container[data-ad]::before {
  content: 'Advertisement';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: #94A3B8;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  pointer-events: none;
  z-index: 0;
}
.ad-banner   { min-height: 90px; }
.ad-rectangle { min-height: 250px; }
.ad-native   { min-height: 120px; }
.ad-inline   { min-height: 60px; margin: 16px 0; }
.ad-label {
  font-size: 10px;
  color: #94A3B8;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  text-align: center;
  margin-bottom: 4px;
  user-select: none;
}
@media (max-width: 640px) {
  .ad-container { min-height: 60px; margin: 16px 0; }
  .ad-banner    { min-height: 60px; }
  .ad-rectangle { min-height: 200px; }
}
.ad-container[aria-hidden="true"] {
  display: none;
  min-height: 0;
  margin: 0;
}
