/* Global Solarized Dark Theme */
body {
  background-color: #002b36;
  color: #93a1a1;
  margin: 0;
  padding: 0;
  font-family: sans-serif;
  overflow: hidden; /* Prevent body scrollbars */
}

#header {
  background: #002b36;
  color: #fff;
  padding: 10px 20px;
  height: 60px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #586e75;
  box-sizing: border-box;
}

#header h1 {
  margin: 0;
  font-size: 24px;
}

#mainArea {
  height: calc(100vh - 60px);
  display: flex;
  overflow: hidden;
}

/* Panels */
#fileSidebar, #editorArea, #pdfPreview {
  height: 100%;
  overflow-y: auto;
  padding: 10px;
  box-sizing: border-box;
}

#fileSidebar {
  background: #073642;
  border-right: 1px solid #586e75;
}

#editorArea {
  background: #073642;
  border-right: 1px solid #586e75;
  position: relative;
  padding: 0;
}

#pdfPreview {
  background: #073642;
  display: flex;
  flex-direction: column;
  padding: 0;
  position: relative;
}

#pdfPreview .pdf-header {
  padding: 10px;
  background: #002b36;
  border-bottom: 1px solid #586e75;
  color: #fff;
}

#pdfPreview .pdf-header h4 {
  margin: 0;
}

#pdfContainer, #dockerConsoleContainer, #htmlPreview {
  overflow-y: auto;
  flex-grow: 1;
}

#dockerConsoleContainer {
  height: 20%; /* Initial height */
}

/* Common Container Styles */
.well, .shiny-input-container {
  background: #073642 !important;
  border: 1px solid #586e75 !important;
  color: #93a1a1;
  padding: 10px;
  box-shadow: none;
  margin-bottom: 10px;
}

/* File Management */
.file-tree, .file-tree ul {
  list-style-type: none;
  margin: 0;
  padding-left: 15px;
}

.file-tree li {
  margin: 3px 0;
}

.file-item, .folder-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 10px;
  cursor: pointer;
  background: #073642;
  border: 1px solid #586e75;
  color: #93a1a1;
}

.file-item:hover, .folder-item:hover {
  background: #586e75;
}

.toggle-icon {
  margin-right: 5px;
}

.file-list {
  margin: 0;
  padding: 0;
}

.file-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  border-bottom: 1px solid #586e75;
}

.file-name {
  flex-grow: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-actions {
  display: flex;
  gap: 5px;
}

/* Status Bar */
#statusBar {
  padding: 5px 10px;
  background: #073642;
  border-bottom: 1px solid #586e75;
  font-size: 12px;
  color: #fff;
  box-sizing: border-box;
}

/* Ace Editor Borders */
.ace_editor {
  border: 1px solid #586e75 !important;
}

/* Modal Dialog Styling */
.modal-content {
  background-color: #073642;
  color: #93a1a1;
  border: 1px solid #586e75;
}

.modal-header, .modal-footer {
  background-color: #002b36;
  color: #fff;
  border-bottom: 1px solid #586e75;
  border-top: 1px solid #586e75;
}

.modal-body {
  background-color: #073642;
  color: #93a1a1;
}

.modal-title {
  color: #fff;
}

/* Connectivity banner styling */
#connectivityBanner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: rgba(255, 204, 0, 0.7);
  color: #000;
  text-align: center;
  padding: 5px;
  font-size: 12px;
  z-index: 1050;
}

/* Custom Scrollbar Styling */
::-webkit-scrollbar {
  background-color: #002b36 !important;
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-thumb {
  background-color: #586e75 !important;
}

::-webkit-scrollbar-track {
  background-color: #073642 !important;
}

* {
  scrollbar-color: #586e75 #073642 !important;
}

/* Ace Editor specific scrollbar styling */
.ace_scrollbar, .ace_scrollbar-v, .ace_scrollbar-h {
  background: #002b36 !important;
}

/* Visual editor styling */
#visualEditorContainer {
  background-color: #073642;
  color: #93a1a1;
  border: 1px solid #586e75;
  padding: 10px;
  box-sizing: border-box;
}

