@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  /* Vibrant Palette */
  --primary: #8A2BE2; /* BlueViolet */
  --primary-dark: #6A1B9A; /* Purple */
  --primary-light: #BA68C8; /* Orchid */
  --secondary: #00BCD4; /* Cyan */
  --accent: #FF4081; /* Pink */
  --vibrant-gradient: linear-gradient(135deg, #6A1B9A 0%, #00BCD4 50%, #FF4081 100%);
  --vibrant-gradient-rev: linear-gradient(135deg, #FF4081 0%, #00BCD4 50%, #6A1B9A 100%);

  /* Supporting Colors */
  --dark: #263238; /* Blue Grey Dark */
  --light: #ECEFF1; /* Blue Grey Light */
  --gray-100: #f8f9fa; /* Very Light Gray */
  --gray-200: #e9ecef; /* Light Gray */
  --gray-300: #dee2e6; /* Gray */
  --gray-800: #495057; /* Dark Gray */
  
  --youtube: #ff0000;
  --success: #4CAF50; /* Green */
  --error: #F44336; /* Red */
}

* {
  box-sizing: border-box;
  transition: all 0.2s ease;
}

body {
  /* Apply the vibrant gradient background */
  background: var(--vibrant-gradient);
  background-attachment: fixed; /* Keep gradient fixed during scroll */
  font-family: 'Inter', sans-serif;
  margin: 0;
  padding: 0;
  color: var(--dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column; /* Stack header, main, footer */
}

.app-header {
  text-align: center;
  padding: 30px 20px 25px 20px; /* Adjust padding slightly */
  background-color: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

h1 {
  margin: 0 0 8px 0; /* Adjust margin */
  color: var(--light);
  font-weight: 700;
  font-size: 2.4rem; /* Slightly adjust size */
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
  position: relative;
  padding-bottom: 12px; /* Adjust padding */
}

h1 .fa-youtube {
  color: var(--youtube);
  margin-right: 8px;
}

h1::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100px; /* Wider */
  height: 4px;
  background: var(--vibrant-gradient-rev); /* Use reverse gradient */
  border-radius: 2px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.tagline {
  color: var(--light); /* Light text */
  font-size: 1.2rem; /* Slightly larger */
  margin-top: 0;
  font-weight: 400; /* Lighter weight */
  text-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Main content area styling */
.content-wrapper {
  flex-grow: 1; /* Allow main content to fill available space */
  width: 100%;
  max-width: 850px; /* Limit content width for readability */
  margin: 40px auto; /* Center content horizontally */
  padding: 40px;
  background: rgba(255, 255, 255, 0.9); /* More opaque background */
  box-shadow: 0 15px 50px rgba(0,0,0,0.15);
  border-radius: 16px;
  backdrop-filter: blur(5px);
}

#scriptForm {
  display: grid;
  gap: 28px; /* Slightly more gap */
}

.input-group {
  position: relative;
}

.input-group.focused input,
.input-group.focused textarea {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 4px rgba(138, 43, 226, 0.15); /* Adjusted focus shadow */
  background: white;
}

label {
  display: block;
  margin-bottom: 10px; /* More margin */
  font-weight: 600;
  color: var(--dark); /* Use dark color for labels on light background */
  font-size: 1rem;
}

label i {
  margin-right: 8px;
  color: var(--primary); /* Use primary color */
  width: 20px; /* Ensure consistent icon alignment */
  text-align: center;
}

.tooltip {
  position: relative;
  display: inline-block;
  cursor: help;
  margin-left: 5px; /* Space out tooltip icon */
}

.tooltip i {
  color: var(--gray-300);
  font-size: 0.9rem;
  transition: color 0.3s ease; /* Add transition to icon */
}

.tooltip:hover i {
  color: var(--primary-dark);
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 130%; /* Position slightly higher */
  left: 50%;
  transform: translateX(-50%);
  background: var(--dark);
  color: white;
  padding: 8px 14px; /* Adjust padding */
  border-radius: 8px;
  font-size: 0.85rem;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 10;
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.tooltip:hover::after {
  opacity: 1;
  visibility: visible;
}

input[type="password"], textarea {
  width: 100%;
  padding: 15px 18px; /* Slightly larger padding */
  border: 1px solid var(--gray-300); /* Use gray-300 for border */
  background: var(--gray-100); /* Lighter background */
  border-radius: 10px; /* Slightly more rounded */
  font-size: 1rem;
  font-family: 'Inter', sans-serif;
  color: var(--dark);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.05); /* Inset shadow */
  transition: border-color 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease; /* Smoother focus transition */
}

input[type="password"]:focus, textarea:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 4px rgba(138, 43, 226, 0.15); /* Adjusted focus shadow */
  background: white;
}

textarea {
  resize: vertical;
  min-height: 130px; /* Taller textarea */
}

.character-count {
  text-align: right;
  font-size: 0.9rem; /* Slightly larger */
  color: var(--gray-800);
  margin-top: 6px;
}

.action-area {
  margin-top: 15px; /* More space */
  display: flex;
  justify-content: center;
}

button {
  /* Apply reverse vibrant gradient */
  background: var(--vibrant-gradient-rev); 
  color: white;
  border: none;
  border-radius: 10px; /* Match input fields */
  padding: 18px 32px; /* Larger padding */
  font-weight: 600;
  font-size: 1.1rem; /* Slightly larger font */
  cursor: pointer;
  transition: all 0.3s ease;
  /* More subtle shadow */
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2); 
  position: relative;
  overflow: hidden;
  width: 100%;
  max-width: 350px; /* Wider button */
  margin: 10px auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2); /* Add text shadow */
}

