/* ==========================================================================
   INVOEES DESIGN SYSTEM & STYLESHEET
   ========================================================================== */

/* Imports */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Outfit:wght@400;500;600;700;800;900&family=Playfair+Display:ital,wght@0,400;0,700;1,400&family=Courier+Prime&family=Montserrat:wght@400;700&display=swap');

:root {
  /* Brand gradients & constants */
  --primary-color: #8B5CF6;
  --primary-hover: #7C3AED;
  --secondary-color: #3B82F6;
  --accent-color: #EC4899;
  --primary-gradient: linear-gradient(135deg, #8B5CF6 0%, #3B82F6 100%);
  --accent-gradient: linear-gradient(135deg, #EC4899 0%, #8B5CF6 100%);
  --success-color: #10B981;
  --warning-color: #F59E0B;
  --danger-color: #EF4444;
  --info-color: #3B82F6;
  
  /* Fonts */
  --font-title: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-elegant: 'Playfair Display', Georgia, serif;
  --font-mono: 'Courier Prime', Courier, monospace;
  
  /* Border radius */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 30px;
  --radius-circle: 50%;
  
  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme Variables */
:root[data-theme="light"] {
  --bg-main: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F1F5F9;
  --bg-input: #F8FAFC;
  --border-color: #E2E8F0;
  --text-main: #0F172A;
  --text-muted: #64748B;
  --text-inverse: #FFFFFF;
  --glass-bg: rgba(255, 255, 255, 0.75);
  --glass-border: rgba(255, 255, 255, 0.6);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 20px -2px rgba(139, 92, 246, 0.05), 0 2px 8px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 20px 25px -5px rgba(139, 92, 246, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 0 30px rgba(139, 92, 246, 0.1);
  --scrollbar-bg: #E2E8F0;
  --scrollbar-thumb: #CBD5E1;
}

/* Dark Theme Variables (Default) */
:root, :root[data-theme="dark"] {
  --bg-main: #0A0D14;
  --bg-card: #111625;
  --bg-card-hover: #192035;
  --bg-input: #1A2035;
  --border-color: #232C45;
  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --text-inverse: #0A0D14;
  --glass-bg: rgba(17, 22, 37, 0.75);
  --glass-border: rgba(255, 255, 255, 0.05);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 30px -4px rgba(0, 0, 0, 0.4), 0 4px 12px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.6), 0 12px 24px -6px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px rgba(139, 92, 246, 0.15);
  --scrollbar-bg: #111625;
  --scrollbar-thumb: #232C45;
}

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

html {
  scroll-behavior: smooth;
  height: 100%;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100%;
  overflow-x: hidden;
  transition: background-color var(--transition-normal), color var(--transition-normal);
  display: flex;
  flex-direction: column;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--scrollbar-bg);
}
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: var(--radius-sm);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary-color);
}

/* Typography & Headings */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-title);
  font-weight: 700;
  line-height: 1.25;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

button {
  cursor: pointer;
}

img, svg {
  max-width: 100%;
  height: auto;
  vertical-align: middle;
}

/* ==========================================================================
   LAYOUT UTILITIES
   ========================================================================== */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }
.gap-4 { gap: 32px; }

.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary-color); }
.text-success { color: var(--success-color); }
.text-warning { color: var(--warning-color); }
.text-danger { color: var(--danger-color); }

.w-full { width: 100%; }
.h-full { height: 100%; }

.m-0 { margin: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: all var(--transition-normal);
  gap: 8px;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: var(--primary-gradient);
  color: #FFFFFF;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4), var(--shadow-glow);
}
.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}
.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--primary-color);
  transform: translateY(-2px);
}

.btn-accent {
  background: var(--accent-gradient);
  color: #FFFFFF;
  box-shadow: 0 4px 15px rgba(236, 72, 153, 0.3);
}
.btn-accent:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(236, 72, 153, 0.4);
}

.btn-danger {
  background: var(--danger-color);
  color: #FFFFFF;
}
.btn-danger:hover {
  background: #DC2626;
  transform: translateY(-2px);
}

