/* CSS Variables for theming */
:root {
  --primary-color: #1f2937;
  --primary-hover: #111827;
  --secondary-color: #f1f5f9;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --background: #ffffff;
  --background-secondary: #f8fafc;
  --border-color: #e2e8f0;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --radius: 12px;
  --success-color: #10b981;
  --error-color: #ef4444;
}


/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--background);
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Container and layout */
.container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Header */
.header {
  padding: 0.8rem 0;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--background);
  backdrop-filter: blur(8px);
}

/* Header placeholder to prevent layout jumps */
.sticky-placeholder {
  display: block;
  height: 160px; /* Height of fixed header and input combined with padding */
}

/* Fixed header styles */
.header .logo-section h1 {
  font-size: clamp(1.1rem, 2.2vw, 1.6rem);
}

.header .logo {
  width: 32px;
  height: 32px;
  font-size: 1.3rem;
}

.header .header-top {
  margin-bottom: 0.3rem;
}

/* Fixed input section */
.input-section {
  position: fixed;
  top: 55px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  background: var(--background);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow);
  padding: 0.75rem 1rem;
  width: 100%;
  max-width: 800px;
  backdrop-filter: blur(8px);
  border-radius: 0 0 8px 8px;
}

.input-section #textInput {
  padding: 0.75rem 1rem;
  font-size: 1rem;
  width: 100%;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  position: relative;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  justify-content: center;
}

.logo {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
}

/* Navigation Menu - Hidden on desktop, shown on mobile */
.nav-menu {
  position: relative;
  display: none; /* Hidden by default on desktop */
}

/* Mobile layout adjustments */
@media (max-width: 768px) {
  .header-top {
    justify-content: flex-start;
    gap: 1rem;
    position: relative;
  }
  
  .logo-section {
    justify-content: center;
    flex: 1;
    order: 1;
  }
  
  .nav-menu {
    display: block;
    order: 2;
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
  }
  
  
  .nav-dropdown {
    right: auto;
    left: 0;
  }
}

#navToggle {
  background: var(--background-secondary);
  border: 2px solid var(--border-color);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.3s ease;
  box-shadow: var(--shadow);
  z-index: 1003;
  position: relative;
}

#navToggle:hover,
#navToggle:focus,
#navToggle:active {
  background: var(--primary-color);
  color: white;
  transform: scale(1.05);
  outline: none;
}

#navToggle:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Touch device improvements */
@media (hover: none) {
  #navToggle:active {
    background: var(--primary-color);
    color: white;
    transform: scale(0.95);
  }
}

/* Ensure minimum touch target size */
@media (max-width: 768px) {
  #navToggle {
    min-width: 44px;
    min-height: 44px;
    width: 44px;
    height: 44px;
    touch-action: manipulation;
  }
  
  /* Improve navigation menu positioning on small screens */
  .nav-dropdown {
    top: 45px;
    right: 100%;
    left: auto;
    min-width: 250px;
    max-width: 90vw;
    transform: translateX(-10px);
  }
}

.nav-dropdown {
  position: absolute;
  top: 50px;
  right: 0;
  background: var(--background);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  min-width: 220px;
  z-index: 1002;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  max-height: 80vh;
  overflow-y: auto;
}

.nav-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-link {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.9rem;
  transition: background-color 0.2s ease;
  border-bottom: 1px solid var(--border-color);
}

.nav-link:last-child {
  border-bottom: none;
}

.nav-link:hover {
  background: var(--background-secondary);
}

.nav-section-title {
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--background-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.nav-separator {
  height: 1px;
  background: var(--border-color);
  margin: 0.25rem 0;
}


/* Header title */
.logo-section h1 {
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.2;
}


.hero-description {
  font-size: 1.125rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.7;
}

/* Main content */
.main-content {
  flex: 1;
  padding: 0;
  position: relative;
}

/* Popular Fonts Sidebar (Desktop Only) */
.popular-fonts-sidebar {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 100;
  display: none; /* Hidden by default, shown on desktop */
}

.popular-fonts-widget {
  background: var(--background);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 1.5rem;
  width: 220px;
  max-height: 60vh;
  overflow-y: auto;
  backdrop-filter: blur(8px);
}

.widget-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 1rem 0;
  text-align: center;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--primary-color);
}

