/* --- chidi // Console Theme --- */

:root {
  --panel-bg: #F5EFE6; /* Off-white, beige panel */
  --screen-bg: #212529; /* Dark charcoal for the main screen */
  --text-primary: #EAEAEA; /* Primary text color on screen */
  --text-dark: #343a40; /* Text color for on-panel elements */
  
  --accent-orange: #FF7F50; /* Vibrant coral for primary actions */
  --accent-blue: #4A90E2; /* Cool blue for secondary info/actions */
  --accent-red: #D0021B; /* Red for alerts or clear actions */
  --accent-green: #28a745; /* Green for session actions */
  
  --border-color: #D8CFC0; /* Border color for panel elements */
  --shadow-color: rgba(0, 0, 0, 0.1);
  
  --font-family: 'Space Mono', monospace;
  --lcd-bg: #1A1A1A; /* Near-black LCD background */
  --lcd-text: #EFAF00; /* Rich LCD yellow/amber for text */
  --lcd-glow: #EFAF00; /* Glow color for the text */
  --font-family-lcd: 'VT323', monospace;
}

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

body {
  background-color: #343a40;
  background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 1rem 1rem;
  font-family: var(--font-family);
  color: var(--text-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}

.hidden {
  display: none !important;
}

/* --- Main Console Panel --- */
#console-panel {
  background-color: var(--panel-bg);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 30px rgba(0,0,0,0.2), inset 0 0 0 1px #fff;
  width: 100%;
  max-width: 900px;
  max-height: calc(100vh - 4rem);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
}

/* --- Console Header --- */
.console-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--border-color);
  padding: 0.5rem;
  border-radius: 4px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.15);
}

#mainTitle {
  flex-grow: 1;
  background-color: var(--lcd-bg);
  box-shadow: inset 0 3px 6px rgba(0,0,0,0.4);
  font-family: var(--font-family-lcd);
  color: var(--lcd-text);
  text-shadow: 0 0 5px var(--lcd-glow);
  font-size: 2.25rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 3px;
  padding: 0.75rem 1.25rem;
  border-radius: 3px;
  text-align: left;
  line-height: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.loader {
  background-color: var(--lcd-glow);
  width: 1.5rem;
  height: 2.25rem;
  margin-left: 1rem;
  animation: blink 1.2s steps(1, start) infinite;
  border-radius: 1px;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

#markdownDisplay {
  background-color: var(--screen-bg);
  color: var(--text-primary);
  border-radius: 4px;
  padding: 1.5rem;
  overflow-y: auto;
  flex-grow: 1;
  min-height: 250px;
  border: 2px solid #495057;
  box-shadow: inset 0 0 15px rgba(0,0,0,0.5);
}

.placeholder-text {
  color: rgba(255, 255, 255, 0.4);
  font-style: bold;
  text-align: center;
  position: relative;
  top: 50%;
  transform: translateY(-50%);
}

.ask-form {
    display: flex;
    gap: 0.75rem;
}

.ask-input {
    flex-grow: 1;
    min-width: 0;
    padding: 0.75rem;
    font-family: var(--font-family);
    font-size: 1rem;
    color: var(--text-primary);
    background-color: var(--screen-bg);
    border: 2px solid #495057;
    border-radius: 4px;
}

.ask-input:focus {
    outline: none;
    border-color: var(--accent-orange);
}

.ask-input:disabled {
    opacity: 0.5;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.controls-container {
    display: flex;
    flex-wrap: wrap; 
    justify-content: space-between;
    gap: 1rem;
}

.control-group {
    display: flex;
    gap: 0.75rem; 
    align-items: center;
}

button, .file-input-label {
  font-family: var(--font-family);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 0.75rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 2px solid transparent;
  background-color: #fff;
  color: var(--text-dark);
  border-color: var(--border-color);
  box-shadow: 0 2px 4px var(--shadow-color);
  white-space: nowrap; 
}

button:hover, .file-input-label:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px var(--shadow-color);
}

button:active, .file-input-label:active {
  transform: translateY(0);
  background-color: #F8F9FA;
}

button:disabled {
  background-color: #E9ECEF;
  color: #ADB5BD;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

#nextBtn, .file-input-label, #askAllFilesBtn, #scanFolderBtn {
  background-color: var(--accent-orange);
  color: #fff;
  border: none;
}

#summarizeBtn, #suggestQuestionsBtn {
  background-color: var(--accent-blue);
  color: #fff;
  border: none;
}

/* Styling for the smaller session buttons */
.session-controls button,
.session-controls .manual-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-family: var(--font-family);
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 4px;
    box-shadow: 0 2px 4px var(--shadow-color);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    padding: 0.75rem 0.8rem;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
    background-color: #6c757d;
    color: white;
    border: none;
}

.session-controls #saveSessionBtn {
    background-color: var(--accent-green);
}

.session-controls #restartSessionBtn {
    background-color: var(--accent-red);
}

.session-controls #manualLink {
    background-color: #0284c7;
}

.session-controls #manualLink:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--shadow-color);
    background-color: #0369a1;
}

.session-controls #manualLink:active {
    transform: translateY(0);
}

.status-readout {
  background-color: #E9ECEF;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 0.5rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
}

.status-item, .status-message {
  font-weight: 700;
}

.question-button {
  background-color: transparent;
  color: var(--accent-orange);
  border: 1px solid var(--accent-orange);
  padding: 0.75rem; 
  width: 100%;
  text-align: left;
  margin-top: 0.5rem;
  white-space: normal; 
  height: auto;
  line-height: 1.4;
  text-transform: none;
}

/* --- Markdown Content Readability (NEW) --- */

#markdownDisplay h1, 
#markdownDisplay h2, 
#markdownDisplay h3 {
  color: var(--accent-orange);
  border-bottom: 1px solid #495057;
  padding-bottom: 0.5rem;
}

/* Add space above all headers and below all paragraphs/lists */
#markdownDisplay h1,
#markdownDisplay h2,
#markdownDisplay h3,
#markdownDisplay h4,
#markdownDisplay h5,
#markdownDisplay h6,
#markdownDisplay p,
#markdownDisplay ul,
#markdownDisplay ol {
    margin-bottom: 1rem;
}

/* Add extra space *above* headers to separate them from previous text */
#markdownDisplay h1,
#markdownDisplay h2,
#markdownDisplay h3,
#markdownDisplay h4,
#markdownDisplay h5,
#markdownDisplay h6 {
    margin-top: 1.75rem;
}

/* Improve paragraph line-height for easier reading */
#markdownDisplay p {
    line-height: 1.6;
}

/* Add a little space between list items */
#markdownDisplay li {
    margin-bottom: 0.5rem;
}

/* --- Modal Styles --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--panel-bg);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    text-align: center;
    color: var(--text-dark);
    width: 90%;
    max-width: 500px; /* Limit modal width */
}

.modal-content h3 {
    margin-bottom: 1rem;
}

.modal-content p {
    margin-bottom: 1.5rem; /* Add space below prompt text */
}

.modal-input {
    width: 100%;
    padding: 0.75rem;
    font-family: var(--font-family);
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: #fff;
    color: var(--text-dark);
}

.modal-input:focus {
    outline: 2px solid var(--accent-blue);
    border-color: var(--accent-blue);
}

.modal-label {
    display: block;
    margin-top: 0.75rem;
    text-align: left;
}

.modal-error {
    min-height: 1.2em;
    color: #ff6b6b;
}

select.modal-input {
    box-sizing: border-box;
}

.modal-actions {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
}