/* General Styles from before */
:root {
  --main-bg-color: #f7f7f7;
  --cell-bg-color: #ffffff;
  --border-color: #e7e7e7;
  --menu-bg-color: #ffffff;
  --menu-border-color: #d1d1d1;
  --accent-color: #2196F3;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
  margin: 0;
  font-family: var(--font-family);
  background-color: var(--main-bg-color);
}

.header-content, .main-content-area {
    max-width: 1100px;
    margin: 0 auto;
}

.header-content {
    display: flex;
    flex-direction: column;
}

.header-top-row {
    display: flex;
    align-items: center;
    width: 100%;
}

.filename-display {
    text-align: right;
    flex-grow: 1;
    padding: 6px 10px;
    font-size: 13px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notebook-header {
  background-color: var(--menu-bg-color);
  border-bottom: 1px solid var(--menu-border-color);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.menu-bar { display: flex; padding: 2px 0; }
.menu-item { position: relative; padding: 6px 10px; cursor: pointer; font-size: 13px; }
.menu-item:hover .dropdown-content { display: block; }
.dropdown-content {
  display: none; position: absolute; background-color: white;
  min-width: 180px; box-shadow: 0px 5px 15px 0px rgba(0,0,0,0.15);
  z-index: 1001; border: 1px solid #ddd; border-radius: 4px; padding: 5px 0;
}
.dropdown-content a { color: black; padding: 7px 15px; text-decoration: none; display: block; font-size: 13px; }
.dropdown-content a:hover { background-color: #f1f1f1; }
.dropdown-content a.disabled { color: #aaa; cursor: not-allowed; }
.dropdown-content a.disabled:hover { background-color: transparent; }

.toolbar { display: flex; align-items: center; gap: 4px; padding: 4px 0; border-top: 1px solid var(--border-color); }
.toolbar button {
  background: none; border: 1px solid transparent; border-radius: 3px;
  padding: 1px 5px; cursor: pointer; font-size: 16px; color: #333;
}
.toolbar button:hover { background-color: #eee; }
.toolbar button:disabled { color: #ccc; cursor: not-allowed; background-color: transparent; }

.main-content-area { 
  padding: 20px;
  padding-bottom: 30vh;
}
.cells-container { 
  display: flex; flex-direction: column; gap: 5px; 
  box-shadow: 0 0 5px 1px rgba(0,0,0,0.3);
  background-color: var(--cell-bg-color);
  padding-top:10px;
  padding-bottom: 10px;
}

.cell {
  border: 1px solid transparent;
  position: relative;
  /*cursor: pointer;*/
  background-color: var(--cell-bg-color);
}

.selection-indicator {
    position: absolute; top: 0; bottom: 0; left: 0; width: 4px;
    background-color: var(--accent-color); visibility: hidden;
}
.cell.selected > .cell-part > .selection-indicator { visibility: visible; }

.cell-part { position: relative; }
.cell-input, .cell-output-wrapper { display: flex; }

.cell-output-wrapper { margin-top: 5px; }

.prompt {
  flex: 0 0 80px; padding: 10px 0; font-family: monospace;
  font-size: 12px; text-align: center; color: #3D85C6;
}
.prompt.out { color: #990000; }

.editor-container { flex-grow: 1; }
.CodeMirror { height: auto; border: none !important; }

.output-container { flex-grow: 1; padding: 10px; overflow-x: auto; }
.output-container pre { margin: 0; font-size: 14px; line-height: 1.4; white-space: pre-wrap; word-break: break-all; }

/* File Dialog Styles */
.file-dialog-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 2000; display: flex; justify-content: center; align-items: center; }
.file-dialog { background: #fff; border-radius: 6px; box-shadow: 0 5px 15px rgba(0,0,0,0.3); width: 90%; max-width: 1100px; display: flex; flex-direction: column; height: 70vh; max-height: 900px; }
.file-dialog-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 15px; border-bottom: 1px solid #ddd; font-weight: bold; }
.file-dialog-header .close-btn { background: none; border: none; font-size: 20px; cursor: pointer; }
.file-dialog-header .header-btn { background: none; border: none; font-size: 16px; cursor: pointer; padding: 0 5px; }
.file-dialog-nav { display: flex; align-items: center; padding: 5px 10px; border-bottom: 1px solid #ddd; background: #f7f7f7; gap: 10px; }
.file-dialog-nav button { margin-right: 0; }
.file-dialog-nav .spacer { flex-grow: 1; }
.file-dialog-nav .sync-status { font-size: 12px; color: #666; }
.file-dialog-body { flex-grow: 1; overflow-y: auto; }
.file-list { padding: 5px; }

.file-list-header {
    display: grid;
    grid-template-columns: 24px 1fr 100px 150px 120px; /* Icon, Name, Size, Modified, Actions */
    padding: 4px 8px;
    font-weight: bold;
    border-bottom: 1px solid #eee;
    background-color: #f7f7f7;
    gap: 10px;
}
.file-list-header span:nth-child(2) { text-align: left; } /* Name */
.file-list-header span:nth-child(3) { text-align: right; } /* Size */
.file-list-header span:nth-child(4) { text-align: right; } /* Modified */
.file-list-header span:nth-child(5) { text-align: right; } /* Actions */

.file-list-item {
    display: grid;
    grid-template-columns: 24px 1fr 100px 150px 120px; /* Icon, Name, Size, Modified, Actions */
    align-items: center;
    padding: 4px 8px;
    cursor: pointer;
    border-radius: 3px;
    gap: 10px;
}
.file-list-item.folder {
    grid-template-columns: 24px 1fr 100px 150px 120px; /* Maintain columns for alignment */
}
.file-list-item:hover { background: #f0f0f0; }
.file-list-item.selected { background: #0078d7; color: white; }
.file-list-item i {
    margin-right: 0;
    font-size: 16px;
    text-align: center;
    grid-column: 1; /* Explicitly place icon in first column */
}
.file-list-item .file-name {
    grid-column: 2; /* Explicitly place name in second column */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.file-list-item .file-name input {
    width: 95%;
    padding: 2px 4px;
    border: 1px solid #ccc;
    border-radius: 2px;
}

.file-list-item .file-size {
    grid-column: 3; /* Explicitly place size in third column */
    font-size: 0.8em;
    color: #666;
    text-align: right;
}
.file-list-item .file-date {
    grid-column: 4; /* Explicitly place date in fourth column */
    font-size: 0.8em;
    color: #666;
    text-align: right;
}
.file-list-item .actions {
    grid-column: 5;
    text-align: right;
    visibility: hidden; /* Hide actions by default */
}
.file-list-item:hover .actions,
.file-list-item.selected .actions {
    visibility: visible; /* Show on hover or when selected */
}
.file-list-item .actions button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 4px;
    font-size: 14px;
    color: #333;
}
.file-list-item.selected .actions button {
    color: white; /* Make icons white on selected background */
}

.file-list-item.folder .file-size,
.file-list-item.folder .file-date {
    visibility: hidden; /* Hide for folders but maintain space */
}
.file-list-item.selected .file-size,
.file-list-item.selected .file-date {
    color: rgba(255, 255, 255, 0.8);
}
.file-dialog-footer { padding: 10px 15px; border-top: 1px solid #ddd; background: #f7f7f7; }
.file-name-input { display: flex; align-items: center; margin-bottom: 10px; }
.file-name-input label { margin-right: 10px; }
.file-name-input input { flex-grow: 1; padding: 6px; border: 1px solid #ccc; border-radius: 3px; }
.footer-buttons { display: flex; align-items: center; justify-content: flex-start; }
.footer-buttons .spacer { flex-grow: 1; }
.footer-buttons button { margin-left: 8px; }


button { padding: 6px 12px; border: 1px solid #ccc; border-radius: 3px; cursor: pointer; background: #fff; }
button.primary { background: #0078d7; color: white; border-color: #0078d7; }
button.secondary { background: #6c757d; color: white; border-color: #6c757d; }
button.danger { background: #d9534f; color: white; border-color: #d9534f; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.form-group {
    margin-bottom: 15px;
}
.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}
.form-group input {
    width: 100%;
    padding: 8px;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 4px;
}
.form-group-checkbox {
    display: flex;
    align-items: center;
    margin: 15px 0;
}
.form-group-checkbox input[type="checkbox"] {
    width: auto; /* Allow checkbox to take its natural width */
    margin-right: 10px;
}
/* WebDAV Config specific footer buttons */
.webdav-config-footer-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px; /* Spacing between buttons */
}
/* Input focus styling */
input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--accent-color);
}


/* Notification Styles */
.top-notification {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  background-color: #4CAF50; /* Green background for success */
  color: white;
  text-align: center;
  padding: 10px 20px;
  z-index: 3000; /* Above file dialog */
  width: fit-content;
  min-width: 200px;
  border-bottom-left-radius: 5px;
  border-bottom-right-radius: 5px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Vue Transition Styles */
.slide-fade-enter-active, .slide-fade-leave-active {
  transition: all 0.5s ease;
}
.slide-fade-enter-from, .slide-fade-leave-to {
  transform: translateX(-50%) translateY(-100%);
  opacity: 0;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.rotating {
  animation: spin 1s linear infinite;
  display: inline-block;
}

.toolbar button {
  background: none; border: 1px solid transparent; border-radius: 3px;
  padding: 1px 5px; cursor: pointer; font-size: 16px; color: #333;
  height: 28px; /* Fixed height for vertical alignment */
  box-sizing: border-box;
}
.toolbar button:hover { background-color: #eee; }
.toolbar button:disabled { color: #ccc; cursor: not-allowed; background-color: transparent; }

.run-button-icon-only {
    width: 32px; /* Square-ish size */
    padding: 1px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.run-button-icon-only .bi-play-fill {
    font-size: 18px;
}

/* Standalone timer text styling */
.timer-text-standalone {
    font-family: 'Menlo', 'Consolas', 'Roboto Mono', monospace;
    font-size: 13px;
    vertical-align: middle;
    margin-left: 8px;
}

/* The spinner */
.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(0, 0, 0, 0.2);
  border-top-color: #333; /* Matches button text color */
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Vue transition for elements */
.fade-enter-active, .fade-leave-active {
  transition: opacity 0.1s ease;
}
.fade-enter-from, .fade-leave-to {
  opacity: 0;
}

/* Styles for mobile/portrait view */
@media (max-width: 768px) {
    .main-content-area {
        padding: 0; /* Remove padding on smaller screens */
        padding-top:5px;
        padding-bottom:30px;
    }

    .file-dialog-overlay {
        align-items: flex-start;
    }

    .file-dialog {
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        border-radius: 0;
        box-shadow: none;
    }

    .header-content {
      padding: 0 5px;
    }

    .notebook-header {
      padding: 0 5px;
    }

    .cell-input, .cell-output-wrapper {
        flex-direction: column; /* Stack prompt and editor/output vertically */
    }

    .editor-container{
        margin-left:5px;
    }

    .prompt {
        flex: 0 0 auto; /* Allow prompt to resize */
        width: 100%;
        text-align: left;
        padding: 4px 10px; /* Adjust padding */
        box-sizing: border-box;
    }
}

.usage-stats {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    font-size: 0.9em;
    color: #555;
}
.usage-stats p {
    margin: 5px 0;
}



.json-number{
    color: #008080;
}
.json-key{
    color: #92278f;
    font-weight: bold;
}
.json-string{
    color: #d14;
}
.json-boolean{
    color: #008000;
}
.json-null{
    color: #808080;
}




/** markdown */
.md {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  line-height: 1.6;
  color: #24292e;
}

.md h1, .md h2, .md h3 {
  margin-top: 24px;
  margin-bottom: 16px;
  font-weight: 600;
  line-height: 1.25;
  border-bottom: 1px solid #eaecef;
  padding-bottom: 0.3em;
}

.md a {
  color: #0366d6;
  text-decoration: none;
}
.md a:hover { text-decoration: underline; }

.md blockquote {
  padding: 0 1em;
  color: #6a737d;
  border-left: 0.25em solid #dfe2e5;
  margin: 0 0 16px 0;
}

.md code {
  padding: 0.2em 0.4em;
  margin: 0;
  font-size: 85%;
  background-color: rgba(27,31,35,0.05);
  border-radius: 3px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

.md pre {
  padding: 16px;
  overflow: auto;
  font-size: 85%;
  line-height: 1.45;
  background-color: #f6f8fa;
  border-radius: 3px;
}

/* Reset and Container */
.md ol {
  counter-reset: md-counter; /* Initialize counter */
  padding-left: 0;           /* Clear default padding */
  list-style: none;          /* Remove default numbers */
  margin-bottom: 1.25rem;
}

.md ol > li {
  counter-increment: md-counter; /* Increment counter */
  position: relative;
  padding-left: 1.8rem;          /* Space for the number */
  margin-bottom: 0.6rem;
  line-height: 1.6;
}

/* Custom Number Styling */
.md ol > li::before {
  content: counter(md-counter) "."; /* Display the number */
  position: absolute;
  left: 0;
  color: #0366d6;                  /* Match the 'ul' theme color */
  font-weight: 700;
  font-variant-numeric: tabular-nums; /* Keeps numbers aligned */
  font-family: "SFMono-Regular", Consolas, monospace; /* Monospace for a clean look */
}

/* Nested Ordered Lists (1.1, 1.2 style) */
.md ol ol {
  counter-reset: md-sub-counter;
  margin-top: 0.5rem;
  padding-left: 0.5rem;
}

.md ol ol > li {
  counter-increment: md-sub-counter;
}

.md ol ol > li::before {
  content: counter(md-counter) "." counter(md-sub-counter);
  font-size: 0.85em;
  color: #6a737d; /* Sub-steps use a subtler color */
}

.md ul {
  padding-left: 1.5rem;
  margin-bottom: 1.25rem;
  list-style-type: none;
}

.md li {
  position: relative;
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.md ul > li::before {
  content: "•";
  color: #0366d6;
  font-weight: bold;
  position: absolute;
  left: -1.2rem;
}

.md ul ul {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  padding-left: 1.2rem;
}

.md ul ul > li::before {
  content: "◦";
  color: #6a737d;
}

.md li p {
  margin: 0;
}

.md img {
  max-width: 100%;
  box-sizing: content-box;
}