/* Global reset and base styles */
@import url('https://fonts.googleapis.com/css2?family=Comic+Neue:wght@400;700&display=swap');


* {
  box-sizing: border-box;
}

body {
  font-family: 'Comic Sans MS', 'Comic Neue', sans-serif;
  background: linear-gradient(135deg, #0a0a0a 0%, #1a0a1a 50%, #0a1a2a 100%);
  background-attachment: fixed;
  color: #87ceeb;
  margin: 0;
  padding: 0;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  font-size: 1.2em; /* 20% larger than default 1em */
}

a {
  color: #ff007f;
  text-decoration: none;
  text-shadow: 0 0 5px #ff007f;
  transition: all 0.3s ease;
}
a:hover {
  color: #87ceeb;
  text-shadow: 0 0 10px #87ceeb;
  text-decoration: underline;
}

/* Container styles */
.container, main.container {
  width: 100%;
  margin: 0;
  padding: 2em;
  background: rgba(10, 10, 30, 0.9);
  border: none;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: blur(10px);
  min-height: 100vh
  ;
}



/* Home page specific styles */
.home-container {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 2em;
  background: rgba(10, 10, 30, 0.9);
  border: none;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: blur(10px);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

/* Adjust main content for home page */
.main-content .home-container {
  min-height: auto;
  background: transparent;
  backdrop-filter: none;
  width: 100%;
  max-width: none;
 


}

.page-layout .main-content {
  background: rgba(10, 10, 30, 0.9);
  border-radius: 8px;
  backdrop-filter: blur(10px);
}

.tagline {
  margin-left: 70px; /* Adjust the pixel value as needed */
}

.input-placeholder{
margin-left: 40px;
}

.submit-button{
margin-left: 85px;
}

/* Loading/Analyzing styles */
.loading-container {
  text-align: center;
  padding: 2em 0;
  max-width: 600px;
  margin: 0 auto;
}

.spinner {
  width: 60px;
  height: 60px;
  border: 6px solid rgba(255, 0, 127, 0.2);
  border-top: 6px solid #ff007f;
  border-right: 6px solid #87ceeb;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1em auto;
  box-shadow: 0 0 20px rgba(255, 0, 127, 0.5);
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.progress-steps {
  margin-top: 2em;
  text-align: left;
  max-width: 400px;
  width: 90%;
  margin-left: auto;
  margin-right: auto;
}

.step {
  padding: 0.8em 1em;
  margin: 0.5em 0;
  border-radius: 5px;
  background: rgba(20, 20, 40, 0.8);
  color: #888;
  transition: all 0.3s ease;
  border-left: 4px solid #333;
  border: 1px solid rgba(255, 0, 127, 0.2);
}

.step.active {
  background: rgba(255, 0, 127, 0.1);
  color: #ff007f;
  border-left-color: #ff007f;
  border-color: #ff007f;
  font-weight: 500;
  box-shadow: 0 0 10px rgba(255, 0, 127, 0.3);
}

.step.completed {
  background: rgba(135, 206, 235, 0.1);
  color: #87ceeb;
  border-left-color: #87ceeb;
  border-color: #87ceeb;
  box-shadow: 0 0 10px rgba(135, 206, 235, 0.3);
}

.step.completed::after {
  content: " ✓";
  color: #4caf50;
  font-weight: bold;
}

/* Headings */
h1, h2 {
  color: #ff007f;
  margin-top: 0;
  text-shadow: 0 0 10px rgba(255, 0, 127, 0.5);
  font-family: 'Comic Sans MS', 'Comic Neue', sans-serif;
  font-weight: bold;
}

h1 {
  font-size: 2.2em; /* 20% larger than 2em */
  margin-bottom: 0.5em;
}

h2 {
  font-size: 1.8em; /* 20% larger than 1.5em */
  margin-bottom: 1em;
}

/* Forms */
form {
  margin: 1em 0;
  max-width: 500px;
  width: 100%;
  margin-left: 32px;
}

input[type="text"], textarea, select {
  width: 100%;
  padding: 0.7em;
  font-size: 19px; /* 20% larger than 16px, still prevents zoom on iOS */
  background: rgba(10, 10, 30, 0.8);
  color: #87ceeb;
  border: 2px solid #ff007f;
  border-radius: 4px;
  box-sizing: border-box;
  margin-top: 0.5em;
  margin-bottom: 1em;
  font-family: 'Comic Sans MS', 'Comic Neue', sans-serif;
  min-height: 44px; /* Touch-friendly height */
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

input[type="text"]:focus, textarea:focus, select:focus {
  border-color: #87ceeb;
  outline: none;
  box-shadow: 0 0 15px rgba(135, 206, 235, 0.5);
  background: rgba(10, 10, 30, 0.9);
}

/* Buttons */
button, .btn {
  background: linear-gradient(45deg, #ff007f, #ff3399);
  color: white;
  padding: 0.7em 1.2em;
  border: 2px solid #ff007f;
  border-radius: 4px;
  font-size: 19px; /* 20% larger than 16px */
  font-family: 'Comic Sans MS', 'Comic Neue', sans-serif;
  font-weight: bold;
  cursor: pointer;
  margin: 0.5em 0.5em 0.5em 0;
  display: inline-block;
  text-decoration: none;
  min-width: 120px;
  min-height: 44px; /* iOS recommended touch target */
  text-align: center;
  box-sizing: border-box;
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
  box-shadow: 0 0 15px rgba(255, 0, 127, 0.4);
  transition: all 0.3s ease;
  -webkit-tap-highlight-color: transparent;
}

button:hover, .btn:hover {
  background: linear-gradient(45deg, #87ceeb, #4682b4);
  border-color: #87ceeb;
  color: white;
  box-shadow: 0 0 25px rgba(135, 206, 235, 0.6);
  transform: translateY(-2px);
}

/* Ensure all buttons in button row have consistent styling */
.button-row button,
.button-row .btn {
  background: linear-gradient(45deg, #ff007f, #ff3399);
  color: white;
  padding: 0.7em 1.2em;
  border: 2px solid #ff007f;
  border-radius: 4px;
  font-size: 19px; /* 20% larger than 16px */
  font-family: 'Comic Sans MS', 'Comic Neue', sans-serif;
  font-weight: bold;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  min-width: 120px;
  text-align: center;
  box-sizing: border-box;
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
  box-shadow: 0 0 15px rgba(255, 0, 127, 0.4);
  transition: all 0.3s ease;
}

.button-row button:hover,
.button-row .btn:hover {
  background: linear-gradient(45deg, #87ceeb, #4682b4);
  border-color: #87ceeb;
  color: white;
  box-shadow: 0 0 25px rgba(135, 206, 235, 0.6);
  transform: translateY(-2px);
}

/* Analysis output */
#analysis-output {
  background: rgba(5, 5, 20, 0.9);
  border: 2px solid #87ceeb;
  padding: 1.5em;
  margin: 1em auto;
  max-width: 1000px;
  width: 90%;
  border-radius: 8px;
  box-shadow: 0 0 20px rgba(135, 206, 235, 0.2), inset 0 0 10px rgba(255, 0, 127, 0.1);
  color: #87ceeb;
}

/* Markdown rendering styles for analysis output */
#analysis-output h1,
#analysis-output h2,
#analysis-output h3,
#analysis-output h4,
#analysis-output h5,
#analysis-output h6 {
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  font-weight: bold;
}

#analysis-output h1 { font-size: 2.16em; /* 20% larger than 1.8em */ color: #ff007f; text-shadow: 0 0 8px rgba(255, 0, 127, 0.5); }
#analysis-output h2 { font-size: 1.8em; /* 20% larger than 1.5em */ color: #87ceeb; text-shadow: 0 0 6px rgba(135, 206, 235, 0.5); }
#analysis-output h3 { font-size: 1.56em; /* 20% larger than 1.3em */ color: #ff007f; text-shadow: 0 0 4px rgba(255, 0, 127, 0.4); }

#analysis-output p {
  margin: 1em 0;
  line-height: 1.6;
}

#analysis-output ul, #analysis-output ol {
  margin: 1em 0;
  padding-left: 2em;
}

#analysis-output li {
  margin: 0.5em 0;
}

#analysis-output strong {
  font-weight: bold;
}

#analysis-output em {
  font-style: italic;
}

#analysis-output code {
  background: rgba(255, 0, 127, 0.1);
  color: #ff007f;
  padding: 2px 4px;
  border: 1px solid rgba(255, 0, 127, 0.3);
  border-radius: 3px;
  font-family: 'Courier New', monospace;
}

