/**
 * Header
 */

.header {
  box-sizing: border-box;
  font-size: 16px;
  height: 85px;
  padding: 15px 70px;
  position: fixed;
  width: 100%;
  z-index: 1000;
  margin: 0;
  border-bottom: 5px solid #00a7e9;
  display: flex;
  justify-content: space-between;
  align-items: center;
  top: 0;
  transition: transform 0.3s ease-in-out;
}

.header-hidden {
  transform: translateY(-100%);
}

.header .left {
  display: flex;
  align-items: center;
}

.header .title {
  font-size: 24px;
  font-weight: 500;
  margin-right: 30px;
}

.header .right {
  display: flex;
  align-items: center;
  gap: 15px;
}

.header .controls-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 20px;
  padding-right: 20px;
  border-right: 2px solid #ccc;
}

.header .controls-row label {
  font-size: 13px;
  margin-left: 12px;
}

.header .controls-row label:first-child {
  margin-left: 0;
}

.header button {
  border: solid 2px #fff;
  background-color: #000;
  color: #fff;
  height: 30px;
}

.header button:hover {
  background-color: #fff;
  color: #000;
}

.header button.highlight {
  background-color: #ff6b00;
  border-color: #ff6b00;
  color: #fff;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(255, 107, 0, 0.7);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 0 10px rgba(255, 107, 0, 0);
  }
}

.header select {
  height: 30px;
}

button,
.firmware {
  height: 25px;
  font-size: 16px;
  border-radius: 15px;
  padding-left: 20px;
  padding-right: 20px;
  border-width: 2px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", Arial, sans-serif;
  font-style: normal;
  font-weight: 400;
  margin: 0;
}

p {
  margin: 0;
}

input,
select,
button,
label {
  font-weight: 600;
  outline: none;
}

div.left {
  float: left;
  display: flex;
  align-items: center;
}

div.right {
  float: right;
  display: flex;
  align-items: center;
}

div.clear {
  clear: both;
}

.main {
  overflow-x: hidden;
  overflow-y: auto;
  padding-top: 90px;
  transition: padding-top 0.3s ease-in-out;
}

.main.no-header-padding {
  padding-top: 0;
}

.hidden {
  display: none;
}

.notSupported {
  padding: 1em;
  margin-top: 1em;
  margin-bottom: 1em;
}

.log-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 12px;
  border-left: 1px solid #ccc;
}

.log-controls.hidden {
  display: none;
}

.small-btn {
  padding: 4px 12px;
  font-size: 13px;
  border-radius: 12px;
  border-width: 2px;
  border-style: solid;
  cursor: pointer;
  height: 26px;
  line-height: 14px;
}

#app.connected #commands {
  height: auto;
  max-height: 70vh;
  overflow-y: auto;
}

#app.connected #log {
  height: calc(100vh - 320px);
  min-height: 200px;
}

#app.connected #log.hidden {
  height: 0;
  min-height: 0;
  padding: 0;
  border: 0;
}

#app #commands {
  height: 0;
  overflow: hidden;
}

#app #log {
  height: calc(100vh - 220px);
  min-height: 200px;
}

#app #log.hidden {
  height: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
}

#commands,
#log {
  transition: height 0.5s;
}

#commands {
  position: relative;
  margin: 0 auto;
  overflow-y: auto;
  padding: 0 60px;
}

#log {
  max-width: 100%;
  font-family: "SF Mono", "Menlo", "Monaco", "Consolas", "Liberation Mono", "Courier New", monospace;
  font-style: normal;
  font-weight: 400;
  font-size: 16px;
  overflow-x: hidden;
  overflow-x: auto;
  transition: color 0.1s linear;
  padding: 0 50px;
  border: 20px solid #000;
  -ms-overflow-style: none;
  scrollbar-width: none;
  background-color: #000;
  color: #cecece;
}

#log::-webkit-scrollbar {
  display: none;
}

.footer {
  padding: 10px 70px;
  height: 20px;
}

.remix {
  display: flex;
  justify-content: center;
  height: 60px;
  position: relative;
}

.remix button {
  position: absolute;
  bottom: 11px;
}

#templates {
  display: none;
}

/* On/Off Switch Widget */
.onoffswitch {
  display: inline-block;
  position: relative;
  width: 70px;
  margin-right: 5px;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  margin-left: 5px;
}

