/* public/style.css - Extracted from EDITOR_HTML */

:root {
  --superman-blue: #0066ff;
  --superman-red: #ff0000;
  --superman-yellow: #ffd700;
  --dark-blue: #004cb3;
  --light-gray: #f8f9fa;
  --white: #ffffff;
  --border-radius: 6px; /* Match viewer-style.css border-radius */
  --spacing-xs: 0.25rem; /* Reduced */
  --spacing-sm: 0.5rem;  /* Reduced */
  --spacing-md: 0.75rem; /* Reduced */
  --spacing-lg: 1rem;   /* Reduced */
  --box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08); /* Subtler shadow */
  --transition: all 0.2s ease;
}
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  margin: 0;
  padding: 0;
}
body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--light-gray);
  font-size: 15px;
  line-height: 1.5; /* Improved default line height */
  position: relative; /* Needed for absolute positioning of logout */
}
.container {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: var(--spacing-sm); /* Reduced */
  max-width: 100%;
  gap: var(--spacing-md); /* Reduced */
}
#editor, #preview {
  display: flex;
  flex-direction: column;
  width: 100%;
  overflow: hidden; /* Prevent content spill */
  background: var(--white);
  border-radius: var(--border-radius);
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  padding: var(--spacing-md); /* Reduced */
  margin-bottom: var(--spacing-sm); /* Reduced */
  position: relative; /* Keep for potential absolute elements */
}
#editor {
  display: flex; /* Use flex for editor layout */
  flex-direction: column; /* Stack elements vertically */
}
/* Hide fallback textarea when CM container is used */
textarea#code {
  width: 100%;
  min-height: 150px; /* Reduced min-height */
  height: 35vh; /* Keep vh for initial sizing */
  resize: vertical;
  font-family: monospace;
  font-size: 15px;
  padding: var(--spacing-md);
  border: 2px solid var(--superman-blue);
  border-radius: var(--border-radius);
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  margin-bottom: var(--spacing-md);
  position: relative; /* Needed for potential absolute elements within */
  flex-grow: 1; /* Allow textarea to grow */
}
/* CodeMirror editor container */
#cmContainer {
  width: 100%;
  border: 2px solid var(--superman-blue);
  border-radius: var(--border-radius);
  margin-bottom: var(--spacing-md); /* Consistent margin */
  overflow: hidden; /* CM manages its own scrollbars */
  position: relative; /* Keep relative for CM internal elements */
  flex-grow: 1; /* Allow CM to fill available vertical space */
  display: flex; /* Use flex to help CM size correctly */
  flex-direction: column;
}

/* NEW: Editor Toolbar */
.editor-toolbar {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-sm); /* Space below toolbar */
  position: relative; /* For clean message positioning */
  padding: var(--spacing-xs) 0; /* Minimal vertical padding */
}

