* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: #000000;
  min-height: 100vh;
  padding: 20px;
}

.container {
  max-width: 1175px;
  width: 1175px;
  margin: 0 auto;
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

/* Dark Mode */
body.dark-mode .container {
  background: #000000;
  color: white;
}

body.dark-mode .control-group,
body.dark-mode .control-group-no-title {
  background: #1a1a1a;
  border-color: #ffffff;
  color: white;
}

body.dark-mode .control-group h3 {
  color: #ffffff;
}

body.dark-mode .canvas-info {
  background: #1a1a1a;
  color: white;
}

body.dark-mode #vectorCanvas {
  background: #000000;
  border-color: #ffffff;
}

body.dark-mode .tool-btn {
  background: #1a1a1a;
  border-color: #ffffff;
  color: #ffffff;
}

body.dark-mode .tool-btn:hover {
  background: #ffffff;
  color: #000000;
}

body.dark-mode .tool-btn-active {
  background: #17a2b8;
  border-color: #17a2b8;
  color: white;
}

body.dark-mode .tool-btn-active:hover {
  background: #138496;
  border-color: #138496;
}

body.dark-mode .btn {
  border-color: #ffffff;
}

body.dark-mode .btn-info {
  background: #000000;
  border: 2px solid #ffffff;
  color: #ffffff;
}

body.dark-mode .btn-success {
  background: #000000;
  border: 2px solid #ffffff;
  color: #ffffff;
}

body.dark-mode .btn-success:hover {
  background: #28a745;
  border: 2px solid #28a745;
  color: #ffffff;
}

body.dark-mode .btn-danger {
  background: #000000;
  border: 2px solid #ffffff;
  color: #ffffff;
}

body.dark-mode .btn-danger:hover {
  background: #dc3545;
  border: 2px solid #dc3545;
  color: #ffffff;
}

body.dark-mode .output-section textarea {
  background: #000000 !important;
  border-color: #ffffff !important;
  color: #ffffff !important;
}

body.dark-mode input[type="text"],
body.dark-mode input[type="number"],
body.dark-mode input[type="file"],
body.dark-mode select {
  background: #1a1a1a;
  border-color: #ffffff;
  color: white;
}

body.dark-mode input[type="file"]::file-selector-button {
  background: #1a1a1a;
  border: 1px solid #ffffff;
  color: white;
  padding: 5px 10px;
  cursor: pointer;
  border-radius: 4px;
}

body.dark-mode input[type="file"]::file-selector-button:hover {
  background: #ffffff;
  color: #000000;
}

header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 30px;
  text-align: center;
}

header h1 {
  font-size: 2.5em;
  margin-bottom: 10px;
}

header p {
  font-size: 1.1em;
  opacity: 0.9;
}

.main-content {
  display: grid;
  grid-template-columns: 60px 600px 400px;
  gap: 15px;
  padding: 30px 20px 20px 20px;
  justify-content: center;
  align-items: start;
}

.canvas-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#vectorCanvas {
  border: 2px solid #000000;
  border-radius: 8px;
  cursor: crosshair;
  background: #f8f9fa;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  max-width: 100%;
  height: auto;
}

.canvas-info {
  display: flex;
  justify-content: space-between;
  padding: 10px;
  background: #f8f9fa;
  border-radius: 6px;
  font-family: "Courier New", monospace;
  font-size: 14px;
  color: #333;
}

/* Output Section */
.output-section {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.output-buttons {
  display: flex;
  gap: 10px;
}

.output-section textarea {
  width: 100%;
  min-height: 150px;
  padding: 10px;
  border: 2px solid #000000;
  border-radius: 6px;
  font-family: "Courier New", monospace;
  font-size: 12px;
  resize: vertical;
  background: #ffffff;
  color: #000000;
  display: none;
}

/* Vertical Toolbar */
.toolbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  background: transparent;
  border-radius: 0;
  border: none;
  align-self: start;
  align-items: center;
}

.toolbar-divider {
  height: 1px;
  background: #d0d0d0;
  margin: 4px 0;
}

.tool-btn {
  width: 50px;
  height: 50px;
  padding: 14px;
  border: 2px solid #000000;
  background: white;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000000;
}

.tool-btn svg {
  width: 100%;
  height: 100%;
}

.tool-btn:hover {
  background: #000000;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.tool-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

.tool-btn svg {
  width: 24px;
  height: 24px;
}

/* Mode button states */
.tool-btn-add {
  background: #28a745;
  border-color: #28a745;
  color: white;
}

.tool-btn-add:hover {
  background: #218838;
  border-color: #218838;
}

.tool-btn-remove {
  background: #dc3545;
  border-color: #dc3545;
  color: white;
}

.tool-btn-remove:hover {
  background: #c82333;
  border-color: #c82333;
}

.tool-btn-active {
  background: #17a2b8;
  border-color: #17a2b8;
  color: white;
}

.tool-btn-active:hover {
  background: #138496;
  border-color: #138496;
}

.controls-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Control group without title - same style as regular control-group */
.control-group-no-title {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 8px;
  border: 2px solid #000000;
  margin-bottom: 5px;
}

.control-group-no-title label {
  display: block;
  margin: 8px 0;
  cursor: pointer;
  user-select: none;
}

.control-group-no-title input[type="checkbox"] {
  margin-right: 8px;
}

.control-group {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 8px;
  border: 2px solid #000000;
}

.control-group h3 {
  margin-bottom: 12px;
  color: #000000;
  font-size: 1.1em;
  font-weight: 600;
}

.control-group label {
  display: block;
  margin: 8px 0;
  cursor: pointer;
  user-select: none;
}

.control-group input[type="checkbox"],
.control-group input[type="radio"] {
  margin-right: 8px;
}

.grid-size-control {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.grid-size-control input {
  width: 80px;
  padding: 5px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s ease;
  margin: 5px 5px 5px 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: #000000;
  color: white;
}

.btn-success {
  background: #28a745;
  color: white;
}

.btn-info {
  background: #17a2b8;
  color: white;
}

.btn-warning {
  background: #ffc107;
  color: #333;
}

.btn-secondary {
  background: #6c757d;
  color: white;
}

.btn-danger {
  background: #dc3545;
  color: white;
}

#outputArea {
  width: 100%;
  min-height: 150px;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-family: "Courier New", monospace;
  font-size: 13px;
  resize: vertical;
  background: white;
}

.point-list {
  max-height: 200px;
  overflow-y: auto;
  font-family: "Courier New", monospace;
  font-size: 12px;
  background: white;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid #ddd;
}

.point-item {
  padding: 4px 8px;
  margin: 2px 0;
  background: #e9ecef;
  border-radius: 4px;
  display: flex;
  justify-content: space-between;
}

.point-item:hover {
  background: #dee2e6;
}