#analysis-output blockquote {
  border-left: 4px solid #87ceeb;
  margin: 1em 0;
  padding-left: 1em;
  color: #87ceeb;
  background: rgba(135, 206, 235, 0.05);
  border-radius: 0 4px 4px 0;
}

/* Button row with consistent sizing */
.button-row {
  margin: 2em auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
  align-items: center;
  justify-content: center;
  max-width: 800px;
  width: 90%;
}

.button-row button,
.button-row .btn,
.button-row form {
  margin: 0;
}

.button-row form {
  display: inline-block;
}

/* Chat specific styles */
.chat-box {
  background: rgba(5, 5, 20, 0.9);
  border: 2px solid #ff007f;
  padding: 1em;
  margin: 1em auto;
  max-width: 1000px;
  width: 90%;
  max-height: 400px;
  overflow-y: auto;
  border-radius: 8px;
  box-shadow: 0 0 15px rgba(255, 0, 127, 0.3);
}

.message {
  margin: 0.5em 0;
  padding: 0.5em;
  border-radius: 6px;
  border: 1px solid transparent;
}

.user-msg {
  color: #ff007f;
  background: rgba(255, 0, 127, 0.1);
  border-color: rgba(255, 0, 127, 0.3);
  text-shadow: 0 0 3px rgba(255, 0, 127, 0.3);
}