.btn-success {
  background: var(--success-color);
  color: #FFFFFF;
}
.btn-success:hover {
  background: #059669;
  transform: translateY(-2px);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 14px;
  border-radius: var(--radius-sm);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-muted);
  transition: all var(--transition-fast);
}
.btn-icon svg, .btn-icon i {
  width: 18px !important;
  height: 18px !important;
  min-width: 18px;
  min-height: 18px;
  display: block;
  stroke: currentColor;
  fill: none;
}
.btn-icon:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
  background: var(--bg-card-hover);
}

/* ==========================================================================
   CARDS & CONTAINERS
   ========================================================================== */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  transition: transform var(--transition-normal), border-color var(--transition-normal), box-shadow var(--transition-normal);
}
.card:hover {
  border-color: rgba(139, 92, 246, 0.3);
}

.card.clickable {
  position: relative;
  cursor: pointer;
}
.card.clickable:hover {
  transform: translateY(-6px);
  border-color: var(--primary-color);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}
.card.clickable h2 a::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 2;
}
.card.clickable img {
  transition: transform var(--transition-normal);
}
.card.clickable:hover img {
  transform: scale(1.05);
}

.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-xl);
  gap: 4px;
  text-transform: capitalize;
}
.badge-paid { background-color: rgba(16, 185, 129, 0.1); color: var(--success-color); border: 1px solid rgba(16, 185, 129, 0.2); }
.badge-sent { background-color: rgba(59, 130, 246, 0.1); color: var(--info-color); border: 1px solid rgba(59, 130, 246, 0.2); }
.badge-draft { background-color: rgba(148, 163, 184, 0.1); color: var(--text-muted); border: 1px solid rgba(148, 163, 184, 0.2); }
.badge-overdue { background-color: rgba(239, 68, 68, 0.1); color: var(--danger-color); border: 1px solid rgba(239, 68, 68, 0.2); }

/* ==========================================================================
   HEADER & NAVIGATION
   ========================================================================== */
header.glass-card {
  position: sticky;
  top: 0;
  z-index: 100;
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 80px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 24px;
}
.logo img {
  height: 40px;
  width: auto;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
  list-style: none;
}
.nav-link {
  font-weight: 500;
  color: var(--text-muted);
}
.nav-link:hover, .nav-link.active {
  color: var(--text-main);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.menu-toggle {
  display: none;
  font-size: 24px;
}

/* Theme Switcher Toggle */
.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-circle);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  cursor: pointer;
  background-color: var(--bg-card);
}
.theme-toggle:hover {
  border-color: var(--primary-color);
}
.theme-toggle svg {
  width: 20px;
  height: 20px;
  transition: transform var(--transition-normal);
}
.theme-toggle:hover svg {
  transform: rotate(30deg);
}
:root[data-theme="light"] .theme-toggle-dark { display: block; }
:root[data-theme="light"] .theme-toggle-light { display: none; }
:root[data-theme="dark"] .theme-toggle-dark { display: none; }
:root[data-theme="dark"] .theme-toggle-light { display: block; }

/* ==========================================================================
   LANDING PAGE COMPONENTS
   ========================================================================== */
.hero-section {
  padding: 100px 0 80px 0;
  position: relative;
  overflow: hidden;
}
.hero-glow {
  position: absolute;
  top: -150px;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.15) 0%, rgba(59, 130, 246, 0.05) 50%, rgba(0,0,0,0) 100%);
  z-index: -1;
  pointer-events: none;
  border-radius: var(--radius-circle);
}
.hero-title {
  font-size: 64px;
  font-weight: 900;
  margin-bottom: 24px;
  line-height: 1.1;
  letter-spacing: -2px;
}
.hero-title span {
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-subtitle {
  font-size: 20px;
  max-width: 600px;
  margin: 0 auto 40px auto;
  line-height: 1.6;
}

/* Showcase Floating Preview */
.showcase-mockup {
  position: relative;
  max-width: 900px;
  margin: 40px auto 0 auto;
  border-radius: var(--radius-lg);
  padding: 10px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2) 0%, rgba(59, 130, 246, 0.2) 100%);
  box-shadow: var(--shadow-lg), 0 0 50px rgba(139, 92, 246, 0.1);
  transform: perspective(1000px) rotateX(5deg);
  transition: transform var(--transition-slow);
}
.showcase-mockup:hover {
  transform: perspective(1000px) rotateX(0deg);
}
.showcase-inner {
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
}
.showcase-inner img {
  width: 100%;
  display: block;
}