.popular-links {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.popular-link {
  display: flex;
  align-items: center;
  padding: 0.6rem 0.8rem;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.85rem;
  border-radius: 8px;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.popular-link:hover {
  background: var(--background-secondary);
  border-color: var(--border-color);
  transform: translateX(3px);
}

.popular-link.home-link {
  background: var(--primary-color);
  color: white;
  font-weight: 500;
}

.popular-link.home-link:hover {
  background: var(--primary-hover);
  transform: translateX(3px);
}

.widget-separator {
  height: 1px;
  background: var(--border-color);
  margin: 0.5rem 0;
}

/* Show sidebar on desktop */
@media (min-width: 1200px) {
  .popular-fonts-sidebar {
    display: block;
  }
}

/* Ensure responsive behavior */
@media (max-width: 1199px) {
  .popular-fonts-sidebar {
    display: none !important;
  }
}

/* Converter section */
.converter-section {
  margin-bottom: 3rem;
}

.input-section {
  text-align: center;
}

.input-label {
  display: block;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

#textInput {
  width: 100%;
  max-width: 800px;
  padding: 1rem 1.5rem;
  font-size: 1.125rem;
  border: 2px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--background);
  color: var(--text-primary);
  resize: vertical;
  transition: all 0.3s ease;
  font-family: inherit;
  box-shadow: var(--shadow);
}

#textInput:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.input-help {
  margin-top: 0.5rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Fonts grid */
.fonts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-top: 0.5rem; /* Minimal margin since sticky-placeholder handles positioning */
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.font-item {
  background: var(--background-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: all 0.3s ease;
  position: relative;
  z-index: 1;
}

.font-item.menu-open {
  z-index: 2003;
}

.font-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-color);
}

.font-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.font-preview {
  font-size: 1.5rem;
  line-height: 1.4;
  margin-bottom: 1rem;
  word-break: break-word;
  min-height: 3rem;
  display: flex;
  align-items: center;
}

/* Export container and buttons */
.export-container {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  position: absolute;
  top: 1rem;
  right: 1rem;
  flex-wrap: wrap;
}

.export-dropdown {
  position: relative;
}

.export-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.export-btn:hover {
  background: var(--primary-hover);
  transform: scale(1.05);
}

.export-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--background);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  z-index: 2002;
  display: none;
  margin-top: 0.25rem;
}

.export-option {
  width: 100%;
  background: none;
  border: none;
  padding: 0.75rem 1rem;
  text-align: left;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-primary);
  transition: background-color 0.2s ease;
  border-bottom: 1px solid var(--border-color);
}

.export-option:last-child {
  border-bottom: none;
  border-radius: 0 0 8px 8px;
}

.export-option:first-child {
  border-radius: 8px 8px 0 0;
}

.export-option:hover {
  background: var(--background-secondary);
}