.onoffswitch-checkbox {
  display: none;
}

.onoffswitch-label {
  display: block;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid #900;
  border-radius: 15px;
  transition: border 0.3s ease-in 0s;
}

.onoffswitch-inner {
  display: block;
  width: 200%;
  margin-left: -100%;
  transition: margin 0.3s ease-in 0s;
}

.onoffswitch-inner:before,
.onoffswitch-inner:after {
  display: block;
  float: left;
  width: 50%;
  height: 25px;
  padding: 0;
  line-height: 25px;
  font-size: 14px;
  color: white;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", Arial, sans-serif;
  font-style: normal;
  font-weight: 600;
  box-sizing: border-box;
}

.onoffswitch-inner:before {
  content: "on";
  padding-left: 6px;
  background-color: #8ec641;
  color: #fff;
}

.onoffswitch-inner:after {
  content: "off";
  padding-right: 6px;
  background-color: #c64141;
  color: #fff;
  text-align: right;
}

.onoffswitch-switch {
  display: block;
  width: 19px;
  margin: 3px;
  background: #fff;
  position: absolute;
  top: 0;
  bottom: 0;
  right: 23px;
  border: 1px solid #900;
  border-radius: 15px;
  transition: all 0.3s ease-in 0s;
}

.onoffswitch-checkbox:checked + .onoffswitch-label {
  border-color: #71ae1e;
}

.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-inner {
  margin-left: 0;
}

.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-switch {
  right: 0px;
  border-color: #67ac38;
}



#commands {
  min-width: 600px;
  justify-content: center;
  position: relative;
  align-items: center;
}

#commands .upload {
  max-width: 600px;
  display: flex;
  align-items: center;
  margin: 5px auto;
  justify-content: flex-start;
  padding-left: calc(50% - 300px);
}

/* Hide upload rows 2-8 by default, show dynamically via JavaScript */
#commands .upload:nth-child(n+2):nth-child(-n+8) {
  display: none;
}

#commands .upload .offset {
  width: 50px;
}

#commands .upload label {
  white-space: nowrap;
}

.firmware > input {
  width: 0.1px;
  height: 0.1px;
  opacity: 0;
  overflow: hidden;
  position: absolute;
  z-index: -1;
}

.firmware {
  border-style: solid;
  margin-left: 20px;
  margin-right: 20px;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.firmware > svg {
  margin-right: 10px;
}

.debug-function {
  color: #8ec641;
}

.error-message {
  color: #c64141;
}

.timestamp {
  color: #8ec641;
}

.progress-bar {
  width: 100%;
  height: 24px;
  border-style: solid;
  border-width: 2px;
  border-radius: 10px;
  padding: 0;
  overflow: hidden;
}

.progress-bar > div {
  height: 24px;
  background-color: #71ae1e;
  width: 0;
}

#commands .buttons {
  display: flex;
  justify-content: center;
  width: 600px;
  margin: 10px auto;
}

#commands .buttons button {
  margin-left: 10px;
  margin-right: 10px;
  border-width: 2px;
  border-style: solid;
  cursor: pointer;
}

#commands button {
  cursor: pointer;
}

#commands .read-flash {
  width: 800px;
  margin: 20px auto 10px auto;
  padding-top: 20px;
  border-top: 2px solid #ccc;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#commands .read-flash .progress-bar {
  width: 400px;
  margin-bottom: 10px;
}

#commands .read-flash-inputs {
  display: flex;
  align-items: center;
  gap: 15px;
}

#commands .read-flash label {
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

#commands .read-flash input {
  width: 100px;
  padding: 5px;
  border-radius: 5px;
  border: 2px solid #ccc;
}

#commands .read-flash button {
  border-width: 2px;
  border-style: solid;
  padding: 2px 30px;
  cursor: pointer;
}

#commands .partition-table {
  width: 800px;
  margin: 20px auto 10px auto;
  padding-top: 20px;
  border-top: 2px solid #ccc;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#commands .partition-table button {
  margin: 0 0 10px 0;
  border-width: 2px;
  border-style: solid;
  padding: 2px 30px;
  cursor: pointer;
}

#commands .partition-table #butOpenFSManager {
  background-color: #8ec641;
  color: white;
  border-color: #8ec641;
}

