/* ============================================
   Instagram Aesthetic CSS for Caption & Font Mixer
   Designed with deliberate choices for visual identity
   ============================================ */

/* Color Palette - Instagram-inspired gradient base */
:root {
  --primary-gradient: linear-gradient(135deg, #833ab4 0%, #fd1d1d 50%, #fcb045 100%);
  --primary-purple: #833ab4;
  --primary-pink: #fd1d1d;
  --primary-orange: #fcb045;
  --primary-light: #ffd8e4;
  --dark-bg: #0f0f0f;
  --card-bg: rgba(255, 255, 255, 0.95);
  --card-glass: rgba(255, 255, 255, 0.15);
  --text-main: #1a1a1a;
  --text-secondary: #666666;
  --text-light: #999999;
  --border-color: rgba(0, 0, 0, 0.1);
  --success: #00b894;
  --error: #d63031;
}

/* Base Reset & Typography */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: var(--dark-bg);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
}

a {
  text-decoration: none;
  color: inherit;
  transition: all 0.3s ease;
}

img {
  max-width: 100%;
  display: block;
}

/* 3D Animated Background Icons */
.bg-3d-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}

.bg-3d-icon {
  position: absolute;
  font-size: 60px;
  opacity: 0.08;
  animation: floatIcon 20s ease-in-out infinite;
  transform-style: preserve-3d;
  will-change: transform, opacity;
}

.bg-3d-icon:nth-child(1) { top: 10%; left: 10%; animation-delay: 0s; }
.bg-3d-icon:nth-child(2) { top: 30%; left: 80%; animation-delay: -5s; animation-duration: 25s; }
.bg-3d-icon:nth-child(3) { top: 60%; left: 20%; animation-delay: -10s; animation-duration: 18s; }
.bg-3d-icon:nth-child(4) { top: 80%; left: 70%; animation-delay: -15s; animation-duration: 22s; }
.bg-3d-icon:nth-child(5) { top: 50%; left: 50%; animation-delay: -7s; animation-duration: 30s; }
.bg-3d-icon:nth-child(6) { top: 15%; left: 60%; animation-delay: -12s; animation-duration: 28s; }
.bg-3d-icon:nth-child(7) { top: 75%; left: 15%; animation-delay: -3s; animation-duration: 24s; }
.bg-3d-icon:nth-child(8) { top: 45%; left: 85%; animation-delay: -9s; animation-duration: 26s; }

@keyframes floatIcon {
  0%, 100% {
    transform: translateY(0) rotateX(0deg) rotateY(0deg) rotateZ(0deg) translateZ(0);
    opacity: 0.08;
  }
  25% {
    transform: translateY(-30px) rotateX(5deg) rotateY(10deg) rotateZ(5deg) translateZ(20px);
    opacity: 0.12;
  }
  50% {
    transform: translateY(0) rotateX(0deg) rotateY(0deg) rotateZ(0deg) translateZ(0);
    opacity: 0.08;
  }
  75% {
    transform: translateY(30px) rotateX(-5deg) rotateY(-10deg) rotateZ(-5deg) translateZ(20px);
    opacity: 0.12;
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .bg-3d-icon {
    animation: none;
    transform: none;
    opacity: 0.05;
  }

  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Glassmorphism Card Style */
.card {
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  padding: 30px;
  transition: all 0.3s ease;
}

.card:hover {
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

/* Gradient Button Style */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 28px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 16px;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: var(--primary-gradient);
  color: white;
  box-shadow: 0 4px 15px rgba(131, 58, 180, 0.4);
}

.btn-primary:hover {
  box-shadow: 0 6px 25px rgba(131, 58, 180, 0.6);
  transform: translateY(-2px) scale(1.02);
}

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

.btn-primary .ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transform: scale(0);
  animation: ripple 0.6s ease-out;
}

@keyframes ripple {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* Input Fields */
.input {
  width: 100%;
  padding: 16px 20px;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  font-size: 16px;
  font-family: inherit;
  transition: all 0.3s ease;
  background: white;
}

.input:focus {
  outline: none;
  border-color: var(--primary-purple);
  box-shadow: 0 0 0 4px rgba(131, 58, 180, 0.1);
}

.input::placeholder {
  color: var(--text-light);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
  background: var(--primary-gradient);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-purple);
}

/* Navigation */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(15, 15, 15, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  padding: 15px 30px;
}

.nav {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 28px;
  font-weight: 700;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-links {
  display: flex;
  gap: 30px;
  list-style: none;
}

.nav-links a {
  font-weight: 500;
  color: var(--text-secondary);
  position: relative;
}

.nav-links a:hover,
.nav-links a.active {
  color: white;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary-gradient);
  transition: width 0.3s ease;
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 24px;
  color: white;
  cursor: pointer;
  padding: 5px;
}

.mobile-menu {
  display: none;
  position: fixed;
  top: 70px;
  left: 0;
  right: 0;
  background: rgba(15, 15, 15, 0.98);
  padding: 30px;
  gap: 20px;
  flex-direction: column;
}

.mobile-menu.active {
  display: flex;
}

/* Main Content */
.main-content {
  position: relative;
  z-index: 1;
  padding-top: 120px;
  padding-bottom: 60px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Hero Section */
.hero {
  text-align: center;
  padding: 60px 0 40px;
}

.hero h1 {
  font-size: clamp(36px, 5vw, 56px);
  margin-bottom: 20px;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: clamp(16px, 2vw, 20px);
  color: var(--text-secondary);
  max-width: 700px;
  margin: 0 auto 40px;
}

/* Grid Layouts */
.grid {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
}

/* Generator Section */
.generator-section {
  margin-bottom: 60px;
}

.generator-section h2 {
  font-size: 28px;
  margin-bottom: 30px;
  text-align: center;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Font Mixer Styles */
.font-input-container {
  margin-bottom: 30px;
}

.font-input-container label {
  display: block;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-main);
}

.font-input-container input[type="text"] {
  padding: 18px 24px;
  font-size: 20px;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  background: white;
  transition: all 0.3s ease;
}

.font-input-container input[type="text"]:focus {
  outline: none;
  border-color: var(--primary-purple);
  box-shadow: 0 0 0 4px rgba(131, 58, 180, 0.1);
}

.fonts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  max-height: 500px;
  overflow-y: auto;
  padding-right: 10px;
}

.font-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

.font-card:hover {
  border-color: var(--primary-purple);
  box-shadow: 0 4px 20px rgba(131, 58, 180, 0.15);
}

.font-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.font-card-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-secondary);
}