.toolbar-btn {
  background: #f0f0f0;
  color: #555;
  border: 1px solid #ccc;
  padding: 5px 12px; /* Adjusted padding */
  font-size: 0.85rem;
  min-height: auto;
  height: auto;
  width: auto;
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.toolbar-btn:hover {
  background: #e0e0e0;
  border-color: #bbb;
  color: #333;
  transform: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.toolbar-btn:active {
  background: #d0d0d0;
  transform: none;
}

.toolbar-btn:disabled {
  background: #f8f9fa;
  color: #adb5bd;
  border-color: #dee2e6;
  cursor: not-allowed;
  box-shadow: none;
}

/* CodeMirror 5 specific styling */
.CodeMirror {
  flex-grow: 1; /* Allow CM instance to fill remaining space */
  font-family: monospace;
  font-size: 15px;
  line-height: 1.5;
}
/* Make sure CodeMirror's scrollbars look reasonable */
.CodeMirror-vscrollbar, .CodeMirror-hscrollbar {
  outline: none;
}
iframe#output {
  width: 100%;
  flex-grow: 1; /* Allow iframe to fill space */
  min-height: 150px; /* Reduced min-height */
  border: none;
  border-radius: var(--border-radius);
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  background: var(--white);
  margin-top: 0;
}
.app-header {
  display: flex;
  align-items: center;
  margin-bottom: var(--spacing-sm); /* Reduced */
  gap: var(--spacing-sm); /* Reduced */
  flex-shrink: 0; /* Prevent header from shrinking */
  justify-content: space-between; /* Position logo at left and hamburger at right */
}
.app-logo {
  font-size: 1.3rem; /* Slightly reduced */
  font-weight: bold;
  color: var(--superman-blue);
  margin-bottom: 0;
}
.control-panel {
  background: linear-gradient(to right, var(--superman-blue), var(--dark-blue));
  padding: var(--spacing-sm) var(--spacing-md); /* Reduced padding */
  border-radius: var(--border-radius);
  margin-bottom: var(--spacing-md);
  color: var(--white);
  box-shadow: var(--box-shadow);
  display: flex; /* Use flex for layout */
  flex-direction: column; /* Stack message area and controls */
  gap: var(--spacing-sm);
}

/* Style for the container of dropdown and publish button */
.share-controls {
  display: flex;
  flex-wrap: wrap; /* Allow wrapping on small screens */
  align-items: center;
  justify-content: center; /* Center items */
  gap: var(--spacing-md); /* Gap between dropdown and button */
}

.share-options {
  margin-bottom: 0; /* Removed margin, handled by gap */
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}
.share-section {
  background: var(--white);
  border: 2px solid var(--superman-yellow);
  border-radius: var(--border-radius);
  padding: var(--spacing-md); /* Reduced */
  margin-top: var(--spacing-md);
  margin-bottom: var(--spacing-sm);
  display: none; /* Initially hidden */
  transition: opacity 0.3s ease-out, transform 0.3s ease-out; /* Smooth fade/slide in */
  opacity: 0;
  transform: translateY(10px);
}
.share-section.visible {
    display: block;
    opacity: 1;
    transform: translateY(0);
}
.share-section h3 {
  color: var(--superman-blue);
  margin: 0 0 var(--spacing-xs) 0;
  font-size: 1.1rem; /* Slightly reduced */
  text-align: center;
}
.share-url {
    display: flex;
    flex-direction: column; /* Stack input and actions on mobile */
    gap: var(--spacing-sm); /* Reduced */
    margin-top: var(--spacing-sm);
}
.url-container { /* Container for input and copy button */
  display: flex;
  align-items: center;
  width: 100%;
}
.share-url input[type="text"] {
  flex-grow: 1; /* Take available space */
  padding: var(--spacing-sm); /* Reduced */
  border: 2px solid var(--superman-blue);
  border-radius: var(--border-radius);
  font-size: 14px; /* Reduced */
  background: var(--light-gray);
  font-family: 'Courier New', Courier, monospace;
  overflow-x: auto; /* Allow scrolling if URL is long */
  margin-right: var(--spacing-sm); /* Space before inline copy button */
}
.url-actions {
  display: flex;
  gap: var(--spacing-sm); /* Reduced */
  width: 100%; /* Full width on mobile */
}
button {
  padding: var(--spacing-sm); /* Reduced */
  font-size: 14px; /* Reduced */
  cursor: pointer;
  background: var(--superman-blue);
  color: var(--white);
  border: none;
  border-radius: var(--border-radius);
  transition: var(--transition);
  font-weight: bold;
  width: 100%;
  touch-action: manipulation; /* Better mobile touch experience */
  min-height: 2.5rem; /* Reduced height */
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  box-shadow: var(--box-shadow);
  letter-spacing: 0.5px;
  position: relative; /* For pseudo-elements */
}
button:hover {
  background: var(--dark-blue);
  transform: translateY(-1px); /* Slightly reduced hover lift */
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12);
}
button:active {
  transform: translateY(0px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}
button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: var(--box-shadow);
}
button::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(rgba(255, 255, 255, 0.05), transparent);
  opacity: 0;
  transition: var(--transition);
}
button:hover::after {
  opacity: 1;
}
.action-btn {
  flex: 1; /* Share space equally */
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  font-size: 0.9rem; /* Reduced */
}
.action-btn span {
    display: inline-block; /* Ensure span takes space */
    margin-right: var(--spacing-xs); /* Space between icon and text */
}

