/* ===================================================================
   FUNWITHTEXT.COM - COMPLETE UPDATED STYLES
   Your existing styles + new UX components
   =================================================================== */

/* ===================================================================
   CARD STYLES (EXISTING - KEEP)
   =================================================================== */

.card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 1.5rem;
  transition: box-shadow 0.3s ease;
  margin-bottom: 2rem;
}

.card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* ===================================================================
   STATISTICS CARDS (EXISTING - KEEP)
   =================================================================== */

.stat-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
  transition: transform 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.stat-value {
  font-size: 1.5rem;
  font-weight: bold;
  display: block;
  margin-top: 0.25rem;
}

.stat-label {
  font-size: 0.75rem;
  opacity: 0.9;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

/* ===================================================================
   BUTTON STYLES (EXISTING - KEEP)
   =================================================================== */

.btn {
  transition: all 0.2s ease;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: none;
  cursor: pointer;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

.btn-sm {
  padding: 0.25rem 0.75rem;
  font-size: 0.875rem;
  border-radius: 0.375rem;
  font-weight: 600;
  transition: all 0.2s;
}

/* ===================================================================
   NEW UX BUTTON STYLES (REQUIRED FOR NEW HOMEPAGE)
   =================================================================== */

.tool-btn-primary {
  background: #667eea;
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  transition: all 0.2s;
  border: none;
  cursor: pointer;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.tool-btn-primary:hover {
  background: #5568d3;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.tool-btn-secondary {
  background: white;
  color: #4b5563;
  padding: 0.625rem 1.25rem;
  border-radius: 6px;
  font-weight: 500;
  border: 1px solid #e5e7eb;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
}

.tool-btn-secondary:hover {
  background: #f9fafb;
  border-color: #d1d5db;
  transform: translateY(-1px);
}

.tool-btn-secondary.active {
  background: #667eea;
  color: white;
  border-color: #667eea;
}

/* ===================================================================
   HERO TEXTAREA (NEW)
   =================================================================== */

.hero-textarea {
  font-size: 16px;
  line-height: 1.6;
  min-height: 200px;
  transition: all 0.3s ease;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.hero-textarea:focus {
  min-height: 300px;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.hero-textarea.has-content {
  min-height: 150px;
}

/* ===================================================================
   INTENT CARDS (NEW)
   =================================================================== */

.intent-card {
  transition: all 0.2s ease;
  cursor: pointer;
  border: 2px solid transparent;
}

.intent-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
  border-color: #667eea;
}

.intent-card.active {
  border-color: #667eea;
  background: linear-gradient(135deg, #f0f4ff 0%, #e8f0fe 100%);
}

/* ===================================================================
   RESULT PREVIEW (NEW - FIXES DARK TEXT ISSUE)
   =================================================================== */

.result-preview {
  background: #f9fafb;
  border: 2px dashed #d1d5db;
  border-radius: 8px;
  padding: 1rem;
  min-height: 150px;
  position: relative;
  transition: all 0.3s ease;
}

.result-preview.has-result {
  background: white;
  border: 2px solid #10b981;
  border-style: solid;
}

.result-preview pre {
  color: #1f2937;  /* IMPORTANT: Dark text for readability */
  background: transparent;
  margin: 0;
  padding: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.result-preview .copy-hint {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  font-size: 12px;
  color: #6b7280;
  background: white;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  border: 1px solid #e5e7eb;
}

/* ===================================================================
   PROGRESSIVE DISCLOSURE (NEW)
   =================================================================== */

.advanced-options {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.advanced-options.open {
  max-height: 500px;
}

/* ===================================================================
   ANIMATIONS (NEW)
   =================================================================== */

@keyframes successPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.success-animation {
  animation: successPulse 0.4s ease;
}

/* ===================================================================
   VISUAL HIERARCHY (NEW)
   =================================================================== */

.section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #6b7280;
  font-weight: 600;
  margin-bottom: 0.5rem;
  display: block;
}

.stat-mini {
  font-size: 12px;
  color: #6b7280;
  padding: 0.25rem 0.5rem;
  background: #f3f4f6;
  border-radius: 4px;
  display: inline-block;
}

/* ===================================================================
   TOOL PANELS (NEW)
   =================================================================== */

.tool-panel {
  animation: fadeIn 0.3s ease;
}

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

/* ===================================================================
   EXISTING STYLES (KEEP ALL BELOW)
   =================================================================== */

.section-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-weight: 600;
  font-size: 1.1rem;
  color: #374151;
  cursor: pointer;
  user-select: none;
}

.section-header:hover {
  color: #667eea;
}

.section-icon {
  display: inline-block;
  transition: transform 0.3s ease;
}

.collapsible-content {
  max-height: 500px;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.collapsible-content.collapsed {
  max-height: 0;
}

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 16px 24px;
  border-radius: 8px;
  color: white;
  font-weight: 600;
  font-size: 14px;
  z-index: 9999;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: slideIn 0.3s ease;
  transition: opacity 0.3s ease;
  max-width: 400px;
}

.toast-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.toast-error {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

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

.textarea-label {
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #374151;
  display: block;
}

textarea {
  transition: border-color 0.2s ease;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

textarea:focus {
  border-color: #667eea;
  outline: none;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.icon {
  width: 18px;
  height: 18px;
}

.sticky-header {
  position: sticky;
  top: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.main-nav {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  padding-top: 0.75rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.nav-item {
  padding: 0.625rem 1.25rem;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid transparent;
  border-radius: 8px;
  color: white;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.nav-item.active {
  background: white;
  color: #667eea;
  border-color: white;
}

.hamburger-btn {
  display: none;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  padding: 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.5rem;
  transition: all 0.2s ease;
}

.hamburger-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.hamburger-btn.active {
  background: rgba(255, 255, 255, 0.4);
}

.visitor-counter-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 8px;
  color: white;
}

.visitor-icon {
  font-size: 1.5rem;
}

.visitor-label {
  font-size: 0.875rem;
  font-weight: 600;
  opacity: 0.9;
}

.visitor-count {
  font-size: 1.25rem;
  font-weight: bold;
  background: rgba(255, 255, 255, 0.2);
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
  min-width: 60px;
  text-align: center;
}

.tab-navigation {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  border-bottom: 2px solid #e5e7eb;
  padding-bottom: 0.5rem;
  margin-bottom: 1.5rem;
}

.tab-btn {
  padding: 0.75rem 1.25rem;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-weight: 600;
  color: #6b7280;
  transition: all 0.2s ease;
  border-radius: 8px 8px 0 0;
  font-size: 0.95rem;
}

.tab-btn:hover {
  background: #f3f4f6;
  color: #374151;
}

.tab-btn.active {
  color: #667eea;
  border-bottom-color: #667eea;
  background: #f9fafb;
}

.tab-content-wrapper {
  min-height: 200px;
  margin-bottom: 80px;
  padding-bottom: 40px;
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
  padding-bottom: 60px;
}

.tab-content.active {
  display: block;
}

.tab-content > *:last-child {
  margin-bottom: 40px;
}

.use-case-card {
  padding: 0.75rem;
  border-radius: 0.5rem;
  border-width: 1px;
  transition: all 0.2s ease;
}

.use-case-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.template-btn {
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.template-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

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

.example-box {
  background: white;
  padding: 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid #e5e7eb;
  transition: all 0.2s ease;
}

.example-box:hover {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  border-color: #d1d5db;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
}

/* Spacing */
main {
  margin-bottom: 150px;
  min-height: calc(100vh - 200px);
  padding-bottom: 60px;
}

body {
  padding-bottom: 80px;
}

footer {
  margin-top: 100px;
}

/* Code blocks */
code {
  background: #f3f4f6;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.875em;
  color: #1f2937;
}

pre {
  background: #1f2937;
  color: #f3f4f6;
  padding: 1rem;
  border-radius: 0.5rem;
  overflow-x: auto;
}

pre code {
  background: transparent;
  color: inherit;
  padding: 0;
}

/* Focus states */
button:focus,
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #667eea;
  outline-offset: 2px;
}

/* Selection */
::selection {
  background: #667eea;
  color: white;
}

::-moz-selection {
  background: #667eea;
  color: white;
}

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

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* Utilities */
.hidden {
  display: none !important;
}

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

.font-bold {
  font-weight: 700;
}

.font-semibold {
  font-weight: 600;
}

/* Mobile */
@media (max-width: 768px) {
  .stat-value {
    font-size: 1.25rem;
  }
  
  .stat-label {
    font-size: 0.65rem;
  }
  
  .btn {
    width: 100%;
    justify-content: center;
  }
  
  .card {
    padding: 1rem;
  }
  
  textarea {
    height: 250px !important;
  }

  .hero-textarea {
    min-height: 150px;
  }

  .main-nav {
    display: none;
    flex-direction: column;
    gap: 0;
    padding-top: 0;
    border-top: none;
    margin-top: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    overflow: visible;
    position: relative;
    z-index: 999;
  }
  
  .main-nav.open {
    display: flex !important;
  }
  
  .nav-item {
    width: 100%;
    padding: 1rem 1.25rem;
    border-radius: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: transparent;
    justify-content: flex-start;
    transform: none !important;
    font-size: 0.95rem;
  }
  
  .nav-item:first-child {
    border-radius: 8px 8px 0 0;
  }
  
  .nav-item:last-child {
    border-radius: 0 0 8px 8px;
    border-bottom: none;
  }
  
  .nav-item:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: none !important;
  }
  
  .nav-item.active {
    background: rgba(255, 255, 255, 0.25);
    color: white;
    border-color: transparent;
  }
  
  .hamburger-btn {
    display: block !important;
  }
  
  .sticky-header h1 {
    font-size: 1.5rem;
  }
  
  .sticky-header p {
    font-size: 0.75rem;
  }

  .tab-btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
  }
  
  .toast {
    bottom: 10px;
    right: 10px;
    left: 10px;
    max-width: calc(100% - 20px);
    font-size: 13px;
    padding: 12px 16px;
  }

  main {
    margin-bottom: 120px;
    padding-bottom: 40px;
  }
  
  .tab-content-wrapper {
    margin-bottom: 60px;
  }
  
  body {
    padding-bottom: 60px;
  }

  .use-case-card {
    margin-bottom: 0.5rem;
  }

  .example-box {
    padding: 0.5rem;
  }

  .template-btn {
    font-size: 0.75rem;
    padding: 0.375rem 0.625rem;
  }

  .intent-card {
    margin-bottom: 0.5rem;
  }
}

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

:focus-visible {
  outline: 2px solid #667eea;
  outline-offset: 2px;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Print */
@media print {
  .quick-access-menu,
  .tab-navigation,
  .card button,
  #site-header {
    display: none;
  }

  .tab-content {
    display: block !important;
  }

  main {
    margin-bottom: 0;
    padding-bottom: 0;
  }
}

/* Dropdown nav (details/summary) */
.nav-dd {
  position: relative;
  flex-shrink: 0;
}

.nav-dd > summary.nav-item {
  list-style: none;
}

.nav-dd > summary.nav-item::-webkit-details-marker {
  display: none;
}

.nav-dd-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 220px;
  padding: 0.5rem;
  border-radius: 12px;
  background: white;
  border: 1px solid rgba(0,0,0,0.12);
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
  z-index: 9999;
}

.nav-subitem {
  display: block;
  padding: 0.6rem 0.7rem;
  border-radius: 10px;
  text-decoration: none;
  color: #111827;
  font-weight: 600;
}

.nav-subitem:hover {
  background: rgba(0,0,0,0.06);
}

/* Mobile: dropdown should flow inside the vertical menu */
@media (max-width: 768px) {
  .nav-dd-menu {
    position: static;
    box-shadow: none;
    border: 0;
    background: transparent;
    padding: 0.25rem 0 0.5rem;
  }

  .nav-subitem {
    color: white;
    opacity: 0.95;
    padding-left: 1.5rem;
  }

  .nav-subitem:hover {
    background: rgba(255,255,255,0.12);
  }
}


/* ---------- Dropdown fixes for details/summary ---------- */

/* 1) Allow dropdowns to render outside the horizontal scroll area */
.main-nav {
  overflow: visible !important;           /* overrides overflow-x:auto */
}

/* If you still want horizontal scroll, do it on a wrapper instead of main-nav.
   Quick fix: allow wrapping (better than broken dropdowns) */
.main-nav {
  flex-wrap: wrap !important;
}

/* 2) Make details behave nicely in the flex row */
.nav-dd {
  position: relative;
  flex-shrink: 0;
}

.nav-dd > summary.nav-item {
  list-style: none;
}

.nav-dd > summary.nav-item::-webkit-details-marker {
  display: none;
}

/* 3) Style + layer the dropdown menu */
.nav-dd-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 220px;
  padding: 0.5rem;
  border-radius: 12px;
  background: white;
  border: 1px solid rgba(0,0,0,0.12);
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
  z-index: 9999;
}

/* 4) Sub-items visible everywhere */
.nav-subitem {
  display: block;
  padding: 0.6rem 0.7rem;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
  color: #111827;
}

.nav-subitem:hover {
  background: rgba(0,0,0,0.06);
}

/* Mobile: dropdown should flow in the vertical menu and be readable */
@media (max-width: 768px) {
  .nav-dd-menu {
    position: static;
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0.25rem 0 0.5rem;
  }

  .nav-subitem {
    color: white;
    opacity: 0.95;
    padding-left: 1.75rem;
  }

  .nav-subitem:hover {
    background: rgba(255,255,255,0.12);
  }
}