.font-preview {
  font-size: 20px;
  line-height: 1.5;
  margin-bottom: 12px;
  word-break: break-all;
}

.font-preview-plain {
  font-size: 12px;
  color: var(--text-light);
  opacity: 0.7;
}

.copy-btn {
  width: 100%;
  padding: 8px 16px;
  background: var(--primary-gradient);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.copy-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(131, 58, 180, 0.3);
}

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

/* Hashtag Generator Styles */
.hashtag-input-container {
  margin-bottom: 24px;
}

.hashtag-input-container label {
  display: block;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-main);
}

.hashtag-select {
  width: 100%;
  padding: 16px 20px;
  font-size: 16px;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  background: white;
  cursor: pointer;
  transition: all 0.3s ease;
}

.hashtag-select:focus {
  outline: none;
  border-color: var(--primary-purple);
  box-shadow: 0 0 0 4px rgba(131, 58, 180, 0.1);
}

.hashtag-pills-container {
  margin-bottom: 20px;
}

.hashtag-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 80px;
  padding: 16px;
  background: white;
  border-radius: 12px;
  border: 2px dashed var(--border-color);
  transition: all 0.3s ease;
}

.hashtag-pill {
  padding: 6px 14px;
  background: var(--primary-gradient);
  color: white;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.hashtag-pill:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(131, 58, 180, 0.3);
}

.hashtag-pill.selected {
  background: var(--primary-purple);
  box-shadow: 0 2px 8px rgba(131, 58, 180, 0.4);
}

.hashtag-count {
  text-align: center;
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.hashtag-count.warning {
  color: var(--error);
  font-weight: 600;
}

.hashtag-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.hashtag-actions .btn {
  flex: 1;
  min-width: 140px;
}

/* Combo Mode Section */
.combo-section {
  margin: 60px 0;
  text-align: center;
}

.combo-section h2 {
  font-size: 32px;
  margin-bottom: 30px;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.combo-result {
  background: white;
  border-radius: 16px;
  padding: 30px;
  margin: 30px 0;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--border-color);
}

.combo-result.has-content {
  border-style: solid;
  border-color: var(--primary-purple);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 240, 245, 0.95) 100%);
}

.combo-empty {
  color: var(--text-light);
  font-size: 18px;
}

.combo-copy-btn {
  width: 100%;
  padding: 16px 32px;
  font-size: 18px;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--primary-gradient);
  color: white;
  padding: 16px 32px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 16px;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  z-index: 10000;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Benefits Grid */
.benefits-section {
  padding: 80px 0;
}