.ai-msg {
  color: #87ceeb;
  background: rgba(135, 206, 235, 0.1);
  border-color: rgba(135, 206, 235, 0.3);
  text-shadow: 0 0 3px rgba(135, 206, 235, 0.3);
}

/* Markdown styling within chat messages */
.ai-msg h1, .ai-msg h2, .ai-msg h3, .ai-msg h4, .ai-msg h5, .ai-msg h6 {
  color: #ff007f;
  margin: 0.5em 0 0.3em 0;
  text-shadow: 0 0 5px rgba(255, 0, 127, 0.4);
}

.ai-msg p {
  margin: 0.5em 0;
  line-height: 1.4;
}

.ai-msg ul, .ai-msg ol {
  margin: 0.5em 0;
  padding-left: 1.5em;
}

.ai-msg li {
  margin: 0.2em 0;
}

.ai-msg strong {
  color: #ff007f;
  font-weight: bold;
}

.ai-msg em {
  color: #87ceeb;
  font-style: italic;
}

.ai-msg code {
  background: rgba(255, 0, 127, 0.2);
  color: #ff007f;
  padding: 2px 4px;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
}

.ai-msg blockquote {
  border-left: 3px solid #ff007f;
  margin: 0.5em 0;
  padding-left: 0.8em;
  color: #87ceeb;
  background: rgba(255, 0, 127, 0.05);
  border-radius: 0 3px 3px 0;
}

/* Example text */
.example {
  color: #888;
  font-size: 17px; /* 20% larger than 14px */
  margin-top: 0.5em;
  font-style: italic;
  margin-left: 70px;
}