.copy-btn {
  background: var(--secondary-color);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.copy-btn:hover {
  background: var(--primary-hover);
  transform: scale(1.05);
}

.copy-btn:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

.copy-btn:active {
  transform: scale(0.95);
}

.copy-btn.copied {
  background: var(--success-color);
}

/* Font styles */
/* Core cursive and script fonts */
.dancing-script { font-family: 'Dancing Script', cursive; }
.allura { font-family: 'Allura', cursive; }
.great-vibes { font-family: 'Great Vibes', cursive; }
.sacramento { font-family: 'Sacramento', cursive; }
.parisienne { font-family: 'Parisienne', cursive; }
.tangerine { font-family: 'Tangerine', cursive; font-weight: 700; }
.alex-brush { font-family: 'Alex Brush', cursive; }
.mr-dafoe { font-family: 'Mr Dafoe', cursive; }
.rochester { font-family: 'Rochester', cursive; }
.yellowtail { font-family: 'Yellowtail', cursive; }
.euphoria-script { font-family: 'Euphoria Script', cursive; }
.damion { font-family: 'Damion', cursive; }
.courgette { font-family: 'Courgette', cursive; }
.league-script { font-family: 'League Script', cursive; }
.kaushan-script { font-family: 'Kaushan Script', cursive; }
.marck-script { font-family: 'Marck Script', cursive; }
.bad-script { font-family: 'Bad Script', cursive; }
.satisfy { font-family: 'Satisfy', cursive; }
.calligraffitti { font-family: 'Calligraffitti', cursive; }
.cedarville-cursive { font-family: 'Cedarville Cursive', cursive; }

/* Script fonts batch 2 */
.pinyon-script { font-family: 'Pinyon Script', cursive; }
.grand-hotel { font-family: 'Grand Hotel', cursive; }
.aguafina-script { font-family: 'Aguafina Script', cursive; }
.arizonia { font-family: 'Arizonia', cursive; }
.berkshire-swash { font-family: 'Berkshire Swash', cursive; }
.bilbo { font-family: 'Bilbo', cursive; }
.bilbo-swash-caps { font-family: 'Bilbo Swash Caps', cursive; }
.birthstone { font-family: 'Birthstone', cursive; }
.birthstone-bounce { font-family: 'Birthstone Bounce', cursive; }
.bona-nova { font-family: 'Bona Nova', cursive; }
.charmonman { font-family: 'Charmonman', cursive; }
.clicker-script { font-family: 'Clicker Script', cursive; }
.condiment { font-family: 'Condiment', cursive; }
.dawning-of-a-new-day { font-family: 'Dawning of a New Day', cursive; }

/* Handwriting fonts */
.caveat { font-family: 'Caveat', cursive; }
.indie-flower { font-family: 'Indie Flower', cursive; }
.handlee { font-family: 'Handlee', cursive; }
.architects-daughter { font-family: 'Architects Daughter', cursive; }
.patrick-hand { font-family: 'Patrick Hand', cursive; }
.covered-by-your-grace { font-family: 'Covered By Your Grace', cursive; }
.coming-soon { font-family: 'Coming Soon', cursive; }
.shadows-into-light { font-family: 'Shadows Into Light', cursive; }
.kalam { font-family: 'Kalam', cursive; }
.delius { font-family: 'Delius', cursive; }
.homemade-apple { font-family: 'Homemade Apple', cursive; }
.just-me-again-down-here { font-family: 'Just Me Again Down Here', cursive; }
.reenie-beanie { font-family: 'Reenie Beanie', cursive; }
.cookie { font-family: 'Cookie', cursive; }
.annie-use-your-telescope { font-family: 'Annie Use Your Telescope', cursive; }
.waiting-for-the-sunrise { font-family: 'Waiting for the Sunrise', cursive; }
.nothing-you-could-do { font-family: 'Nothing You Could Do', cursive; }
.walter-turncoat { font-family: 'Walter Turncoat', cursive; }
.schoolbell { font-family: 'Schoolbell', cursive; }
.give-you-glory { font-family: 'Give You Glory', cursive; }
.rock-salt { font-family: 'Rock Salt', cursive; }
.sedgwick-ave { font-family: 'Sedgwick Ave', cursive; }
.sedgwick-ave-display { font-family: 'Sedgwick Ave Display', cursive; }
.kranky { font-family: 'Kranky', cursive; }

/* Brush fonts */
.pacifico { font-family: 'Pacifico', cursive; }
.permanent-marker { font-family: 'Permanent Marker', cursive; }
.caveat-brush { font-family: 'Caveat Brush', cursive; }
.amatic-sc { font-family: 'Amatic SC', cursive; }
.lobster { font-family: 'Lobster', cursive; }
.fredoka-one { font-family: 'Fredoka One', cursive; }
.righteous { font-family: 'Righteous', cursive; }
.bangers { font-family: 'Bangers', cursive; }
.creepster { font-family: 'Creepster', cursive; }
.finger-paint { font-family: 'Finger Paint', cursive; }
.griffy { font-family: 'Griffy', cursive; }
.henny-penny { font-family: 'Henny Penny', cursive; }
.jolly-lodger { font-family: 'Jolly Lodger', cursive; }
.love-ya-like-a-sister { font-family: 'Love Ya Like A Sister', cursive; }
.maven-pro { font-family: 'Maven Pro', cursive; }
.painter-girl { font-family: 'Painter Girl', cursive; }
.special-elite { font-family: 'Special Elite', cursive; }
.sunshiney { font-family: 'Sunshiney', cursive; }
.zeyada { font-family: 'Zeyada', cursive; }

/* Signature fonts */
.herr-von-muellerhoff { font-family: 'Herr Von Muellerhoff', cursive; }
.italianno { font-family: 'Italianno', cursive; }
.meddon { font-family: 'Meddon', cursive; }
.mea-culpa { font-family: 'Mea Culpa', cursive; }
.monsieur-la-doulaise { font-family: 'Monsieur La Doulaise', cursive; }
.ms-madi { font-family: 'Ms Madi', cursive; }
.my-soul { font-family: 'My Soul', cursive; }
.norican { font-family: 'Norican', cursive; }
.oleo-script { font-family: 'Oleo Script', cursive; }
.over-the-rainbow { font-family: 'Over the Rainbow', cursive; }
.princess-sofia { font-family: 'Princess Sofia', cursive; }

/* Calligraphy fonts */
.leckerli-one { font-family: 'Leckerli One', cursive; }
.lobster-two { font-family: 'Lobster Two', cursive; }
.abril-fatface { font-family: 'Abril Fatface', cursive; }
.aclonica { font-family: 'Aclonica', cursive; }
.akronim { font-family: 'Akronim', cursive; }
.aladin { font-family: 'Aladin', cursive; }
.almendra { font-family: 'Almendra', cursive; }
.almendra-sc { font-family: 'Almendra SC', cursive; }
.amita { font-family: 'Amita', cursive; }

/* Info sections */
.info-section, .benefits-section, .faq-section {
  margin-bottom: 4rem;
}

.benefits-section {
  max-width: 800px;
  margin: 0 auto 4rem auto;
}

.info-section {
  max-width: 800px;
  margin: 0 auto 4rem auto;
}

.info-section h2, .benefits-section h2, .faq-section h2 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  text-align: center;
}