#commands .partition-table #butOpenFSManager:hover {
  background-color: #71ae1e;
  border-color: #71ae1e;
}

#commands .partition-table .progress-bar {
  width: 400px;
  margin-bottom: 10px;
}

.partition-table-display {
  width: 100%;
  margin-top: 20px;
  border-collapse: collapse;
}

.partition-table-display th,
.partition-table-display td {
  padding: 8px 12px;
  text-align: left;
  border: 1px solid #ccc;
}

.partition-table-display th {
  font-weight: 600;
  background-color: #f0f0f0;
}

.partition-download-btn {
  padding: 5px 15px;
  font-size: 14px;
  border-radius: 10px;
  border-width: 2px;
  border-style: solid;
  cursor: pointer;
  background-color: transparent;
  transition: background-color 0.2s, color 0.2s;
}

.partition-download-btn:hover {
  background-color: #00a7e9;
  color: #fff;
  border-color: #00a7e9;
}

/* ESP8266 Filesystem Info Box */
.esp8266-info {
  width: 100%;
  margin-top: 15px;
}

.esp8266-info .info-box {
  background-color: #f8f9fa;
  border: 2px solid #00a7e9;
  border-radius: 8px;
  padding: 15px 20px;
  text-align: left;
}

.esp8266-info .info-box strong {
  display: block;
  font-size: 16px;
  margin-bottom: 10px;
  color: #00a7e9;
}

.esp8266-info .info-box p {
  margin: 8px 0;
  line-height: 1.5;
}

.esp8266-info .info-box ul {
  margin: 10px 0;
  padding-left: 20px;
  list-style-type: none;
}

.esp8266-info .info-box ul li {
  margin: 5px 0;
  padding-left: 0;
}

.esp8266-info .info-box ul li strong {
  display: inline;
  font-size: 14px;
  color: inherit;
  margin: 0;
}

.justify {
  display: flex;
  justify-content: space-between;
}
.center {
  text-align: center;
}

/* LittleFS Manager Styles */
.littlefs-manager {
  width: 900px;
  margin: 30px auto;
  padding: 25px;
  border: 2px solid #71ae1e;
  border-radius: 10px;
  background-color: rgba(113, 174, 30, 0.05);
}

.littlefs-manager h3 {
  margin: 0 0 20px 0;
  color: #71ae1e;
  font-size: 20px;
  font-weight: 600;
}

.littlefs-info {
  margin-bottom: 20px;
  padding: 15px;
  background-color: rgba(255, 255, 255, 0.5);
  border-radius: 8px;
}

.littlefs-partition-info {
  margin-bottom: 12px;
  font-size: 14px;
}

.littlefs-size {
  color: #666;
  margin-left: 8px;
}

.littlefs-usage {
  margin-top: 10px;
}

.usage-bar {
  width: 100%;
  height: 20px;
  background-color: #e0e0e0;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 8px;
}

.usage-fill {
  height: 100%;
  background: linear-gradient(90deg, #71ae1e 0%, #8ec641 100%);
  transition: width 0.3s ease;
}

.usage-text {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: #555;
}

.disk-version {
  font-size: 12px;
  padding: 2px 8px;
  background-color: #71ae1e;
  color: white;
  border-radius: 4px;
}

.littlefs-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.littlefs-controls button {
  /* Use default button styles from main stylesheet */
  border-style: solid;
  cursor: pointer;
}

.littlefs-controls button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.littlefs-breadcrumb {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
  padding: 10px;
  background-color: rgba(255, 255, 255, 0.5);
  border-radius: 8px;
}

.littlefs-breadcrumb button {
  /* Use default button styles */
  border-style: solid;
  cursor: pointer;
}

.littlefs-breadcrumb button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.littlefs-breadcrumb span {
  font-family: monospace;
  font-size: 14px;
  color: #333;
}

.littlefs-file-upload {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
  align-items: center;
}

.littlefs-file-upload input[type="file"] {
  flex: 1;
  padding: 5px;
  border: 2px solid #ccc;
  border-radius: 8px;
}

.littlefs-file-upload button {
  /* Use default button styles */
  border-style: solid;
  cursor: pointer;
}

.littlefs-file-upload button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.littlefs-files {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid #ccc;
  border-radius: 8px;
}

.file-table {
  width: 100%;
  border-collapse: collapse;
}

.file-table thead {
  position: sticky;
  top: 0;
  background-color: #f5f5f5;
  z-index: 10;
}

.file-table th {
  padding: 10px;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid #ccc;
}

.file-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #e0e0e0;
}