/* HR styling */
hr {
  border: none;
  height: 2px;
  background: linear-gradient(to right, transparent, #ff007f, #87ceeb, transparent);
  margin: 2em 0;
  box-shadow: 0 0 10px rgba(255, 0, 127, 0.3);
}

/* About Page Styles */
.about-page {
  width: 100%;
  margin: 0;
  padding: 2em;
}

.creator-heading {
  color: #ff007f !important;
  text-align: center;
  font-size: 2.64em; /* 20% larger than 2.2em */
  margin-bottom: 1.5em;
  font-weight: bold;
  text-shadow: 0 0 15px rgba(255, 0, 127, 0.6);
  font-family: 'Comic Sans MS', 'Comic Neue', sans-serif;
}

.creator-section {
  text-align: center;
  margin-bottom: 2em;
}

.creator-photo {
  width: 300px;
  height: 400px;
  object-fit: cover;
  margin: 0 auto 0.5em auto;
  display: block;
  border: 4px solid #ff007f;
  border-radius: 8px;
  box-shadow: 0 0 20px rgba(255, 0, 127, 0.4), 0 0 40px rgba(0, 212, 255, 0.2);
}

.photo-caption {
  font-size: 1.08em; /* 20% larger than 0.9em */
  color: #666;
  font-style: italic;
  margin-bottom: 1.5em;
}

.intro-text {
  text-align: left;
  max-width: 800px;
  margin: 0 auto;
  line-height: 1.7;
}

.intro-text p {
  margin-bottom: 1em;
}

.section-divider {
  border: none;
  height: 3px;
  background: linear-gradient(to right, transparent, #ff007f, #87ceeb, transparent);
  margin: 3em 0;
  box-shadow: 0 0 15px rgba(255, 0, 127, 0.4);
}

.social-section {
  text-align: center;
  margin: 2em 0;
}

.social-section h2 {
  color: #87ceeb;
  margin-bottom: 1.5em;
  text-shadow: 0 0 10px rgba(135, 206, 235, 0.5);
}

.social-links {
  display: flex;
  justify-content: center;
  gap: 1.5em;
  flex-wrap: wrap;
}

.social-link {
  display: inline-block;
  padding: 0.8em 1.5em;
  background: rgba(10, 10, 30, 0.8);
  border: 2px solid #ff007f;
  border-radius: 25px;
  text-decoration: none;
  color: #ff007f;
  font-weight: 500;
  font-family: 'Comic Sans MS', 'Comic Neue', sans-serif;
  transition: all 0.3s ease;
  min-width: 100px;
  text-align: center;
  text-shadow: 0 0 5px rgba(255, 0, 127, 0.3);
  box-shadow: 0 0 10px rgba(255, 0, 127, 0.2);
}

.social-link:hover {
  background: rgba(135, 206, 235, 0.1);
  border-color: #87ceeb;
  color: #87ceeb;
  transform: translateY(-2px);
  box-shadow: 0 0 20px rgba(135, 206, 235, 0.4);
  text-shadow: 0 0 8px rgba(135, 206, 235, 0.5);
}

.about-footer {
  text-align: center;
  margin: 2em 0;
}

.footer-quote {
  font-style: italic;
  font-size: 0.8em; /* 20% larger than 1.1em */
  color: #87ceeb;
  border-left: 4px solid #ff007f;
  padding-left: 1em;
  margin: 1.5em auto;
  /* max-width: 600px; */
  width: 90%;
  text-align: left;
  background: rgba(10, 10, 30, 0.7);
  padding: 1.5em;
  border-radius: 8px;
  border: 1px solid rgba(255, 0, 127, 0.3);
  box-shadow: 0 0 15px rgba(255, 0, 127, 0.2);
}

.back-home {
  text-align: center;
  margin-top: 3em;
}

/* Responsive design */
/* Mobile-first approach - Base styles for mobile */
@media (max-width: 480px) {
  body {
    font-size: 17px; /* 20% larger than 14px */
    padding: 0;
    margin: 0;
    

  }
  
  .container, main.container, .home-container {
    width: 100%;
    margin: 0;
    padding: 1em;
    min-height: auto;
  }
  
  .page-layout {
    gap: 10px;
    padding: 0.5em;
  }
  
  .main-content {
    margin-bottom: 10px;
    min-height: auto;
  }
  
  .left-sidebar-container,
  .right-sidebar-container {
    margin-top: 10px;
    margin-bottom: 10px;
  }
  
  .about-page {
    width: 100%;
    margin: 0;
    padding: 1em;
  }
  
  h1 {
    font-size: 1.8em; /* 20% larger than 1.5em */
    text-align: center;
    margin-bottom: 1em;
  }
  
  h2 {
    font-size: 1.56em; /* 20% larger than 1.3em */
    text-align: center;
  }
  
  /* Form elements */
  input[type="text"], textarea, select {
    font-size: 19px; /* 20% larger than 16px, still prevents zoom on iOS */
    padding: 0.8em;
    border-width: 1px;
  }
  
  /* Buttons */
  button, .btn {
    width: 100%;
    margin: 0.3em 0;
    padding: 0.8em;
    font-size: 19px; /* 20% larger than 16px */
    min-width: auto;
  }
  
  .button-row {
    flex-direction: column;
    gap: 0.3em;
  }
  
  .button-row button,
  .button-row .btn {
    width: 100%;
    margin: 0;
  }
  
  /* Chat and analysis */
  .chat-box {
    max-height: 300px;
    padding: 0.8em;
    margin: 0.8em 0;
  }
  
  #analysis-output {
    padding: 1em;
    margin: 0.8em 0;
    font-size: 17px; /* 20% larger than 14px */
  }
  
  /* Loading spinner */
  .spinner {
    width: 40px;
    height: 40px;
    border-width: 4px;
  }
  
  .progress-steps {
    max-width: 100%;
    font-size: 17px; /* 20% larger than 14px */
  }
  
  .step {
    padding: 0.6em 0.8em;
    margin: 0.3em 0;
    font-size: 17px; /* 20% larger than 14px */
  }
  
  /* About page mobile */
  .creator-heading {
    font-size: 2.16em; /* 20% larger than 1.8em */
    margin-bottom: 1em;
  }
  
  .creator-photo {
    width: 200px;
    height: 250px;
    border-width: 2px;
  }
  
  .social-links {
    flex-direction: column;
    align-items: center;
    gap: 0.8em;
  }
  
  .social-link {
    width: 80%;
    max-width: 250px;
    padding: 0.8em 1em;
    font-size: 17px; /* 20% larger than 14px */
  }
  
  /* .footer-quote {
    font-size: 1.2em; 
    padding: 1em;
    margin: 1em 0;
  } */
  
  /* Message styling */
  .message {
    padding: 0.6em;
    margin: 0.4em 0;
    font-size: 17px; /* 20% larger than 14px */
  }
}

/* Tablet styles */
@media (min-width: 481px) and (max-width: 768px) {
  .container, main.container, .home-container {
    width: 100%;
    margin: 0;
    padding: 1.5em;
  }
  
  .about-page {
    width: 100%;
    margin: 0;
    padding: 1.5em;
  }
  
  .page-layout {
    gap: 15px;
    padding: 1em;
  }
  
  .main-content {
    margin-bottom: 15px;
    min-height: auto;
  }
  
  .left-sidebar-container,
  .right-sidebar-container {
    margin-top: 15px;
  }
  
  h1 {
    font-size: 2.16em; /* 20% larger than 1.8em */
  }
  
  .button-row {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .button-row button,
  .button-row .btn {
    flex: 1;
    min-width: 120px;
    max-width: none;
    margin: 0.3em;
  }
  
  .social-links {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .social-link {
    flex: 1;
    min-width: 150px;
    max-width: 200px;
    margin: 0.5em;
  }
  
  .creator-photo {
    width: 250px;
    height: 300px;
  }
}

/* Desktop and larger screens */
@media (min-width: 769px) {
  .container, main.container, .home-container {
    width: 100%;
    margin: 0;
    padding: 3em;
  }
  
  .about-page {
    width: 100%;
    margin: 0;
    padding: 3em;
  }
  
  .home-container {
    justify-content: center;
  }
}

/* Additional utility classes */
.text-center {
  text-align: center;
}

.mt-1 { margin-top: 1em; }
.mt-2 { margin-top: 2em; }
.mb-1 { margin-bottom: 1em; }
.mb-2 { margin-bottom: 2em; }

/* Mobile-specific utilities */
.mobile-hidden {
  display: block;
}

.mobile-only {
  display: none;
}

@media (max-width: 768px) {
  .mobile-hidden {
    display: none;
  }
  
  .mobile-only {
    display: block;
  }
  
  .mobile-center {
    text-align: center;
  }
}

/* PDF-specific styling */
@media print {
  body {
    background: white !important;
    color: black !important;
  }
  
  #analysis-output {
    background: white !important;
    border: none !important;
    box-shadow: none !important;
  }
  
  .button-row {
    display: none !important;
  }
  
  a {
    color: black !important;
    text-decoration: underline !important;
  }
}

/* Ensure content is visible for PDF generation */
#analysis-output * {
  visibility: visible !important;
  opacity: 1 !important;
}

/* Layout with sidebars */
.page-layout {
  display: grid;
  grid-template-columns: 250px 1fr 200px;
  grid-template-areas: 
    "left-sidebar main right-sidebar";
  gap: 1em;
  max-width: none;
  width: 100%;
  margin: 0 auto;
  padding: 1em;
  min-height: 100vh;
  align-items: start;
}

.main-content {
  grid-area: main;
  min-height: 100vh;
  width: 100%;
  max-width: none;
}

.left-sidebar-container {
  grid-area: left-sidebar;
}

.right-sidebar-container {
  grid-area: right-sidebar;
}

/* Sidebar styling */
.left-sidebar {
  background: rgba(10, 10, 30, 0.9);
  border: 2px solid rgba(255, 0, 127, 0.3);
  border-radius: 8px;
  padding: 1em;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 15px rgba(255, 0, 127, 0.2);
  height: 100vh;
  overflow-y: auto;
  position: sticky;
  top: 1em;
  display: flex;
  flex-direction: column;
  margin-top: none;
}


/* Sidebar styling */
.right-sidebar {
  background: rgba(10, 10, 30, 0.9);
  border: 2px solid rgba(255, 0, 127, 0.3);
  border-radius: 8px;
  padding: 1em;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 15px rgba(255, 0, 127, 0.2);
  height: 100vh;
  overflow-y: auto;
  position: sticky;
  top: 1em;
  display: flex;
  flex-direction: column;
}


.sidebar-section, .ad-section {
  margin-bottom: 2em;
  padding: 1em;
  background: rgba(20, 20, 40, 0.6);
  border-radius: 6px;
  border: 1px solid rgba(135, 206, 235, 0.2);
}

/* Right sidebar specific styling - no scroll, shorter content */
.right-sidebar {
  overflow-y: visible;
}

.right-sidebar .ad-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-height: none;
}