.info-content {
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}

.info-content p {
  font-size: 1.125rem;
  color: var(--text-secondary);
  line-height: 1.8;
}

/* Benefits grid */
.benefits-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.benefit-item {
  text-align: center;
  padding: 2rem 1rem;
  background: var(--background-secondary);
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

.benefit-item:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.benefit-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.benefit-item h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.benefit-item p {
  color: var(--text-secondary);
  line-height: 1.6;
}

/* FAQ section */
.faq-list {
  max-width: 800px;
  margin: 0 auto;
}

.faq-item {
  margin-bottom: 1rem;
  background: var(--background-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
}

.faq-question {
  width: 100%;
  background: none;
  border: none;
  padding: 1.5rem;
  text-align: left;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.3s ease;
}

.faq-question:hover {
  background: var(--border-color);
}

.faq-question:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: -2px;
}

.faq-arrow {
  transition: transform 0.3s ease;
  color: var(--text-secondary);
}

.faq-question[aria-expanded="true"] .faq-arrow {
  transform: rotate(180deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.faq-item.open .faq-answer {
  max-height: 200px;
}

.faq-answer p {
  padding: 0 1.5rem 1.5rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* Footer */
.footer {
  background: var(--background-secondary);
  border-top: 1px solid var(--border-color);
  padding: 3rem 0 2rem 0;
  margin-top: 4rem;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.footer-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-column h3 {
  color: var(--text-primary);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  border-bottom: 2px solid var(--primary-color);
  padding-bottom: 0.5rem;
}

.footer-column .footer-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.footer-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.3s ease;
  padding: 0.25rem 0;
}

.footer-nav a:hover {
  color: var(--primary-color);
}

.footer-nav a:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
  border-radius: 4px;
}

.footer-bottom {
  text-align: center;
  border-top: 1px solid var(--border-color);
  padding-top: 1.5rem;
}

.footer-bottom p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--success-color);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 500;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 1000;
  box-shadow: var(--shadow-lg);
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.error {
  background: var(--error-color);
}

.toast.warning {
  background: #f59e0b;
}

/* CSS Modal Styles */
.css-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.css-modal-content {
  background: var(--background);
  border-radius: 12px;
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}

.css-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--background-secondary);
}

.css-modal-header h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.25rem;
  font-weight: 600;
}

.css-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.css-modal-close:hover {
  background: var(--border-color);
  color: var(--text-primary);
}

.css-modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.css-modal-body pre {
  background: var(--background-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  overflow-x: auto;
  margin-bottom: 1rem;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.875rem;
  line-height: 1.5;
}

.css-modal-body code {
  color: var(--text-primary);
  font-family: inherit;
}

.css-modal-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.css-copy-btn,
.css-download-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  flex: 1;
  min-width: 120px;
}

.css-copy-btn:hover,
.css-download-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.css-copy-btn:active,
.css-download-btn:active {
  transform: translateY(0);
}

