html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  display: flex;
  flex-direction: column;
  background-color: #181818;
  margin: 0;
  color: #fff;
  font-size: 14px;
  line-height: 1.6;
  font-family: Arial, Helvetica, sans-serif;
}

#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#mainContent {
  flex: 1;
  display: flex;
  overflow: hidden;
}

#sites-list-panel {
  text-align: center;
  min-width: 40%;
  max-width: 80%;
  width: 100%;
  margin: 0 auto 0 auto;
  padding: 20px;
  max-height: 100vh;
  overflow-y: auto;
}

.site-button {
  width: 100%;
  height: auto;
}

a {
  color: #1890ff;
  text-decoration: none;
}

a:hover {
  color: #1890ff;
  text-decoration: underline;
  cursor: pointer;
}

nav {
  background-color: #303030;
  padding: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.menu-link {
  display: inline-block;
  color: #fff;
  text-decoration: none;
  padding: 15px 20px;
  font-size: 20pt;
  transition: background-color 0.3s ease;
}

.menu-link:hover {
  background-color: #555;
}

.menu-link:active {
  background-color: #1890ff;
}

.h-entry {
  margin-left: 10%;
  margin-right: 10%;
  margin-bottom: 20px;
  background-color: #303030;
  border-radius: 8px;
  padding: 20px;
}

.h-entry h1 {
  text-align: center;
  font-size: 24pt;
}

.h-entry h2 {
  text-align: center;
  font-size: 20pt;
}

.h-entry h3,
.h-entry h4,
.h-entry h5,
.h-entry h6 {
  text-align: center;
  font-size: 18pt;
}

.h-entry p {
  font-size: 16pt;
}

.form-control {
  background-color: #1e1e1e;
  border: 1px solid #555;
  color: #fff;
}

.modal-content {
  background-color: #1e1e1e;
  color: #fff;
  border: 1px solid #555;
}

.modal-content,
.modal-header,
.modal-body,
.modal-footer {
  border-color: #555;
}

#sidebar {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

#editorSection {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#editorContainer {
  display: flex;
  flex-direction: column;
  height: 100%;
}

#editor {
  flex: 1;
  overflow: hidden;
}

#pageMenubar {
  display: flex;
  align-items: center;
  background-color: #0a0a0a;
  border-top: 1px solid #333;
  border-bottom: 1px solid #333;
  padding: 5px 10px;
  overflow-x: auto;
  flex-shrink: 0;
  gap: 5px;
}

#pageMenubarContent {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 1;
  overflow-x: auto;
}

#last-updated-time-label {
  display: inline-block;
}

.menubar-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 10px;
  border-radius: 3px;
  background-color: #303030;
  border: 1px solid #555;
  color: #fff;
  font-size: 14px;
  height: 50px;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
}

.menubar-item:hover {
  background-color: #1890ff;
  border-color: #68c0ff;
}

.menubar-item.active {
  background-color: #1890ff;
  color: white;
  border-color: #68c0ff;
}

.menubar-item-text {
  cursor: pointer;
}

.menubar-item button {
  background: transparent;
  border: none;
  color: white;
  font-size: 16px;
  cursor: pointer;
  padding: 0 5px;
  margin: 0;
}

.menubar-item button:hover {
  background: transparent;
  color: #68c0ff;
  margin: 0;
  padding: 0 5px;
}

#footer {
  padding: 10px 20px;
  background-color: #0a0a0a;
  border-top: 1px solid #333;
  flex-shrink: 0;
}

.toastui-editor-popup,
.toastui-editor-popup-add-link,
.image-upload-popup {
  position: relative !important;
  max-width: 90% !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%,0%) !important;
  margin: 0 !important;
}

.toastui-editor-toolbar-item-wrapper {
  margin: 0 !important;
}

.btn {
  padding: 10px 20px;
  font-size: 16px;
  margin: 5px;
  background-color: #101010;
  color: #fff;
  display: inline-block;
  position: relative;
}

.btn:hover {
  background-color: #333;
  color: #fff;
}

.btn.loading {
  pointer-events: none;
}

.btn.loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spinner 0.6s linear infinite;
}

@keyframes spinner {
  to {
    transform: rotate(360deg);
  }
}

.alert-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: 15px 20px;
  text-align: center;
  font-size: 16px;
  z-index: 9999;
  display: none;
  animation: slideDown 0.3s ease-out;
}

.alert-bar.show {
  display: block;
}

.alert-bar.success {
  background-color: #4CAF50;
  color: white;
}

.alert-bar.error {
  background-color: #f44336;
  color: white;
}

@keyframes slideDown {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.sidebar-file-item {
  margin: auto;
  border-radius: 3px;
  background-color: #0a0a0a;
  cursor: pointer;
  font-size: 14px;
  border: 1px solid #333;
}

.sidebar-file-item:hover {
  background-color: #1890ff;
  border-color: #68c0ff;
}

.sidebar-file-item.active {
  background-color: #1890ff;
  color: white;
  border-color: #68c0ff;
}

.sidebar-file-text {
  flex: 1;
  cursor: pointer;
  padding: 5px 10px;
}

#sidebar {
  display: flex;
  min-width: 120px;
  max-width: 20%;
  border-right: 1px solid rgb(204, 204, 204);
}