/* Feature Grid */
.features-section {
  padding: 80px 0;
}
.features-grid {
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}
.feature-card {
  text-align: left;
}
.feature-icon {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-md);
  background: rgba(139, 92, 246, 0.1);
  color: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  font-size: 24px;
}

/* Template Carousel Showcase */
.templates-section {
  padding: 80px 0;
  background: rgba(17, 22, 37, 0.3);
}
.template-showcase-container {
  display: flex;
  gap: 32px;
  margin-top: 40px;
  overflow-x: auto;
  padding: 20px 10px;
  scroll-snap-type: x mandatory;
}
.template-item {
  flex: 0 0 350px;
  scroll-snap-align: start;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-normal);
}
.template-item:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  border-color: var(--primary-color);
}
.template-preview-img {
  height: 240px;
  background: #F1F5F9;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.template-preview-img svg {
  width: 150px;
  box-shadow: var(--shadow-lg);
}
.template-info {
  padding: 20px;
}

/* Interactive Pricing Section */
.pricing-section {
  padding: 80px 0;
}
.pricing-toggle-container {
  display: inline-flex;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 4px;
  border-radius: var(--radius-xl);
  margin-bottom: 40px;
}
.pricing-toggle-btn {
  padding: 8px 24px;
  border-radius: var(--radius-xl);
  font-weight: 600;
  transition: all var(--transition-normal);
}
.pricing-toggle-btn.active {
  background: var(--primary-color);
  color: #FFFFFF;
}
.pricing-grid {
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  align-items: stretch;
}
.pricing-card {
  position: relative;
  display: flex;
  flex-direction: column;
}
.pricing-card.premium-tier {
  border-color: var(--primary-color);
  box-shadow: var(--shadow-lg), 0 0 30px rgba(139, 92, 246, 0.15);
}
.pricing-card.premium-tier::before {
  content: "MOST POPULAR";
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary-gradient);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 16px;
  border-radius: var(--radius-xl);
  letter-spacing: 1px;
}
.price-header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 24px;
  margin-bottom: 24px;
}
.price-value {
  font-size: 48px;
  font-weight: 800;
  margin: 16px 0;
}
.price-value span {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-muted);
}
.price-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
  margin-bottom: 32px;
  flex-grow: 1;
}
.price-features li {
  display: flex;
  align-items: center;
  gap: 10px;
}
.price-features svg {
  color: var(--success-color);
  flex-shrink: 0;
}

/* FAQ Accordion */
.faq-section {
  padding: 80px 0;
  background: rgba(17, 22, 37, 0.2);
}
.faq-accordion {
  max-width: 800px;
  margin: 40px auto 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.faq-item {
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.faq-question {
  width: 100%;
  padding: 20px 24px;
  text-align: left;
  font-weight: 600;
  font-size: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq-question svg {
  transition: transform var(--transition-normal);
}
.faq-item.active .faq-question svg {
  transform: rotate(180deg);
  color: var(--primary-color);
}
.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-normal) ease-out;
  padding: 0 24px;
  color: var(--text-muted);
  line-height: 1.6;
}
.faq-item.active .faq-answer {
  padding-bottom: 20px;
}

/* Testimonials */
.testimonials-section {
  padding: 80px 0;
}
.testimonials-grid {
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  margin-top: 40px;
}
.testimonial-card {
  text-align: left;
}
.testimonial-stars {
  color: var(--warning-color);
  margin-bottom: 16px;
}
.testimonial-user {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
}
.testimonial-avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-circle);
  background: #E2E8F0;
  overflow: hidden;
  font-weight: bold;
  color: #1E293B;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* CTA Banner */