.copy-btn {
  background: linear-gradient(to right, var(--superman-yellow), #ffbe0b);
  color: rgba(0, 0, 0, 0.8);
}
.copy-btn:hover {
  background: linear-gradient(to right, #ffbe0b, var(--superman-yellow));
  color: rgba(0, 0, 0, 0.9);
}
.open-btn {
  background: linear-gradient(to right, var(--dark-blue), #003c8f);
}
.open-btn:hover {
  background: linear-gradient(to right, #003c8f, var(--dark-blue));
}

/* --- Add styles for Viewer Controls stacking --- */
.viewer-controls {
  position: relative; /* Establish stacking context */
  z-index: 1000; /* High value to stay on top */
  /* Add other styles if needed, e.g., background, padding, etc. */
  /* Example: */
  /* background-color: rgba(240, 240, 240, 0.9); */
  /* padding: 5px; */
  /* border-radius: 4px; */
}
/* --- End Viewer Controls stacking --- */

.features-list {
  margin: 0 0 var(--spacing-sm); /* Reduced bottom margin */
  font-size: 0.85rem; /* Slightly reduced */
  color: #555;
  flex-shrink: 0; /* Prevent list from shrinking */
}
.features-list ul {
  margin: var(--spacing-xs) 0 0 0; /* Reduced top margin, removed bottom */
  padding-left: var(--spacing-md); /* Reduced padding */
  list-style: disc; /* Use standard bullets */
}
.features-list li {
  margin-bottom: var(--spacing-xs); /* Reduced */
}
h3 { /* General H3 styling */
  color: var(--superman-blue);
  border-bottom: 2px solid var(--superman-yellow);
  padding-bottom: var(--spacing-xs);
  font-size: 1.1rem; /* Slightly reduced */
  margin-bottom: var(--spacing-sm);
}

/* Message styling (Success and Error) */
.message-area { /* Container for messages */
    min-height: 1.8em; /* Reduced min-height */
    text-align: center;
    color: rgba(255, 255, 255, 0.9); /* Light text for instructions/messages */
    font-size: 0.85rem;
    flex-grow: 1; /* Allow message area to take space if needed */
    display: flex; /* Center content vertically */
    align-items: center;
    justify-content: center;
}

/* Hide messages by default, show instructions */
.success-message, .error-message {
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: 6px; /* Reduced */
  font-weight: bold;
  display: none; /* Hidden by default */
  width: 100%; /* Take full width */
}
.control-panel-instructions {
  display: block; /* Show by default */
  font-style: italic;
  opacity: 0.8;
}

.success-message {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}
.error-message {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}
.success-message.visible, .error-message.visible {
  display: inline-block; /* Show as inline block when visible */
  animation: fadeIn 0.3s ease-out;
}
/* Hide instructions when a message is visible */
.success-message.visible ~ .control-panel-instructions,
.error-message.visible ~ .control-panel-instructions {
  display: none;
}

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

.preview-header {
  background: var(--dark-blue);
  color: white;
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--border-radius) var(--border-radius) 0 0;
  font-weight: bold;
  text-align: center;
  font-size: 0.9rem; /* Reduced */
}
#preview {
  display: flex;
  flex-direction: column;
  background: var(--white); /* Give preview container a background */
}
p { /* Basic paragraph styling */
  margin-bottom: var(--spacing-xs);
  line-height: 1.4;
}

/* Enhanced dropdown style */
select {
  appearance: none;
  background-color: var(--white);
  border: 2px solid rgba(0, 102, 255, 0.3);
  border-radius: 8px;
  padding: 6px 28px 6px 10px; /* Reduced padding */
  font-size: 0.9rem; /* Reduced */
  cursor: pointer;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230066ff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 6px center; /* Adjusted pos */
  background-size: 14px; /* Adjusted size */
  transition: var(--transition);
  min-width: 120px; /* Reduced min-width */
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05); /* Reduced shadow */
}
select:hover {
  border-color: var(--superman-blue);
  box-shadow: 0 2px 8px rgba(0, 102, 255, 0.2);
}
select:focus {
  outline: none;
  border-color: var(--superman-blue);
  box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.25);
}
/* Label styling */
label {
  font-weight: 600;
  letter-spacing: 0.5px;
  display: inline-block; /* Allows margin below */
  margin-bottom: 0; /* Removed margin */
  color: var(--white); /* Label color inside control panel */
  font-size: 0.9rem; /* Match select */
}
label[for="ttlSelect"] { /* Specific label style if needed */
    margin-right: var(--spacing-xs); /* Space between label and select */
}

/* Publish button style */
#publishBtn {
  background: linear-gradient(to right, var(--superman-yellow), #ffbe0b);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
  font-size: 1.0rem; /* Reduced */
  color: rgba(0, 0, 0, 0.8);
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.3);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15); /* Reduced shadow */
  margin-top: 0; /* Removed margin */
  width: auto; /* Allow button to size naturally */
  flex-shrink: 0; /* Prevent shrinking */
  padding: var(--spacing-sm) var(--spacing-lg); /* Adjust padding */
  position: relative; /* Needed for ::before pseudo-element */
  transition: background 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease; /* Include background */
}
#publishBtn:hover {
  background: linear-gradient(to right, #ffbe0b, var(--superman-yellow));
  color: rgba(0, 0, 0, 0.9);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); /* Reduced shadow */
}
#publishBtn:disabled {
  background: linear-gradient(to right, #e0c060, #d4b44c);
  color: rgba(0, 0, 0, 0.5);
  cursor: not-allowed;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15); /* Keep shadow when disabled */
}