#sidebarContentWrapper {
  margin-right: 20px;
}

#editorContainer {
  margin-left: 20px;
}

#footer p {
  margin: 0 !important;
}

/* Image upload popup styles */
.image-upload-popup {
  position: relative !important;
  background-color: #1e1e1e;
  border: 1px solid #555;
  border-radius: 8px;
  padding: 20px;
  max-width: 90%;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.image-upload-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.image-upload-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.image-upload-header h3 {
  margin: 0;
  color: #fff;
  font-size: 18px;
}

.image-upload-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 28px;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  line-height: 1;
}

.image-upload-close:hover {
  color: #ff4444;
}

.image-upload-dropzone {
  border: 2px dashed #555;
  border-radius: 8px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background-color: transparent;
}

.image-upload-dropzone:hover {
  border-color: #1890ff;
  background-color: rgba(24, 144, 255, 0.05);
}

.dropzone-content {
  color: #fff;
}

.dropzone-icon {
  font-size: 48px;
  margin: 0 0 10px 0;
}

.dropzone-content p {
  margin: 5px 0;
  color: #ccc;
}

.dropzone-hint {
  font-size: 12px;
  color: #888;
  font-style: italic;
}

.image-upload-progress {
  text-align: center;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background-color: #333;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-fill {
  width: 100%;
  height: 100%;
  background-color: #1890ff;
  animation: progressPulse 1.5s ease-in-out infinite;
}

.progress-text {
  color: #ccc;
  font-size: 14px;
  margin: 0;
}

@keyframes progressPulse {
  0% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.6;
  }
}

.image-gallery-section {
  margin-top: 20px;
}

.image-gallery-section h4 {
  margin: 0 0 10px 0;
  color: #fff;
  font-size: 16px;
}

.image-gallery {
  max-height: 300px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
  padding: 10px;
  background-color: #0a0a0a;
  border-radius: 8px;
  border: 1px solid #333;
}

.image-gallery:empty::before {
  content: "No images uploaded yet";
  color: #888;
  font-size: 14px;
  grid-column: 1 / -1;
  text-align: center;
  padding: 20px;
}

.image-gallery-item {
  position: relative;
  width: 100px;
  height: 100px;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s ease;
}

.image-gallery-item:hover {
  border-color: #1890ff;
  transform: scale(1.05);
}

.image-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-delete-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  background-color: rgba(255, 68, 68, 0.9);
  color: white;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 10;
}

.image-gallery-item:hover .image-delete-btn {
  opacity: 1;
}

.image-delete-btn:hover {
  background-color: rgba(255, 0, 0, 1);
}

/* HTML embed popup styles */
.html-embed-popup {
  position: relative !important;
  background-color: #1e1e1e;
  border: 1px solid #555;
  border-radius: 8px;
  padding: 20px;
  min-width: 500px;
  max-width: 90%;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.html-embed-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.html-embed-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.html-embed-header h3 {
  margin: 0;
  color: #fff;
  font-size: 18px;
}

.html-embed-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 28px;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  line-height: 1;
}

.html-embed-close:hover {
  color: #ff4444;
}

.html-embed-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.html-embed-form label {
  color: #ccc;
  font-size: 14px;
  margin-bottom: 5px;
}

.html-embed-form textarea {
  width: 100%;
  padding: 10px;
  background-color: #0a0a0a;
  border: 1px solid #555;
  border-radius: 4px;
  color: #fff;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  resize: vertical;
  min-height: 150px;
}

.html-embed-form textarea:focus {
  outline: none;
  border-color: #1890ff;
}

.html-embed-buttons {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 10px;
}

.html-embed-insert-btn,
.html-embed-cancel-btn {
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
  border-radius: 4px;
}

@media (max-width: 768px) {
  
  .toastui-editor-tooltip {
    display: none !important;
  }

  .toastui-editor-dropdown-toolbar {
    left: auto !important;
    right: 0 !important;
    max-width: 100% !important;
    height: auto !important;
    flex-wrap: wrap !important;
    height: auto !important;
    overflow: visible !important;
    white-space: normal !important;
  }

  .menu-link {
    font-size: 14pt;
  }

  .h-entry h1 {
    font-size: 16pt;
  }

  .h-entry h2 {
    font-size: 14pt;
  }

  .h-entry h3,
  .h-entry h4,
  .h-entry h5,
  .h-entry h6 {
    font-size: 12pt;
  }

  .h-entry p {
    font-size: 10pt;
  }

  .image-upload-popup {
    min-width: 300px;
    max-width: 90vw;
  }

  .html-embed-popup {
    min-width: 300px;
    max-width: 90vw;
  }
}