.cta-section {
  padding: 80px 0;
}
.cta-banner {
  background: var(--primary-gradient);
  border-radius: var(--radius-lg);
  padding: 60px 40px;
  color: #FFFFFF;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(139, 92, 246, 0.3);
}
.cta-banner-glow {
  position: absolute;
  right: -50px;
  bottom: -100px;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0) 70%);
  pointer-events: none;
}

/* Footer styling */
footer {
  background: #070A10;
  border-top: 1px solid var(--border-color);
  padding: 80px 0 40px 0;
  color: var(--text-muted);
  margin-top: auto;
}
.footer-grid {
  grid-template-columns: repeat(5, 1fr);
  gap: 32px;
  margin-bottom: 40px;
}
.footer-col-logo {
  grid-column: span 2;
}
.footer-col h4 {
  color: #F8FAFC; /* Always light slate because footer background is always dark (#070A10) */
  margin-bottom: 20px;
  font-size: 16px;
}
.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.footer-links a {
  color: #94A3B8; /* Always light-muted because footer background is always dark */
  text-decoration: none;
  transition: color var(--transition-fast);
}
.footer-links a:hover {
  color: #FFFFFF; /* Always hover to white */
}
.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 24px;
}

/* ==========================================================================
   DASHBOARD COMPONENTS
   ========================================================================== */
.dashboard-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
  background: var(--bg-card);
  border-right: 1px solid var(--border-color);
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
}
.sidebar-logo {
  margin-bottom: 40px;
  padding-left: 10px;
}
.sidebar-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.sidebar-link:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
}
.sidebar-link.active {
  background: var(--primary-color);
  color: #FFFFFF;
}
.sidebar-user {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 8px;
  border-top: 1px solid var(--border-color);
}

/* Main Dashboard Panel */
.dashboard-main {
  padding: 40px;
  overflow-y: auto;
  height: 100vh;
}
.dashboard-header {
  margin-bottom: 32px;
}

/* Statistics Spark Cards */
.stats-grid {
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-bottom: 40px;
}
.stats-card {
  position: relative;
  overflow: hidden;
}
.stats-val {
  font-size: 28px;
  font-weight: 800;
  margin: 12px 0 6px 0;
  font-family: var(--font-title);
}
.sparkline-container {
  height: 40px;
  width: 100%;
  margin-top: 10px;
}

/* Charts and Lists Layout */
.dashboard-grid-main {
  grid-template-columns: 2fr 1fr;
  gap: 32px;
  margin-bottom: 40px;
}


.settings-grid-main {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  align-items: start;
  gap: 24px;
}

/* Invoices list and filters */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.filters-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}
.search-input-wrapper {
  position: relative;
  flex-grow: 1;
}
.search-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  padding: 10px 16px 10px 40px;
  border-radius: var(--radius-md);
}
.search-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.1);
}
.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}
.filter-select {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
}

/* High Fidelity Table */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}
.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
.table th, .table td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}
.table th {
  background: var(--bg-card-hover);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.table tr:last-child td {
  border-bottom: none;
}
.table tbody tr:hover {
  background: rgba(139, 92, 246, 0.02);
}
.table-actions {
  display: flex;
  gap: 8px;
}

/* Client Manager and Settings Panels */
.settings-section-title {
  font-size: 18px;
  font-weight: 700;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
  margin: 24px 0 16px 0;
}
.settings-grid {
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}
.form-group label {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-muted);
}
.form-control {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: var(--text-main);
  transition: border-color var(--transition-fast);
}
.form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.1);
}
.form-control::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}
textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