button i {
  margin-right: 12px; /* More space for icon */
}

button:hover {
  transform: translateY(-3px); /* More pronounced hover effect */
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
  /* Slightly change gradient on hover - subtle */
  background: linear-gradient(135deg, #FF508F 0%, #00ACC1 50%, #7A2DAE 100%);
}

button:active {
  transform: translateY(0px); /* Reset transform */
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

/* Ripple effect needs adjustment if kept - simplified for now */
button::after {
 content: ""; /* Keep for potential future effects */
}

#loading {
  display: flex; /* Use flex for centering */
  align-items: center;
  justify-content: center;
  padding: 30px;
  font-size: 1.2rem;
  color: var(--primary-dark);
  text-align: center;
  background-color: rgba(255, 255, 255, 0.8);
  border-radius: 10px;
  margin-top: 30px;
}

#loading i {
  margin-right: 12px;
  font-size: 1.5rem;
  color: var(--primary);
  animation: spin 1.5s linear infinite, pulse 1.5s infinite ease-in-out;
}

/* Keyframes remain the same */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

.script-content {
  margin-top: 30px; /* Space above results */
  padding: 30px;
  background-color: var(--light); /* Light background for readability */
  border-radius: 10px;
  border: 1px solid var(--gray-200);
  box-shadow: 0 4px 10px rgba(0,0,0,0.05);
  line-height: 1.6; /* Add base line-height */
}

.script-content:empty {
  display: none; /* Hide if empty */
}

.script-content h2 {
  margin-top: 0;
  margin-bottom: 20px;
  color: var(--primary-dark);
  font-weight: 600;
  border-bottom: 2px solid var(--primary-light);
  padding-bottom: 10px;
}

/* Style the container for rendered HTML */
.output-html-content {
    font-family: 'Inter', sans-serif;
    color: var(--dark);
    max-height: 60vh; /* Limit height and make scrollable */
    overflow-y: auto;
    padding: 10px; /* Add some internal padding */
    background-color: var(--gray-100); /* Slightly different bg */
    border-radius: 8px;
    border: 1px solid var(--gray-200);
    margin-bottom: 25px; /* Space before action buttons */
}

/* Basic styling for rendered markdown elements */
.output-html-content h3 {
    font-size: 1.4rem;
    color: var(--primary-dark);
    margin-top: 1.5em;
    margin-bottom: 0.8em;
    font-weight: 600;
}

.output-html-content h4 {
    font-size: 1.2rem;
    color: var(--primary);
    margin-top: 1.2em;
    margin-bottom: 0.6em;
    font-weight: 600;
}

.output-html-content p {
    margin-bottom: 1em;
}

.output-html-content ul,
.output-html-content ol {
    margin-bottom: 1em;
    padding-left: 2em;
}

.output-html-content li {
    margin-bottom: 0.5em;
}

.output-html-content strong {
    font-weight: 700;
}

.output-html-content em {
    font-style: italic;
}

.output-html-content code {
    background-color: var(--gray-200);
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
}

.output-html-content pre {
    background-color: var(--gray-200);
    padding: 1em;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 1em;
}
.output-html-content pre code {
    background-color: transparent;
    padding: 0;
    border-radius: 0;
    font-size: 0.9em;
}

/* Adjust action area within results */
.result-actions {
    margin-top: 0; /* Remove top margin, handled by output container */
    gap: 15px; /* Add gap between buttons */
    justify-content: center; /* Center buttons */
    flex-wrap: wrap; /* Allow buttons to wrap on small screens */
}

#copyBtn, #exportDocsBtn {
  /* Style copy button similar to generate */
  background: var(--secondary); /* Use secondary color */
  margin-top: 0; /* Remove individual margin */
  max-width: 220px; /* Adjust max-width */
  padding: 12px 20px; /* Adjust padding */
  font-size: 0.95rem;
  box-shadow: 0 4px 12px rgba(0, 188, 212, 0.3); /* Adjusted shadow */
}

#copyBtn:hover, #exportDocsBtn:hover {
  background: #00ACC1; /* Darker cyan */
  box-shadow: 0 6px 18px rgba(0, 188, 212, 0.4);
  transform: translateY(-2px);
}

#copyBtn:active, #exportDocsBtn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0, 188, 212, 0.3);
}