.right-sidebar .ad-section .ad-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0.5em;
  font-size: 0.8em;
}

.sidebar-divider {
    margin-top: 0;    /* Adjust this to move divider down from above content */
    margin-bottom: 32px; /* Adjust this to move divider up from below content */
    border: none;
    border-top: 1px solid #444;
    width: 100%;
}

.sidebar-section h3, .ad-section h3 {
  color: #ff007f;
  font-size: 0.9em;
  margin-top: 0;
  margin-bottom: 0;
  text-shadow: 0 0 5px rgba(255, 0, 127, 0.5);
}

.ad-placeholder {
  /* background: rgba(135, 206, 235, 0.1);
  border: 2px dashed rgba(135, 206, 235, 0.3); */
  padding: 1em;
  text-align: center;
  border-radius: 4px;
  color: #87ceeb;
  font-size: 0.9em;
}

.creator-placeholder {
  color: #87ceeb;
  font-size: 0.9em;
  font-style: italic;
}

/* Responsive design for sidebars */
@media (max-width: 1200px) {
  .page-layout {
    grid-template-columns: 200px 1fr 200px;
    grid-template-areas: 
      "left-sidebar main right-sidebar";
  }
}

@media (max-width: 1000px) {
  .page-layout {
    grid-template-columns: 1fr;
    grid-template-areas: 
      "main"
      "left-sidebar"
      "right-sidebar";
    gap: 10px;
  }
  
  .main-content {
    margin-bottom: 10px;
  }
  
  .left-sidebar-container,
  .right-sidebar-container {
    margin-top: 10px;
  }
  
  .left-sidebar, .right-sidebar {
    height: auto;
    position: relative;
    top: auto;
    margin-top: 0;
  }
}