/* Custom Upload Logo Button */
.logo-upload-container {
  display: flex;
  align-items: center;
  gap: 20px;
  border: 2px dashed var(--border-color);
  padding: 20px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: border-color var(--transition-fast);
}
.logo-upload-container:hover {
  border-color: var(--primary-color);
}
.logo-upload-preview {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-md);
  background: var(--bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

/* ==========================================================================
   INVOICE BUILDER LAYOUT
   ========================================================================== */
.builder-layout {
  display: grid;
  grid-template-columns: 550px 1fr;
  height: 100vh;
}
.builder-sidebar {
  background: var(--bg-card);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100%;
}
.builder-sidebar-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.builder-scroll-content {
  flex-grow: 1;
  overflow-y: auto;
  padding: 24px;
}
.builder-section-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 24px;
}
.builder-section-card h3 {
  font-size: 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Dynamic Line Items Manager */
.line-items-header {
  grid-template-columns: 2fr 1fr 1fr 1fr 40px;
  gap: 12px;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 8px;
  padding: 0 4px;
}
.line-item-row {
  grid-template-columns: 2fr 1fr 1fr 1fr 40px;
  gap: 12px;
  margin-bottom: 12px;
  align-items: center;
}

/* Preview Workspace Panel */
.preview-workspace {
  background: #11131E;
  padding: 40px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  height: 100vh;
}
.preview-toolbar {
  width: 100%;
  max-width: 800px;
  margin-bottom: 20px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.preview-toolbar-group {
  display: flex;
  gap: 12px;
}

/* Canvas Signature Pad */
.signature-pad-container {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  overflow: hidden;
  position: relative;
}
.signature-canvas {
  width: 100%;
  height: 120px;
  display: block;
  cursor: crosshair;
}

/* Color Presets Picker */
.color-picker-grid {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}
.color-preset {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-circle);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.color-preset.active {
  border-color: var(--text-main);
  transform: scale(1.1);
}

/* ==========================================================================
   INVOICE PREMIUM TEMPLATE PREVIEW CARDS (A4 Dimensions inside UI)
   ========================================================================== */
.invoice-sheet-container {
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  transform-origin: top center;
  transition: transform var(--transition-normal);
}

.invoice-sheet {
  width: 790px; /* Standard A4 equivalent pixel width at 96 DPI */
  min-height: 1118px; /* A4 aspect ratio 1:1.414 */
  background: #FFFFFF;
  color: #1E293B;
  padding: 60px;
  font-family: var(--font-body);
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  text-align: left;
}

/* 1. Theme Styling Overrides (Templates) */
/* Modern Minimal */
.invoice-sheet.template-minimal {
  font-family: 'Inter', sans-serif;
}
.invoice-sheet.template-minimal .invoice-header {
  border-bottom: 2px solid #F1F5F9;
  padding-bottom: 30px;
  margin-bottom: 30px;
}

/* Corporate Bold */
.invoice-sheet.template-corporate {
  font-family: 'Montserrat', sans-serif;
}
.invoice-sheet.template-corporate .invoice-header {
  background: var(--invoice-theme-color, #1E293B);
  color: #FFFFFF;
  margin: -60px -60px 40px -60px;
  padding: 60px;
}
.invoice-sheet.template-corporate .invoice-header .logo-text {
  color: #FFFFFF !important;
}

/* Elegant Classic */
.invoice-sheet.template-elegant {
  font-family: var(--font-elegant);
}
.invoice-sheet.template-elegant .invoice-header {
  border-bottom: 1px double #CBD5E1;
  padding-bottom: 30px;
  margin-bottom: 30px;
}

/* Playful Tech */
.invoice-sheet.template-tech {
  font-family: 'Outfit', sans-serif;
  border-top: 12px solid var(--invoice-theme-color, #8B5CF6);
}

/* Internal Invoice Layout Items */
.invoice-sheet .invoice-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 40px;
}
.invoice-sheet .invoice-title {
  font-size: 36px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--invoice-theme-color, #1E293B);
  margin-bottom: 10px;
}
.invoice-sheet .invoice-parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}
.invoice-sheet .party-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: #64748B;
  border-bottom: 1px solid #E2E8F0;
  padding-bottom: 6px;
  margin-bottom: 10px;
  letter-spacing: 0.5px;
}
.invoice-sheet .party-name {
  font-size: 16px;
  font-weight: 700;
  color: #0F172A;
  margin-bottom: 4px;
}
.invoice-sheet .party-details {
  font-size: 13px;
  color: #475569;
  line-height: 1.5;
  white-space: pre-line;
}

/* Invoice Line Items Table */
.invoice-sheet .items-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 40px;
}
.invoice-sheet .items-table th {
  border-bottom: 2px solid #E2E8F0;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 12px 10px;
  letter-spacing: 0.5px;
}
.invoice-sheet .items-table td {
  padding: 16px 10px;
  border-bottom: 1px solid #F1F5F9;
  color: #334155;
  font-size: 14px;
}
.invoice-sheet .items-table tr.total-row td {
  border-bottom: none;
  font-size: 16px;
  font-weight: 700;
  color: #0F172A;
}