/* Specific style for Export button if needed, e.g., different color */
#exportDocsBtn {
    background: var(--primary); /* Example: Use primary color */
    box-shadow: 0 4px 12px rgba(138, 43, 226, 0.3);
}

#exportDocsBtn:hover {
    background: var(--primary-dark);
    box-shadow: 0 6px 18px rgba(138, 43, 226, 0.4);
}

#exportDocsBtn:active {
    box-shadow: 0 2px 8px rgba(138, 43, 226, 0.3);
}

.app-footer {
  text-align: center;
  padding: 20px 20px; /* Adjust padding */
  margin-top: 40px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
  background-color: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(5px);
  position: relative; /* Needed if you want absolute positioning inside later */
}

/* Style for the new footer logo */
.footer-logo {
  display: block; /* Allows margin auto */
  max-height: 35px; /* Adjust size as needed for footer */
  margin: 0 auto 10px auto; /* Center and add space below the text */
  opacity: 0.8; /* Slightly more subtle in footer */
}

.app-footer p {
    margin: 0; /* Remove default paragraph margin */
}

/* Style for the footer link */
.footer-link {
  color: rgba(255, 255, 255, 0.9); /* Make link slightly brighter */
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
}

.footer-link:hover {
  color: white; /* Brighten on hover */
  text-decoration: underline;
}

/* Notification styles - largely unchanged, adjust colors */
.notification {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(150%); /* Start off-screen */
  min-width: 300px;
  max-width: 500px;
  background-color: var(--dark);
  color: white;
  border-radius: 8px;
  padding: 15px 20px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 1000;
  transition: transform 0.4s ease-in-out;
  border-left: 5px solid transparent; /* For status indication */
}

.notification.show {
  transform: translateX(-50%) translateY(0); /* Slide in */
}

.notification.success {
  background-color: var(--success); /* Use success color */
  border-left-color: #388E3C; /* Darker green */
}
.notification.success i { color: white; }

.notification.error {
  background-color: var(--error); /* Use error color */
  border-left-color: #D32F2F; /* Darker red */
}
.notification.error i { color: white; }

.notification-content {
  display: flex;
  align-items: center;
  flex-grow: 1;
}

.notification-content i {
  margin-right: 12px;
  font-size: 1.2rem;
}

.notification-content span {
  font-size: 1rem;
}

.close-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0 5px;
  margin-left: 15px;
  line-height: 1;
}

.close-btn:hover {
  color: white;
}

/* Responsive adjustments */
@media screen and (max-width: 900px) {
  .content-wrapper {
    max-width: 95%; 
    margin: 30px auto;
    padding: 30px;
  }
  /* Adjust header padding on medium screens */
  .app-header {
    padding: 25px 15px 20px 15px;
  }
}

@media screen and (max-width: 600px) {
  h1 {
    font-size: 1.8rem; /* Smaller heading */
    padding-bottom: 10px;
  }
  h1::after {
    width: 80px; /* Smaller underline */
  }
  .tagline {
    font-size: 1rem; /* Smaller tagline */
  }
  .content-wrapper {
    padding: 25px 15px; /* Adjust padding */
    margin: 20px auto;
    border-radius: 12px; /* Adjust radius */
  }
  #scriptForm {
    gap: 20px; /* Less gap */
  }
  label {
    font-size: 0.95rem; /* Slightly smaller labels */
    margin-bottom: 8px;
  }
  input[type="password"], textarea {
     padding: 12px 15px; 
     font-size: 0.95rem;
  }
  textarea {
    min-height: 110px; /* Adjust height */
  }
  button, #copyBtn, #exportDocsBtn { /* Include export button */
    padding: 12px 15px; /* Adjust button padding */
    font-size: 0.9rem;
    max-width: 180px; /* Adjust max-width */
    flex-grow: 1; /* Allow buttons to grow and potentially stack */
    min-width: 140px; /* Ensure minimum width */
  }
  .script-content {
      padding: 20px 15px;
  }
  .output-html-content {
      padding: 5px;
      max-height: 55vh;
  }
  .output-html-content h3 {
      font-size: 1.2rem;
  }
  .output-html-content h4 {
      font-size: 1.1rem;
  }
  .result-actions {
      gap: 10px;
  }
  .app-footer {
      padding: 15px 15px; /* Adjust padding */
      font-size: 0.85rem;
  }
  /* Adjust footer logo size on small screens */
  .footer-logo {
      max-height: 30px;
      margin-bottom: 8px;
  }
  .notification {
      width: 90%;
      bottom: 10px;
      padding: 12px 15px;
      font-size: 0.9rem;
  }
  .notification-content i {
      font-size: 1rem;
  }
}

@media screen and (max-width: 400px) {
    h1 {
        font-size: 1.6rem;
    }
    .tagline {
        font-size: 0.9rem;
    }
    button {
        padding: 12px 15px;
        font-size: 0.95rem;
  }
}