:root {
  --bg: #050505;
  --surface: rgba(20, 20, 20, 0.7);
  --surface-border: rgba(255, 255, 255, 0.1);
  --text: #ffffff;
  --text-muted: #a1a1aa;
  --primary: #D72638;
  --accent: #FF4D8D;
  --gradient: linear-gradient(135deg, var(--primary), var(--accent));
  --glow: 0 0 20px rgba(215, 38, 56, 0.3);
  --glass: blur(12px) saturate(180%);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg);
  background-image: 
    radial-gradient(circle at 50% -20%, rgba(215, 38, 56, 0.15), transparent 50%),
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 100% 100%, 40px 40px, 40px 40px;
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

body::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3%3Ffilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  opacity: 0.03;
  pointer-events: none;
  z-index: 9999;
}

a {
  color: inherit;
  text-decoration: none;
  transition: opacity 0.2s;
}

a:hover {
  opacity: 0.8;
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 80px 20px 40px;
}

/* Navbar */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: rgba(5, 5, 5, 0.8);
  backdrop-filter: var(--glass);
  border-bottom: 1px solid var(--surface-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  z-index: 100;
}

.brand {
  font-size: 1.5rem;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.02em;
}

/* Desktop Nav Visibility */
.desktop-nav {
  display: flex;
  align-items: center;
  gap: 32px;
}

.desktop-nav a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
}

.desktop-nav a:hover {
  color: var(--text);
}

/* Hamburger Toggle - Hidden by default */
.hamburger-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px;
}

.hamburger-toggle .bar {
  width: 25px;
  height: 2px;
  background-color: white;
  transition: 0.3s;
}

/* Side Drawer Styles */
.mobile-drawer {
  position: fixed;
  top: 0;
  right: -300px; /* Hidden off-screen */
  width: 300px;
  height: 100vh;
  background: #0a0a0a;
  border-left: 1px solid var(--surface-border);
  z-index: 1000;
  padding: 30px;
  display: flex;
  flex-direction: column;
  transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: -10px 0 30px rgba(0,0,0,0.5);
}

.mobile-drawer.open {
  right: 0;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 50px;
}

.close-drawer {
  background: none;
  border: none;
  color: white;
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
}

.drawer-links {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.drawer-links a {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-muted);
}

.drawer-links a:hover {
  color: var(--accent);
}

/* Overlay */
.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: 0.3s;
  z-index: 999;
}

.drawer-overlay.visible {
  opacity: 1;
  visibility: visible;
}

@media (max-width: 768px) {
  .desktop-nav {
    display: none;
  }
  
  .hamburger-toggle {
    display: flex;
  }
}

/* Buttons */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

.button.primary {
  background: var(--gradient);
  color: white;
  box-shadow: var(--glow);
}

.button.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 30px rgba(215, 38, 56, 0.5);
}

.button.secondary {
  background: rgba(255, 255, 255, 0.05);
  color: white;
  border: 1px solid var(--surface-border);
}