/* Invoice Totals calculation panel */
.invoice-sheet .totals-section {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 40px;
}
.invoice-sheet .totals-table {
  width: 300px;
}
.invoice-sheet .totals-table td {
  padding: 10px 0;
  font-size: 14px;
  color: #475569;
}
.invoice-sheet .totals-table tr.grand-total td {
  font-size: 20px;
  font-weight: 800;
  color: var(--invoice-theme-color, #1E293B);
  border-top: 2px solid #E2E8F0;
  padding-top: 14px;
}

/* Signature & Notes block */
.invoice-sheet .invoice-footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 40px;
  margin-top: auto; /* Push footer elements to bottom */
}
.invoice-sheet .footer-notes {
  font-size: 12px;
  color: #64748B;
  line-height: 1.6;
}
.invoice-sheet .footer-signature {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-end;
}
.invoice-sheet .signature-image {
  max-height: 60px;
  margin-bottom: 8px;
}
.invoice-sheet .signature-line {
  width: 180px;
  border-top: 1px solid #CBD5E1;
  padding-top: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  text-align: center;
}

/* ==========================================================================
   MOCK MODAL SYSTEM (Checkout, Sharing, etc.)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(7, 10, 16, 0.8);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}
.modal-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 500px;
  padding: 32px;
  box-shadow: var(--shadow-lg);
  transform: scale(0.9);
  transition: transform var(--transition-normal);
}
.modal-overlay.active .modal-container {
  transform: scale(1);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.modal-close-btn {
  font-size: 24px;
  color: var(--text-muted);
}
.modal-close-btn:hover {
  color: var(--text-main);
}

/* Payment portal checkout mock specific details */
.checkout-method-tabs {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}
.checkout-method-tab {
  flex: 1;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  text-align: center;
  font-weight: 600;
  cursor: pointer;
  background: var(--bg-input);
}
.checkout-method-tab.active {
  border-color: var(--primary-color);
  background: rgba(139, 92, 246, 0.05);
  color: var(--primary-color);
}

/* Animated Payment Success screen */
.payment-success-content {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 20px 0;
}
.success-checkmark-circle {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-circle);
  background: rgba(16, 185, 129, 0.1);
  color: var(--success-color);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  font-size: 44px;
  animation: scaleUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* ==========================================================================
   ANIMATIONS & EFFECTS
   ========================================================================== */
@keyframes scaleUp {
  0% { transform: scale(0); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes pulseGlow {
  0% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(139, 92, 246, 0); }
  100% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0); }
}

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

/* Floating animation for landing page mockups */
@keyframes floatAnimation {
  0% { transform: translateY(0px) rotateX(5deg); }
  50% { transform: translateY(-10px) rotateX(5deg); }
  100% { transform: translateY(0px) rotateX(5deg); }
}
.floating-mockup {
  animation: floatAnimation 6s ease-in-out infinite;
}

/* Spinner */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-circle);
  border-top-color: #FFFFFF;
  animation: spin 1s ease-in-out infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   RESPONSIVE OVERRIDES
   ========================================================================== */