/* Fix for specific responsive range 969px - 1000px (desktop site on mobile) */
@media (min-width: 969px) and (max-width: 1000px) {
  .page-layout {
    display: block;
    padding: 0.5em;
  }
  
  .main-content {
    margin-bottom: 10px;
    min-height: auto;
  }
  
  .left-sidebar-container {
    margin-top: 10px;
    margin-bottom: 10px;
  }
  
  .right-sidebar-container {
    margin-top: 10px;
    margin-bottom: 0;
  }
  
  .left-sidebar, .right-sidebar {
    margin-top: 0;
    margin-bottom: 0;
    height: auto;
    position: relative;
    top: auto;
  }
}

/* Mobile layout - stacked vertically with minimal gaps */
@media (max-width: 968px) {
  .page-layout {
    display: block;
    padding: 0.5em;
  }
  
  .main-content {
    margin-bottom: 10px;
    min-height: auto;
  }
  
  .left-sidebar-container {
    margin-top: 10px;
    margin-bottom: 10px;
  }
  
  .right-sidebar-container {
    margin-top: 10px;
    margin-bottom: 0;
  }
  
  .left-sidebar, .right-sidebar {
    margin-top: 0;
    margin-bottom: 0;
  }
  
  .mobile-ad-section {
    display: block;
  }
  
  .right-sidebar .ad-section {
    display: block;
  }
  
  .right-sidebar .ad-section:first-child {
    display: block;
  }
}