.button.secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Cards & Panels */
.panel {
  background: var(--surface);
  backdrop-filter: var(--glass);
  border: 1px solid var(--surface-border);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.workspace {
  display: flex;
  flex-direction: column;
  gap: 40px;
  max-width: 800px;
  margin: 0 auto;
}

/* Forms */
.tool-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.floating-form {
  position: relative;
  background: rgba(15, 15, 15, 0.6);
  border: 1px solid var(--surface-border);
  border-radius: 20px;
  padding: 40px;
  backdrop-filter: var(--glass);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

input, select, textarea {
  background: #121212;
  border: 1px solid var(--surface-border);
  border-radius: 10px;
  padding: 12px 16px;
  color: white;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
  appearance: none;
}

select option {
  background: #121212;
  color: white;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* Script Result Styling */
.result-card {
  margin-top: 40px;
  background: rgba(20, 20, 20, 0.8);
  border: 1px solid var(--surface-border);
  border-radius: 16px;
  padding: 40px;
}

.result-section {
  margin-bottom: 32px;
  border-bottom: 1px solid var(--surface-border);
  padding-bottom: 24px;
}

.result-header {
  display: flex;
  justify-content: center; /* Center the title */
  align-items: center;
  margin-bottom: 16px;
  position: relative;
}

.result-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: #ffffff; /* White text */
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
}

.result-timestamp {
  position: absolute;
  right: 0;
  font-family: monospace;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff; /* White text */
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 0.9rem;
}

.result-content {
  font-size: 1.1rem;
  color: #ffffff; /* White text */
  line-height: 1.8;
  white-space: pre-wrap;
}

/* PDF / Pure Print Styles */
.pure-pdf {
  background: #ffffff !important;
  color: #000000 !important;
  padding: 40px !important;
  margin: 0 !important;
  font-family: serif !important;
}

.pure-pdf .brand {
  color: #000000 !important;
  background: none !important;
  -webkit-text-fill-color: #000000 !important;
  text-align: center !important;
  font-size: 24pt !important;
  font-weight: bold !important;
  margin: 0 0 30px 0 !important;
  padding: 0 0 10px 0 !important;
  border-bottom: 2px solid #000000 !important;
  display: block !important;
  width: 100% !important;
}

.pure-pdf .result-section {
  margin-bottom: 30px !important;
  padding-bottom: 20px !important;
  border-bottom: 1px solid #eeeeee !important;
  page-break-inside: avoid !important;
}

.pure-pdf .result-header {
  display: flex !important;
  justify-content: center !important; /* Headline in center */
  align-items: center !important;
  margin-bottom: 15px !important;
  position: relative !important;
}

.pure-pdf .result-title {
  color: #000000 !important;
  font-size: 16pt !important;
  font-weight: bold !important;
  text-transform: uppercase !important;
  text-align: center !important;
}

.pure-pdf .result-timestamp {
  position: absolute !important;
  right: 0 !important; /* Timestamp on right */
  color: #444444 !important;
  font-size: 11pt !important;
  background: none !important;
  border: none !important;
  padding: 0 !important;
}

.pure-pdf .result-content {
  color: #000000 !important;
  font-size: 12pt !important;
  line-height: 1.6 !important;
  white-space: pre-wrap !important;
  text-align: justify !important;
}


.action-bar {
  display: flex;
  gap: 16px;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--surface-border);
}

/* Pricing */
.pricing-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 24px;
  margin-top: 40px;
  align-items: stretch;
}

.price-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 20px;
  padding: 40px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  transition: transform 0.3s;
  flex: 1;
  min-width: 300px;
  max-width: 380px;
}

.price-card:hover {
  transform: translateY(-8px);
}

.price-card.featured {
  border-color: var(--primary);
  box-shadow: 0 0 30px rgba(215, 38, 56, 0.2);
}

.price {
  font-size: 3rem;
  font-weight: 800;
}

/* Utilities */
.htmx-indicator {
  display: none;
}
.htmx-request.htmx-indicator,
.htmx-request .htmx-indicator {
  display: block;
}

/* Interactive Loader */
#script-loader {
    margin: 40px auto;
    max-width: 400px;
}

.loader-status {
    margin-top: 20px;
    font-size: 1.1rem;
    color: var(--primary);
    font-weight: 500;
    min-height: 1.5em;
}

.loader-subtext {
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

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

.pulse {
    animation: pulse 2s infinite ease-in-out;
}

@media (max-width: 768px) {
  main {
    padding: 100px 16px 40px;
  }
  
  .topbar {
    padding: 0 20px;
  }
  
  .brand {
    font-size: 1.2rem;
  }
  
  .nav {
    display: none; /* Mobile nav would need a menu */
  }

  .floating-form {
    padding: 24px;
  }

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

  .price-card {
    min-width: 100%;
  }

  .action-bar {
    flex-direction: column;
  }

  .action-bar .button {
    width: 100%;
  }
}