.benefits-section h2 {
  font-size: 32px;
  text-align: center;
  margin-bottom: 50px;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.benefit-card {
  text-align: center;
  padding: 30px 20px;
}

.benefit-icon {
  width: 70px;
  height: 70px;
  background: var(--primary-gradient);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 32px;
  color: white;
}

.benefit-card h3 {
  font-size: 20px;
  margin-bottom: 12px;
}

.benefit-card p {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.7;
}

/* How It Works */
.how-it-works {
  padding: 80px 0;
}

.how-it-works h2 {
  font-size: 32px;
  text-align: center;
  margin-bottom: 60px;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.step {
  display: flex;
  align-items: center;
  gap: 30px;
  margin-bottom: 40px;
  padding: 30px;
  background: white;
  border-radius: 16px;
}

.step-number {
  width: 60px;
  height: 60px;
  background: var(--primary-gradient);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.step-content h3 {
  font-size: 24px;
  margin-bottom: 12px;
}

.step-content p {
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1.7;
}

/* FAQ Section */
.faq-section {
  padding: 80px 0;
}

.faq-section h2 {
  font-size: 32px;
  text-align: center;
  margin-bottom: 50px;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

.faq-question {
  padding: 20px 24px;
  font-weight: 600;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.3s ease;
}

.faq-question:hover {
  background: linear-gradient(135deg, rgba(131, 58, 180, 0.05) 0%, rgba(253, 29, 29, 0.05) 100%);
}

.faq-answer {
  padding: 0 24px 24px;
  color: var(--text-secondary);
  line-height: 1.7;
  display: none;
}

.faq-item.active .faq-answer {
  display: block;
}

.faq-item.active .faq-question {
  color: var(--primary-purple);
}

/* Footer */
.footer {
  background: var(--dark-bg);
  border-top: 1px solid var(--border-color);
  padding: 60px 0 30px;
  margin-top: 80px;
}

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

.footer-brand h3 {
  font-size: 24px;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
}

.footer-brand p {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.7;
}

.footer-links h4 {
  font-size: 18px;
  margin-bottom: 20px;
  color: white;
}

.footer-links ul {
  list-style: none;
}

.footer-links li {
  margin-bottom: 10px;
}

.footer-links a {
  color: var(--text-secondary);
  font-size: 15px;
}

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

.footer-social {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

.footer-social a {
  width: 45px;
  height: 45px;
  background: var(--card-glass);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--text-light);
  transition: all 0.3s ease;
}

.footer-social a:hover {
  background: var(--primary-gradient);
  color: white;
  transform: scale(1.1);
  box-shadow: 0 4px 15px rgba(131, 58, 180, 0.4);
}

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

.footer-bottom p {
  color: var(--text-light);
  font-size: 14px;
}

/* Page-specific Sections */
.page-hero {
  text-align: center;
  padding: 80px 0 40px;
}

.page-hero h1 {
  font-size: clamp(36px, 5vw, 48px);
  margin-bottom: 20px;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-content {
  padding: 40px 0 80px;
}

.page-content p {
  color: var(--text-secondary);
  font-size: 17px;
  line-height: 1.8;
  margin-bottom: 20px;
}

.page-content h2 {
  font-size: 28px;
  margin: 40px 0 20px;
  color: white;
}

.page-content h3 {
  font-size: 22px;
  margin: 30px 0 15px;
  color: white;
}

.page-content ul {
  margin-left: 30px;
  margin-bottom: 20px;
}

.page-content li {
  color: var(--text-secondary);
  font-size: 17px;
  line-height: 1.8;
  margin-bottom: 8px;
}

/* Contact Form */
.contact-form {
  max-width: 600px;
  margin: 0 auto;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-main);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid var(--border-color);
  border-radius: 10px;
  font-size: 16px;
  font-family: inherit;
  transition: all 0.3s ease;
  background: white;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary-purple);
  box-shadow: 0 0 0 4px rgba(131, 58, 180, 0.1);
}

.form-group textarea {
  min-height: 150px;
  resize: vertical;
}

.form-group .error {
  color: var(--error);
  font-size: 14px;
  margin-top: 6px;
  display: none;
}

.form-group input.error,
.form-group textarea.error,
.form-group select.error {
  border-color: var(--error);
}

.contact-form-submitted {
  text-align: center;
  padding: 60px 20px;
  background: white;
  border-radius: 16px;
}

.contact-form-submitted h3 {
  font-size: 28px;
  margin-bottom: 12px;
  color: var(--success);
}

.contact-form-submitted p {
  color: var(--text-secondary);
  font-size: 18px;
}

/* Accessibility Focus States */
:focus-visible {
  outline: 3px solid var(--primary-purple);
  outline-offset: 3px;
}

/* Screen Reader Only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Responsive Breakpoints */
@media (max-width: 768px) {
  .nav-links {
    display: none;
  }

  .mobile-menu-btn {
    display: block;
  }

  .mobile-menu.active {
    display: flex;
  }

  .hero h1 {
    font-size: 32px;
  }

  .hero p {
    font-size: 16px;
  }

  .fonts-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

  .step {
    flex-direction: column;
    text-align: center;
  }

  .step-number {
    margin-bottom: 16px;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .footer-links,
  .footer-social {
    align-items: center;
  }

  .footer-bottom p {
    font-size: 13px;
  }

  .hashtag-actions .btn {
    flex: 1;
  }
}

@media (max-width: 480px) {
  .header {
    padding: 12px 20px;
  }

  .main-content {
    padding-top: 100px;
  }

  .card {
    padding: 20px;
  }

  .fonts-grid {
    grid-template-columns: 1fr;
  }

  .btn {
    padding: 10px 20px;
    font-size: 14px;
  }

  .combo-copy-btn {
    padding: 14px 24px;
    font-size: 16px;
  }

  .font-preview {
    font-size: 16px;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .fonts-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
}

@media (min-width: 1441px) {
  .fonts-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  }
}