@media (max-width: 1024px) {
  .hero-title { font-size: 48px; }
  .features-grid, .pricing-grid, .testimonials-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-layout { grid-template-columns: 1fr; }
  .sidebar { display: none; } /* On mobile, we can use simple drawer or floating layout */
  .dashboard-grid-main { grid-template-columns: 1fr; }
  .settings-grid-main { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .builder-layout { grid-template-columns: 1fr; height: auto; }
  .builder-sidebar { height: auto; }
  .preview-workspace { height: auto; padding: 20px 10px; }
  .invoice-sheet-container { transform: scale(0.9); transform-origin: top center; }
}

@media (max-width: 768px) {
  .hero-title { font-size: 38px; }
  .features-grid, .pricing-grid, .testimonials-grid, .footer-grid { grid-template-columns: 1fr; }
  .footer-col-logo { grid-column: span 1; }
  .stats-grid { grid-template-columns: 1fr; }
  .nav-links { display: none; } /* On mobile, simplify nav */
  .menu-toggle { display: block; }
  .nav-actions { margin-left: auto; }
  .invoice-sheet-container { transform: scale(0.6); }
  .invoice-sheet { width: 100%; min-height: auto; padding: 20px; }
  .invoice-sheet .invoice-parties { grid-template-columns: 1fr; gap: 20px; }
  .invoice-sheet .invoice-footer-grid { grid-template-columns: 1fr; gap: 20px; }
}

/* ==========================================================================
   PRINT MEDIA QUERY
   ========================================================================== */
@media print {
  /* Hide all elements except the invoice sheet */
  body, html {
    background: #FFFFFF !important;
    color: #000000 !important;
    height: auto !important;
    overflow: visible !important;
  }
  
  header, footer, .sidebar, .dashboard-main, .builder-sidebar, 
  .preview-toolbar, .modal-overlay, .btn, .theme-toggle, .no-print {
    display: none !important;
  }
  
  .preview-workspace {
    background: none !important;
    padding: 0 !important;
    overflow: visible !important;
    height: auto !important;
  }

  .invoice-sheet-container {
    transform: none !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .invoice-sheet {
    width: 100% !important;
    min-height: auto !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    page-break-after: avoid !important;
  }
  
  /* Ensure colors and backgrounds print correctly */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}

/* ==========================================================================
   GLOBAL UTILITIES
   ========================================================================== */
.hidden {
  display: none !important;
}

/* Watermark on Starter Plan Invoices */
.invoice-watermark {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid #E2E8F0;
  text-align: center;
  font-size: 11px;
  color: #94A3B8;
  font-weight: 600;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  user-select: none;
}
.invoice-watermark svg {
  width: 14px;
  height: 14px;
  color: #8B5CF6;
}

/* Signature Pad Lock Overlay */
.signature-pad-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(17, 22, 37, 0.85);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 600;
  gap: 6px;
  cursor: pointer;
  z-index: 10;
  transition: background var(--transition-fast);
  text-align: center;
  padding: 10px;
}
.signature-pad-overlay:hover {
  background: rgba(17, 22, 37, 0.9);
}
.signature-pad-overlay svg {
  width: 20px;
  height: 20px;
  color: #8B5CF6;
}

/* Pricing Comparison Table CSS */
.comparison-table-wrapper {
  margin-top: 60px;
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  box-shadow: var(--shadow-md);
}
.comparison-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}
.comparison-table th, .comparison-table td {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}
.comparison-table th {
  background: var(--bg-card-hover);
  font-family: var(--font-title);
  color: var(--text-main);
  font-weight: 700;
  font-size: 16px;
}
.comparison-table th:first-child {
  border-top-left-radius: var(--radius-lg);
}
.comparison-table th:last-child {
  border-top-right-radius: var(--radius-lg);
}
.comparison-table td {
  color: var(--text-muted);
}
.comparison-table td:first-child {
  color: var(--text-main);
  font-weight: 500;
  white-space: normal;
  max-width: 250px;
}
.comparison-table tr.table-section-header td {
  background: rgba(139, 92, 246, 0.05);
  color: var(--primary-color);
  font-weight: 700;
  font-family: var(--font-title);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 12px 24px;
}
.comparison-table tr:hover td {
  background: rgba(139, 92, 246, 0.01);
}
.comparison-table td i {
  vertical-align: middle;
}