@media (max-width: 768px) {
  .css-modal {
    padding: 0.5rem;
  }
  
  .css-modal-content {
    max-height: 95vh;
  }
  
  .css-modal-header {
    padding: 1rem;
  }
  
  .css-modal-header h3 {
    font-size: 1.1rem;
  }
  
  .css-modal-body {
    padding: 1rem;
  }
  
  .css-modal-body pre {
    font-size: 0.8rem;
    padding: 0.75rem;
  }
  
  .css-modal-actions {
    flex-direction: column;
  }
  
  .css-copy-btn,
  .css-download-btn {
    flex: none;
    width: 100%;
  }
}

/* SVG Modal Styles */
.svg-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 2001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.svg-modal-content {
  background: var(--background);
  border-radius: 12px;
  max-width: 500px;
  width: 100%;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.svg-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--background-secondary);
}

.svg-modal-header h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.25rem;
  font-weight: 600;
}

.svg-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.svg-modal-close:hover {
  background: var(--border-color);
  color: var(--text-primary);
}

.svg-modal-body {
  padding: 1.5rem;
}

.svg-modal-body p {
  margin: 0 0 1rem 0;
  color: var(--text-secondary);
  font-weight: 500;
}

.svg-options {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.svg-option-btn {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--background-secondary);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.svg-option-btn:hover {
  border-color: var(--primary-color);
  background: var(--background);
  transform: translateY(-1px);
}

.svg-option-icon {
  font-size: 2rem;
  flex-shrink: 0;
}

.svg-option-btn div {
  flex: 1;
}

.svg-option-btn strong {
  display: block;
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.svg-option-btn small {
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.4;
}

@media (max-width: 768px) {
  .svg-modal {
    padding: 0.5rem;
  }
  
  .svg-modal-content {
    max-width: 95vw;
  }
  
  .svg-modal-header {
    padding: 1rem;
  }
  
  .svg-modal-body {
    padding: 1rem;
  }
  
  .svg-option-btn {
    padding: 0.75rem;
    gap: 0.75rem;
  }
  
  .svg-option-icon {
    font-size: 1.5rem;
  }
  
  .svg-option-btn strong {
    font-size: 0.9rem;
  }
  
  .svg-option-btn small {
    font-size: 0.8rem;
  }
}

/* Loading state */
.font-item.loading .font-preview {
  opacity: 0.6;
}

/* Responsive design */
@media (max-width: 768px) {
  .container {
    padding: 0 0.75rem;
  }
  
  .header {
    padding: 1rem 0;
  }
  
  /* Fix header height for mobile */
  .header .header-top {
    margin-bottom: 0.5rem;
  }
  
  /* Adjust input section position for mobile */
  .input-section {
    top: 70px; /* Increased from 55px to account for larger mobile header */
    padding: 1rem;
  }
  
  /* Adjust sticky placeholder height for mobile */
  .sticky-placeholder {
    height: 140px; /* Adjusted to account for fixed header + input section height */
  }
  
  
  .hero h1 {
    font-size: 1.75rem;
  }
  
  .hero-description {
    font-size: 1rem;
  }
  
  .fonts-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-top: 1rem; /* Reduced to minimize gap since sticky-placeholder handles positioning */
    padding-top: 0.5rem; /* Minimal padding */
  }
  
  .font-item {
    padding: 1.25rem;
  }
  
  .font-preview {
    font-size: 1.25rem;
  }
  
  .benefits-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .benefit-item {
    padding: 1.5rem 1rem;
  }
  
  .footer-columns {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .footer-column .footer-nav {
    gap: 0.4rem;
  }
  
  .toast {
    bottom: 1rem;
    right: 1rem;
    left: 1rem;
  }
}

@media (max-width: 480px) {
  .hero h1 {
    font-size: 1.5rem;
  }
  
  .hero-description {
    font-size: 0.95rem;
  }
  
  /* Further adjustments for very small screens */
  .input-section {
    top: 75px; /* Even more space for very small screens */
    padding: 0.75rem;
  }
  
  .sticky-placeholder {
    height: 160px; /* Adjusted to account for fixed header + input section height */
  }
  
  #textInput {
    padding: 0.875rem 1rem;
    font-size: 1rem;
  }
  
  .fonts-grid {
    margin-top: 1rem; /* Minimal margin since sticky-placeholder handles positioning */
    padding-top: 0.5rem; /* Minimal padding */
  }
  
  .font-item {
    padding: 1rem;
  }
  
  .font-preview {
    font-size: 1.125rem;
  }
  
  .export-container {
    position: static;
    margin-top: 0.5rem;
    justify-content: center;
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .export-dropdown {
    width: 100%;
  }
  
  .export-btn {
    width: 100%;
  }
  
  .export-menu {
    right: auto;
    left: 0;
    width: 100%;
  }
  
  .copy-btn {
    width: 100%;
  }
}

/* SEO Content Section */
.seo-content {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 2rem;
  margin: 2rem auto 0 auto;
  border: 1px solid var(--border-color);
  max-width: 800px;
}

.seo-content h2 {
  color: var(--primary-color);
  margin-bottom: 1.5rem;
  font-size: 2rem;
  text-align: center;
}

.seo-content h3 {
  color: var(--text-color);
  margin: 1.5rem 0 1rem 0;
  font-size: 1.5rem;
  border-bottom: 2px solid var(--primary-color);
  padding-bottom: 0.5rem;
}

.seo-content h4 {
  color: var(--text-color);
  margin: 1rem 0 0.5rem 0;
  font-size: 1.2rem;
  font-weight: 600;
}

.seo-content p {
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 1rem;
  text-align: justify;
}

.seo-content ul {
  margin: 1rem 0;
  padding-left: 1.5rem;
}

.seo-content li {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 0.5rem;
}

.seo-content strong {
  color: var(--primary-color);
  font-weight: 600;
}

/* Benefits Grid */
.benefits-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.benefit-item {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.benefit-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(31, 41, 55, 0.15);
}

.benefit-icon {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.benefit-item h3 {
  color: var(--text-color);
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
  border: none;
  padding: 0;
}

.benefit-item p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0;
  text-align: center;
}

/* FAQ Section */
.faq-section {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 2rem;
  margin: 2rem auto 0 auto;
  border: 1px solid var(--border-color);
  max-width: 800px;
}

.faq-section h2 {
  color: var(--primary-color);
  margin-bottom: 1.5rem;
  text-align: center;
}

.faq-item {
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1rem;
}

.faq-question {
  background: none;
  border: none;
  width: 100%;
  padding: 1rem 0;
  text-align: left;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-color);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: color 0.2s ease;
}

.faq-question:hover {
  color: var(--primary-color);
}

.faq-arrow {
  transition: transform 0.2s ease;
  color: var(--primary-color);
}

.faq-question[aria-expanded="true"] .faq-arrow {
  transform: rotate(180deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  padding: 0 1rem;
}

.faq-question[aria-expanded="true"] + .faq-answer {
  max-height: 200px;
  padding: 0 1rem 1rem 1rem;
}

.faq-answer p {
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
  text-align: left;
}

/* Print styles */
@media print {
  .copy-btn,
  .toast {
    display: none;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  :root {
    --border-color: #000000;
    --text-secondary: #000000;
  }
}

/* Related Pages Component */
.related-pages-section {
  background: var(--background-secondary);
  border-top: 1px solid var(--border-color);
  padding: 3rem 0 2rem 0;
  margin-top: 3rem;
}

.related-pages-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.related-pages-title {
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 0.5rem;
  font-family: 'Dancing Script', cursive;
}

.related-pages-subtitle {
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 2rem;
  font-size: 1rem;
}

.related-pages-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: 2rem;
}

.related-page-tag {
  display: inline-block;
  background: var(--background);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.related-page-tag::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.related-page-tag:hover::before {
  left: 100%;
}

.related-page-tag:hover {
  background: var(--primary-color);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.related-page-tag .tag-letter {
  font-weight: 700;
  font-family: 'Dancing Script', cursive;
  font-size: 1.1rem;
  margin-right: 0.3rem;
}

.view-all-container {
  text-align: center;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.view-all-btn {
  display: inline-block;
  background: var(--primary-color);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: var(--shadow);
}

.view-all-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

@media (max-width: 768px) {
  .related-pages-section {
    padding: 2rem 0 1rem 0;
  }
  
  .related-pages-title {
    font-size: 1.5rem;
  }
  
  .related-pages-grid {
    gap: 0.5rem;
  }
  
  .related-page-tag {
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}