* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  display: flex;
  flex-direction: column;
  height: 100vh;
  transition: background 0.3s, color 0.3s;
}

body.dark-mode {
  background-color: #121212;
  color: #eee;
}

#header {
  padding: 10px;
  background-color: #f5f5f5;
  text-align: center;
  border-bottom: 1px solid #ccc;
}

body.dark-mode #header {
  background-color: #1e1e1e;
  border-color: #333;
}

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

#sidebar {
  width: 250px;
  background: #f0f0f0;
  border-right: 1px solid #ccc;
  overflow-y: auto;
  padding: 10px;
}

body.dark-mode #sidebar {
  background: #1e1e1e;
  border-color: #333;
}

#accordion-toggle {
  display: block;
  width: 100%;
  background: #7da2ff;
  color: white;
  padding: 10px;
  font-weight: bold;
  cursor: pointer;
  border: none;
  border-radius: 5px;
  margin-bottom: 10px;
}

.file-item {
  padding: 8px;
  cursor: pointer;
  border-radius: 5px;
  margin-bottom: 5px;
}

.file-item.active {
  background-color: #007BFF;
  color: white;
}

#viewer {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  text-align: center;
  position: relative;
}

canvas {
  margin: 10px 0;
  max-width: 100%;
  background-color: white;
}

body.dark-mode canvas {
  background-color: #444;
}

#toolbar {
  position: sticky;
  top: 0;
  background: white;
  padding: 10px 0;
  border-bottom: 1px solid #ccc;
  z-index: 999;
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  transition: transform 0.3s ease;
}

body.dark-mode #toolbar {
  background: #1e1e1e;
  border-color: #333;
}

button {
  padding: 10px 15px;
  font-size: 14px;
  cursor: pointer;
}

input[type="file"] {
  margin-top: 10px;
}

#dark-mode-toggle {
  position: absolute;
  right: 20px;
  top: 10px;
  font-size: 14px;
}

#header.hidden {
  display: none;
}

@media (max-width: 768px) {
  #main {
    flex-direction: column;
  }

  #sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #ccc;
    max-height: 300px;
  }

  #dark-mode-toggle {
    position: static;
    margin-top: 10px;
  }
}

#toggle-header {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 10000;
  padding: 10px 15px;
  font-size: 14px;
  border: none;
  border-radius: 6px;
  background-color: #7da2ff;
  color: white;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  transition: background-color 0.3s ease;
}

#toggle-header:hover {
  background-color: #0056b3;
}