#publishBtn.publishing {
  /* Style when publishing */
  cursor: wait;
  background: linear-gradient(to right, #c7a54b, #bfa945); /* Slightly dimmed yellow */
  color: rgba(0, 0, 0, 0.6);
}

/* Simple loading dots example */
#publishBtn.publishing::before {
    content: '...';
    position: absolute;
    left: 5px; /* Adjust position as needed */
    top: 50%;
    transform: translateY(-50%);
    font-weight: bold;
    animation: loadingDots 1.4s infinite;
    opacity: 0.8;
}

@keyframes loadingDots {
    0%, 100% { content: ""; }
    33% { content: "."; }
    66% { content: ".."; }
    99% { content: "..."; }
}

/* Add a slug title style */
.slug-title {
  font-size: 16px; /* Reduced */
  font-weight: bold;
  text-align: center;
  margin: var(--spacing-xs) 0 var(--spacing-sm); /* Adjusted margin */
  color: #333;
  min-height: 20px; /* Reserve space */
}

/* --- Responsive Design --- */
@media (min-width: 768px) {
  body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
  }
  
  .container {
    flex-direction: row;
    padding: var(--spacing-md);
    gap: var(--spacing-md);
    max-width: 1800px;
    margin: 0 auto;
    flex: 1;
  }
  
  #editor, #preview {
    flex: 1;
    height: auto;
    overflow-y: auto;
    margin-bottom: 0;
  }
  
  textarea#code, #cmContainer, iframe#output {
    height: auto;
    flex-grow: 1;
    min-height: 250px;
    display: flex;
    flex-direction: column;
  }
}

/* --- ADDED/MODIFIED: Mobile Responsiveness --- */
@media (max-width: 600px) { /* Example breakpoint */
     .viewer-controls button,
     .action-btn {
        padding: 6px 8px; /* Adjust padding for smaller screens */
        font-size: 12px;
     }
     .share-controls {
         flex-direction: column; /* Stack TTL and Publish button */
         align-items: stretch; /* Full width */
     }
     #publishBtn {
         width: 100%; /* Full width publish button */
     }
     select {
         font-size: 0.9rem; /* Ensure dropdown text isn't too small */
         padding: 8px 30px 8px 12px;
     }
     label[for="ttlSelect"] {
         margin-bottom: var(--spacing-xs); /* Add space below label */
     }
     /* Hamburger menu adjustments if needed */
}

/* --- Removed all sidebar-specific CSS styles --- */

/* Smaller screen adjustments */
@media (max-width: 600px) {
    /* Mobile-specific styles would go here */
    .viewer-controls button {
        /* Adding minimum style to fix dangling selector */
        font-size: 12px;
        padding: 4px 8px;
    }
}

/* Intro Banner */
.intro-banner {
  background-color: #0066ff;
  color: white;
  padding: 10px 15px;
  text-align: center;
  position: relative;
  font-size: 0.9rem;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.3s ease;
}

.intro-banner.hidden {
  display: none;
}

.banner-content {
  flex: 1;
  max-width: 900px;
}

.close-banner {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0 8px;
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
}

.close-banner:hover {
  opacity: 0.8;
}

/* Footer */
#app-footer {
  text-align: center;
  padding: 15px;
  color: #a6b0cf;
  background-color: #2b3e50;
  font-size: 0.9rem;
  width: 100%;
  flex-shrink: 0; /* Prevent the footer from shrinking */
}

#app-footer a {
  color: #a6b0cf;
  text-decoration: none;
  transition: color 0.2s;
  margin: 0 8px;
}

#app-footer a:hover {
  color: white;
  text-decoration: underline;
}

.footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 5px;
}

/* Fixed container layout for desktop */
@media (min-width: 768px) {
  body {
    display: flex;
    flex-direction: column; /* Body should be column to stack container and footer */
    min-height: 100vh;
  }
  
  .container {
    flex-direction: row;
    padding: var(--spacing-md);
    gap: var(--spacing-md);
    max-width: 1800px;
    margin: 0 auto;
    flex: 1; /* Container should take up available space */
    height: auto; /* Remove fixed height that could cause issues */
  }
}

/* Add this class to buttons needing conditional display */
.clipboard-conditional {
    display: none; /* Hide by default */
}