#visualEditor {
  font-family: monospace;
  color: #93a1a1;
  background-color: #002b36;
  border: 1px solid #586e75;
  padding: 10px;
  height: 100%;
  overflow-y: auto;
  white-space: pre-wrap;
  outline: none;
}

#visualToolbar .btn {
  margin-right: 5px;
}

#htmlPreview {
  color: #93a1a1;
  background-color: #073642;
  overflow-y: auto;
  padding: 10px;
  height: 100%;
  box-sizing: border-box;
}

/* Buttons */
.btn {
    padding: 6px 12px;
    margin-bottom: 0;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.42857143;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: 4px;
    color: #fff;
    background-color: #337ab7;
    border-color: #2e6da4;
}
.btn-success {
    background-color: #5cb85c;
    border-color: #4cae4c;
}
.btn-danger {
    background-color: #d9534f;
    border-color: #d43f3a;
}
.btn-default {
    color: #333;
    background-color: #fff;
    border-color: #ccc;
}
.btn-secondary {
    color: #fff;
    background-color: #6c757d;
    border-color: #6c757d;
}
.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
    line-height: 1.5;
    border-radius: 3px;
}


/* Settings Panel */
.settings-panel {
  position: fixed;
  top: 60px; /* Below header */
  right: 0;
  width: 250px;
  background-color: #073642;
  color: #93a1a1;
  padding: 15px;
  z-index: 1053;
  overflow-y: auto;
  border-left: 1px solid #586e75;
  height: calc(100vh - 60px);
  box-sizing: border-box;
}

.setting-item {
  margin-bottom: 15px;
}

.setting-item label {
  display: block;
  margin-bottom: 5px;
}

.setting-item select, .setting-item input[type="range"] {
  width: 100%;
}

/* Split.js gutter style */
.gutter {
  background-color: #586e75;
  background-repeat: no-repeat;
  background-position: 50%;
}
.gutter.gutter-horizontal {
  background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAeCAYAAADkftS9AAAAIklEQVQoU2M4c+bMfxl79uzZfxVTAQxBTfH8UAAnBwDeAgR/xWfFEgAAAABJRU5ErkJggg==');
  cursor: col-resize;
}
.gutter.gutter-vertical {
  background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAFAQMAAABo7865AAAABlBMVEVHcEzMzMzyAv2sAAAAAXRSTlMAQObYZgAAABBJREFUeF5jOAMEEAIEEFwAn3kMwcB6I2AAAAAASUVORK5CYII=');
  cursor: row-resize;
}

/* Material Switch from shinyWidgets */
.material-switch {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.material-switch > label {
    cursor: pointer;
    height: 0px;
    position: relative;
    width: 40px;
}
.material-switch > input[type="checkbox"] {
    display: none;
}
.material-switch > input[type="checkbox"] + label:before {
    background: rgb(0, 0, 0);
    box-shadow: inset 0px 0px 10px rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    content: '';
    height: 16px;
    margin-top: -8px;
    position: absolute;
    opacity: 0.3;
    transition: all 0.4s ease-in-out;
    width: 40px;
}
.material-switch > input[type="checkbox"] + label:after {
    background: rgb(255, 255, 255);
    border-radius: 16px;
    box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.3);
    content: '';
    height: 24px;
    left: -4px;
    margin-top: -8px;
    position: absolute;
    top: -4px;
    transition: all 0.3s ease-in-out;
    width: 24px;
}
.material-switch > input[type="checkbox"]:checked + label:before {
    background: inherit;
    opacity: 0.5;
}
.material-switch > input[type="checkbox"]:checked + label:after {
    background: inherit;
    left: 20px;
}
.material-switch > label:first-of-type {
    margin-right: 10px;
}
.label-primary:after { background-color: #337ab7 !important; }
.label-primary:before { background-color: #337ab7 !important; }
