/* MARKER: RASPBERRY - Scrollable prompt/input areas with auto-hide scrollbars */

@import url('https://fonts.googleapis.com/css2?family=Alegreya+Sans:ital,wght@0,400;0,700;1,400;1,700&family=Spectral:wght@400;700&family=Nabla:EDPT,EHLT@0..200,16&family=Courier+Prime:wght@400;700&display=swap');

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

body {
  font-family: "Alegreya Sans", sans-serif;
  font-weight: 400;
  font-style: normal;
  background: #0400FF;
  color: #333;
  height: 100vh;
  overflow: hidden;
}

ol {
	padding: 1.5rem 2rem;
}

.top-bar {
  background: #0400FF;
  padding: 0.8rem 0.8rem 0.025rem 0.8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.title {
  font-family: "Nabla", system-ui;
  font-size: 1.4rem;
  font-weight: 400;
  color: #2d3748;
}

.meta-info {
  display: flex;
  gap: 1rem;
  align-items: center;
  font-size: 0.875rem;
  color: #FFFF00;
  font-family: "Alegreya Sans", sans-serif;
  flex-wrap: wrap;
}

.meta-info > span {
  align-self: center;
}

.restart-btn, .signout-btn {
  background: #e53e3e;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  cursor: pointer;
  font-size: 0.875rem;
  font-family: "Alegreya Sans", sans-serif;
}

.restart-btn:hover, .signout-btn:hover {
  background: #c53030;
}

.signout-btn {
  background: #718096;
}

.signout-btn:hover {
  background: #4a5568;
}

/* Mobile responsive header - triggers when title would wrap */
@media (max-width: 950px) {
  .top-bar {
    padding: 0.8rem 1rem 0.025rem 1rem;
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
  }
  
  .top-bar-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  
  .title-mobile {
    font-family: "Nabla", system-ui;
    font-size: 1.1rem;
    font-weight: 400;
    color: #2d3748;
    line-height: 1.1;
  }
  
  .meta-info-mobile {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    font-size: 0.75rem;
    color: #FFFF00;
    font-family: "Alegreya Sans", sans-serif;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  
  .mobile-links {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    font-size: 0.75rem;
    color: #FFFF00;
    font-family: "Alegreya Sans", sans-serif;
  }
  
  .mobile-link {
    color: #FFFF00;
    text-decoration: none;
    font-weight: 700;
    cursor: pointer;
  }
  
  .mobile-link:hover {
    text-decoration: underline;
  }
  
  .mobile-separator {
    color: #FFFF00;
    font-weight: normal;
  }
  
  /* Hide desktop header elements on mobile */
  .title {
    display: none;
  }
  
  .meta-info {
    display: none;
  }
  
  .restart-btn, .signout-btn {
    display: none;
  }
}

/* Show desktop header elements only on desktop */
@media (min-width: 951px) {
  .top-bar-row,
  .title-mobile,
  .meta-info-mobile,
  .mobile-links {
    display: none;
  }
}

.container {
  max-width: 900px;
	margin: 1rem auto;
  padding: 1 1rem;
  height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
}

/* Updated workflow card for true full-height sticky layout */
.workflow-card {
  background: #C9C9C9;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0;
  flex: 1;
}

.survey-card, .final-card {
  background: #C9C9C9;
  padding: 2rem;
}

/* FIXED: Content area that properly accounts for dynamic input area height */
.content-area {
  flex: 1;
  padding: 2rem;
  padding-bottom: 200px; /* Reserve space for input area */
  overflow-y: auto;
  background: #E7E7E7;
}

/* FIXED: Input area with dynamic height calculation */
.input-area {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #555555;
  border-top: 1px solid #a0a0a0;
  padding: 1.5rem;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  z-index: 10;
  max-width: 900px;
  margin: 0 auto;
  /* RASPBERRY: Allow height to grow up to 45% of viewport */
  max-height: 45vh;
  overflow-y: auto;
}

/* Updated input container for new button layout */
.input-container {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* New button container for positioning below textarea */
.button-container {
  display: flex;
  justify-content: flex-end;
}

/* RASPBERRY: Scrollable prompt text with hidden-until-hover scrollbar */
.prompt-text {
  font-size: 1.125rem;
  line-height: 1.2;
  margin-bottom: 1.3rem;
  color: #2d3748;
  font-family: "Alegreya Sans", sans-serif;
  /* RASPBERRY: prevent horizontal scroll */
  overflow-x: hidden;
}

/* RASPBERRY: Webkit scrollbar styling (Chrome, Safari, Edge) */
.prompt-text::-webkit-scrollbar,
.user-input::-webkit-scrollbar {
  width: 8px;
}

.prompt-text::-webkit-scrollbar-track,
.user-input::-webkit-scrollbar-track {
  background: transparent;
}

.prompt-text::-webkit-scrollbar-thumb,
.user-input::-webkit-scrollbar-thumb {
  background-color: transparent;
  border-radius: 4px;
  transition: background-color 0.2s;
}

/* Show scrollbar on hover or focus */
.prompt-text:hover::-webkit-scrollbar-thumb,
.user-input:hover::-webkit-scrollbar-thumb,
.prompt-text:focus-within::-webkit-scrollbar-thumb,
.user-input:focus-within::-webkit-scrollbar-thumb,
.user-input:focus::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.4);
}

/* RASPBERRY: Firefox scrollbar styling */
.prompt-text,
.user-input {
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

.prompt-text:hover,
.user-input:hover,
.prompt-text:focus-within,
.user-input:focus {
  scrollbar-color: rgba(0, 0, 0, 0.4) transparent;
}

.llm-response {
  background: #f7fafc;
  border-left: 4px solid #4299e1;
  padding: 1rem;
  margin: 1.5rem 0;
  white-space: pre-wrap;
  font-family: "Alegreya Sans", sans-serif;
}

.LR {
  font-family: "Courier Prime", monospace;
  font-size: 0.85em;
  color: #00FF00;
  line-height: 1.2em; /* Slightly increase line height for better readability */
  padding: 1rem;
  background: #242424;
  margin: 1rem 0;
  white-space: normal; /* Changed from pre-wrap to normal to ignore newlines */
}

.LR p {
  margin: 0 !important;
  padding: 0 !important;
  line-height: inherit !important;
  display: block !important;
}

.LR p + p {
  margin-top: 1.2em !important; /* One line height spacing between paragraphs */
  padding-top: 0 !important;
}

.LR p:last-child {
  margin-bottom: 0; /* Remove bottom margin from the last paragraph */
}

.LR br {
  display: none;
}

.UI {
  font-family: "Spectral", serif;
  line-height: 1em;
  color: #0D0D0D;
  padding: 1rem;
  background: #FFFFFF;
  margin: 1rem 0;
  white-space: pre-wrap;
}

/* RASPBERRY: User input with scrolling at max height and hidden-until-hover scrollbar */
.user-input {
  width: 100%;
  min-height: 120px;
  /* RASPBERRY: Max height 45vh minus space for padding and button */
  max-height: calc(45vh - 120px);
  padding: 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 0.375rem;
  /* RASPBERRY: Disable manual resize to rely on auto-sizing */
  resize: none;
  font-family: "Spectral", serif;
  font-size: 1.1rem;
  /* RASPBERRY: Enable scrolling when content exceeds max-height, prevent horizontal scroll */
  overflow-y: auto;
  overflow-x: hidden;
}

.survey-input {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #e2e8f0;
  border-radius: 0.375rem;
  margin-bottom: 1rem;
  resize: vertical;
  min-height: 120px;
  font-family: "Alegreya Sans", sans-serif;
  font-size: 1.2rem;
}

.user-input:focus, .survey-input:focus {
  outline: none;
  border-color: #4299e1;
}

.survey-select {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #e2e8f0;
  border-radius: 0.375rem;
  font-size: 1rem;
  font-family: "Alegreya Sans", sans-serif;
  background: white;
}

/* New action button for below input field */
.action-button-below {
  background: #FFCC00;
  color: black;
  border: 1px solid #FF9900;
  padding: 0.75rem 1.5rem;
  border-radius: 0.375rem;
  font-size: 1rem;
  font-family: "Alegreya Sans", sans-serif;
  font-weight: 700;
  cursor: pointer;
  min-width: 120px;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.action-button-below:hover:not(:disabled) {
  background: #FF9900;
  transform: translateY(-1px);
}

.action-button-below:disabled {
  background: #cbd5e0;
  cursor: not-allowed;
  transform: none;
}

/* Keep original action button for other uses */
.action-button {
  background: #FFCC00;
  color: black;
  border: 1px solid #FF9900;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-size: 0.9rem;
  font-family: "Alegreya Sans", sans-serif;
  font-weight: 700;
  cursor: pointer;
  min-width: 80px;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.action-button:hover:not(:disabled) {
  background: #FF9900;
  transform: translateY(-1px);
}

.action-button:disabled {
  background: #cbd5e0;
  cursor: not-allowed;
  transform: none;
}

/* Standalone button for steps without input */
.action-button-standalone {
  width: 100%;
  background: #FFCC00;
  color: black;
  border: 1px solid #FF9900;
  padding: 1rem 2rem;
  border-radius: 0.375rem;
  font-size: 1.1rem;
  font-family: "Alegreya Sans", sans-serif;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.action-button-standalone:hover:not(:disabled) {
  background: #FF9900;
  transform: translateY(-1px);
}

.action-button-standalone:disabled {
  background: #cbd5e0;
  cursor: not-allowed;
  transform: none;
}

.download-button {
  background: #FFCC00;
  color: black;
  border: 1px solid #FF9900;
  padding: 0.75rem 1.5rem;
  border-radius: 0.375rem;
  font-size: 1rem;
  font-family: "Alegreya Sans", sans-serif;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  margin-top: 1rem;
}

.download-button:hover {
  background: #FF9900;
}

.processing {
  text-align: center;
  color: #718096;
  margin-top: 0.5rem;
  font-family: "Alegreya Sans", sans-serif;
}

.loading, .error {
  text-align: center;
  padding: 2rem;
  font-family: "Alegreya Sans", sans-serif;
}

.error {
  background: #fed7d7;
  color: #c53030;
  border-radius: 0.375rem;
}

/* New resumed session styles */
.resumed-badge {
  background: #28a745;
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
}

.resumed-notification {
  background: #d4edda;
  border: 1px solid #c3e6cb;
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1.5rem;
  color: #155724;
}

.resumed-notification p {
  margin: 0;
}

.survey-question {
  margin-bottom: 1.1rem;
}

.survey-question label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: #2d3748;
  font-family: "Alegreya Sans", sans-serif;
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.checkbox-label {
  display: flex !important;
  align-items: center;
  font-weight: normal !important;
  margin-bottom: 0 !important;
  font-family: "Alegreya Sans", sans-serif !important;
}

.checkbox-label input[type="checkbox"] {
  margin-right: 0.5rem;
}

.final-text {
  font-size: 1.125rem;
  line-height: 1.1;
  margin-bottom: 2rem;
  white-space: pre-wrap;
  font-family: "Alegreya Sans", sans-serif;
}

.no-download-warning {
  text-align: center;
  color: #718096;
  font-style: italic;
  margin-top: 0.5rem;
  font-family: "Alegreya Sans", sans-serif;
}

/* Authentication Styles */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0400FF;
  padding: 1rem;
}

.auth-card {
  background: #C9C9C9;
  padding: 2rem;
  border-radius: 0.5rem;
  max-width: 400px;
  width: 100%;
  text-align: center;
}

.auth-card h1 {
  color: #2d3748;
  margin-bottom: 1rem;
  font-family: "Alegreya Sans", sans-serif;
}

.auth-card p {
  color: #4a5568;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.auth-form {
  text-align: left;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: #2d3748;
}

.auth-input {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #e2e8f0;
  border-radius: 0.375rem;
  font-size: 1rem;
  font-family: "Alegreya Sans", sans-serif;
}

.auth-input:focus {
  outline: none;
  border-color: #4299e1;
}

.auth-input:disabled {
  background: #f7fafc;
  cursor: not-allowed;
}

.auth-button, .auth-button-secondary {
  width: 100%;
  padding: 0.75rem 1.5rem;
  border-radius: 0.375rem;
  font-size: 1rem;
  font-family: "Alegreya Sans", sans-serif;
  font-weight: 600;
  cursor: pointer;
  margin-top: 1rem;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.auth-button {
  background: #FFCC00;
  color: black;
  border: 1px solid #FF9900;
}

.auth-button:hover:not(:disabled) {
  background: #FF9900;
}

.auth-button:disabled {
  background: #cbd5e0;
  cursor: not-allowed;
}

.auth-button-secondary {
  background: #e2e8f0;
  color: #4a5568;
  border: 1px solid #cbd5e0;
}

.auth-button-secondary:hover {
  background: #cbd5e0;
}

.auth-message {
  margin-top: 1rem;
  padding: 0.75rem;
  border-radius: 0.375rem;
  text-align: center;
}

.auth-message.success {
  background: #c6f6d5;
  color: #276749;
  border: 1px solid #9ae6b4;
}

.auth-message.error {
  background: #fed7d7;
  color: #c53030;
  border: 1px solid #feb2b2;
}

.auth-info {
  background: #ebf8ff;
  border: 1px solid #90cdf4;
  border-radius: 0.375rem;
  padding: 1rem;
  margin: 1rem 0;
}

.auth-info p {
  color: #2c5282;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

.auth-info p:last-child {
  margin-bottom: 0;
}

/* Session choice button styles - matching workflow buttons */
.session-choice-resume-button {
  background: #28a745; /* Green like resumed badge */
  color: white;
  border: 1px solid #218838;
  padding: 0.75rem 1.5rem;
  border-radius: 0.375rem;
  font-size: 1rem;
  font-family: "Alegreya Sans", sans-serif;
  font-weight: 700;
  cursor: pointer;
  min-width: 200px;
  white-space: nowrap;
  transition: all 0.2s ease;
  flex: 1;
}

.session-choice-resume-button:hover {
  background: #218838;
  transform: translateY(-1px);
}

.session-choice-new-button {
  background: #FFCC00; /* Same as workflow action buttons */
  color: black;
  border: 1px solid #FF9900;
  padding: 0.75rem 1.5rem;
  border-radius: 0.375rem;
  font-size: 1rem;
  font-family: "Alegreya Sans", sans-serif;
  font-weight: 700;
  cursor: pointer;
  min-width: 200px;
  white-space: nowrap;
  transition: all 0.2s ease;
  flex: 1;
}

.session-choice-new-button:hover {
  background: #FF9900;
  transform: translateY(-1px);
}

.session-choice-buttons {
  display: flex;
  gap: 1rem;
  margin: 2rem 0;
  flex-wrap: wrap;
}

@media (max-width: 600px) {
  .session-choice-buttons {
    flex-direction: column;
  }
  
  .session-choice-resume-button,
  .session-choice-new-button {
    min-width: auto;
  }
}
.alegreya-sans-regular {
  font-family: "Alegreya Sans", sans-serif;
  font-weight: 400;
  font-style: normal;
}

.alegreya-sans-bold {
  font-family: "Alegreya Sans", sans-serif;
  font-weight: 700;
  font-style: normal;
}

.alegreya-sans-regular-italic {
  font-family: "Alegreya Sans", sans-serif;
  font-weight: 400;
  font-style: italic;
}

.alegreya-sans-bold-italic {
  font-family: "Alegreya Sans", sans-serif;
  font-weight: 700;
  font-style: italic;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .container {
    margin: 1rem auto;
    padding: 0 0.5rem;
    height: calc(100vh - 140px); /* Adjusted for taller mobile header */
  }
  
  .survey-card, .final-card, .auth-card {
    padding: 1.5rem;
  }
  
  .content-area {
    padding: 1.5rem;
    padding-bottom: 220px; /* Increase bottom padding on mobile for input area */
  }
  
  .input-area {
    padding: 1rem;
    left: 0.5rem;
    right: 0.5rem;
    max-width: calc(100% - 1rem);
    /* RASPBERRY: 40vh max height on mobile */
    max-height: 40vh;
  }
  
  .user-input {
    min-height: 100px;
    /* RASPBERRY: Adjust max height for mobile (40vh) */
    max-height: calc(40vh - 100px);
  }
    
  .action-button-below {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    min-width: 100px;
  }
  
  .auth-container {
    padding: 1rem 0.5rem;
  }
}