.file-table tbody tr:hover {
  background-color: rgba(113, 174, 30, 0.1);
}

.file-table .empty-state {
  text-align: center;
  color: #999;
  padding: 30px;
  font-style: italic;
}

.file-name {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.file-name.clickable:hover {
  color: #71ae1e;
  text-decoration: underline;
}

.file-icon {
  font-size: 16px;
}

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

.file-actions button {
  padding: 4px 12px;
  font-size: 12px;
  height: auto;
  border-style: solid;
  cursor: pointer;
  transition: all 0.2s;
}

.littlefs-fs-button {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  font-size: 11px;
  height: auto;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
}

/* ESP32-S2 Reconnect Modal */
.modal {
  display: flex;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  align-items: center;
  justify-content: center;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background-color: #fff;
  padding: 40px;
  border-radius: 15px;
  box-shadow: 0 5px 30px rgba(0, 0, 0, 0.3);
  text-align: center;
  max-width: 500px;
  animation: modalSlideIn 0.3s ease-out;
}

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

.modal-content h2 {
  color: #4a4a4a;
  margin-top: 0;
  font-size: 24px;
  margin-bottom: 20px;
}

.modal-content p {
  font-size: 16px;
  line-height: 1.6;
  margin: 15px 0;
  color: #333;
}

.modal-button {
  background-color: #fff;
  color: #6b6b6b;
  border: 2px solid #6b6b6b;
  padding: 12px 40px;
  font-size: 18px;
  font-weight: 600;
  border-radius: 25px;
  cursor: pointer;
  margin-top: 20px;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: normal;
  text-align: center;
}

.modal-button:hover {
  background-color: #71ae1e;
  color: #fff;
  border-color: #71ae1e;
}

/* File Viewer Modal Styles */
.file-viewer-content {
  max-width: 900px;
  width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  text-align: left;
}

.file-viewer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 30px;
  border-bottom: 2px solid #e0e0e0;
}

.file-viewer-header h2 {
  margin: 0;
  font-size: 20px;
  color: #333;
}

.close-button {
  background: none;
  border: none;
  font-size: 28px;
  color: #999;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
}

.close-button:hover {
  background-color: #f0f0f0;
  color: #333;
}

.file-viewer-info {
  display: flex;
  justify-content: space-between;
  padding: 12px 30px;
  background-color: #f8f8f8;
  font-size: 13px;
  color: #666;
  border-bottom: 1px solid #e0e0e0;
}

.file-viewer-tabs {
  display: flex;
  padding: 0 30px;
  background-color: #f8f8f8;
  border-bottom: 2px solid #e0e0e0;
}

.tab-button {
  background: none;
  border: none;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  color: #666;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
  margin-bottom: -2px;
}

.tab-button:hover {
  color: #333;
  background-color: rgba(113, 174, 30, 0.1);
}

.tab-button.active {
  color: #71ae1e;
  border-bottom-color: #71ae1e;
}

.file-viewer-body {
  flex: 1;
  overflow: auto;
  padding: 20px 30px;
  background-color: #fff;
  min-height: 300px;
  max-height: calc(90vh - 250px);
  text-align: left;
}

.file-viewer-body pre {
  margin: 0;
  font-family: "SF Mono", "Menlo", "Monaco", "Consolas", "Liberation Mono", "Courier New", monospace;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre;
  overflow-x: auto;
  color: #333;
  tab-size: 4;
  text-align: left;
}

.file-viewer-body .hex-view {
  font-family: "SF Mono", "Menlo", "Monaco", "Consolas", "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  line-height: 1.6;
}

.hex-line {
  display: flex;
  margin-bottom: 2px;
}

.hex-offset {
  color: #999;
  margin-right: 20px;
  min-width: 80px;
}

.hex-bytes {
  color: #333;
  margin-right: 20px;
  min-width: 400px;
}

.hex-ascii {
  color: #666;
}

.file-viewer-footer {
  padding: 20px 30px;
  border-top: 2px solid #e0e0e0;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