/* Make left sidebar ad section match right sidebar size */
.left-sidebar .ad-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-height: none;
}

.left-sidebar .ad-section .ad-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0.5em;
  font-size: 0.8em;
}

/* Mobile-specific form and input styling to prevent overflow */
@media (max-width: 480px) {
  /* Fix form container overflow */
  .home-container form {
    margin-left: 0 !important; /* Remove the 32px left margin that causes overflow */
    padding: 0 0.5em; /* Add padding instead for breathing room */
    max-width: 100% !important; /* Ensure it doesn't exceed container width */
    box-sizing: border-box;
  }
  
  /* Fix input field overflow */
  .home-container input[type="text"] {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    margin: 0.5em 0 !important;
    padding: 0.8em 0.6em !important; /* Reduce horizontal padding slightly */
    font-size: 16px !important; /* Prevent zoom on iOS */
  }
  
  /* Fix button overflow */
  .home-container .submit-button {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    margin: 0.5em 0 !important;
    padding: 0.8em 1em !important;
    font-size: 18px !important;
  }
  
  /* Ensure the entire home container doesn't overflow */
  .home-container {
    width: 100% !important;
    max-width: 100% !important;
    padding: 1em 0.5em !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }
  
  /* Fix example text */
  .home-container .example {
    font-size: 14px !important;
    word-break: break-all !important;
    margin: 0.3em 0 0.8em 0 !important;
  }
  
  /* Fix analysis result container alignment on mobile */
  .main-content {
    padding: 0 0.5em !important; /* Add symmetrical padding to match form */
    box-sizing: border-box !important;
  }
  
  /* Adjust analysis output container */
  #analysis-output,
  .analysis-container,
  .result-container {
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding: 1em 0.5em !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  
  /* Center align the analysis content */
  .analysis-content,
  .result-content {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    padding: 0 !important;
    box-sizing: border-box !important;
  }
  
  /* Fix chat page form and elements overflow */
  .container {
    width: 100% !important;
    max-width: 100% !important;
    padding: 1em 0.5em !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }
  
  /* Chat form container */
  .container form {
    margin: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  
  /* Chat textarea */
  .container textarea {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    margin: 0.5em 0 !important;
    padding: 0.8em 0.6em !important;
    font-size: 16px !important; /* Prevent zoom on iOS */
    resize: vertical !important; /* Allow only vertical resize */
  }
  
  /* Chat send button */
  .container button[type="submit"] {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    margin: 0.5em 0 !important;
    padding: 0.8em 1em !important;
    font-size: 18px !important;
  }
  
  /* Chat box */
  .container .chat-box {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    margin: 0.5em 0 !important;
    padding: 0.8em 0.6em !important;
    overflow-x: hidden !important;
    word-wrap: break-word !important;
  }
  
  /* Back to home link */
  .container a {
    display: block !important;
    text-align: center !important;
    margin: 0.5em 0 !important;
    padding: 0.5em !important;
  }
}