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

body {
  font-family: 'Rethink Sans', sans-serif;
  background: #1a1a1a;
  color: #fff;
  padding: 20px;
}

/* Login Screen */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #26532B 0%, #1a3a1f 100%);
  z-index: 9999;
}

.login-screen.hidden {
  display: none;
}

.login-card {
  background: #2a2a2a;
  padding: 40px;
  border-radius: 16px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-card h1 {
  margin-bottom: 10px;
  font-size: 32px;
}

.login-card p {
  color: #aaa;
  margin-bottom: 30px;
  font-size: 14px;
}

.login-card input {
  width: 100%;
  padding: 12px;
  margin-bottom: 15px;
  background: #1a1a1a;
  border: 1px solid #444;
  border-radius: 6px;
  color: white;
  font-size: 14px;
}

.login-card button {
  width: 100%;
  padding: 12px;
  background: #26532B;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s;
}

.login-card button:hover {
  background: #1f4323;
}

.login-card button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid #333;
}

h1 {
  font-size: 28px;
  font-weight: 600;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: #2a2a2a;
  border-radius: 20px;
  font-size: 14px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #666;
}

.status-dot.connected {
  background: #4CAF50;
  box-shadow: 0 0 10px #4CAF50;
}

/* Buttons */
.btn {
  padding: 10px 20px;
  background: #4CAF50;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}

.btn:hover {
  background: #45a049;
  transform: translateY(-1px);
}

.btn-secondary {
  background: #555;
}

.btn-secondary:hover {
  background: #666;
}

.btn-danger {
  background: #d32f2f;
}

.btn-danger:hover {
  background: #b71c1c;
}

/* Controls */
.controls {
  margin-bottom: 30px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Dashboard Grid */
.dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 30px;
}

.command-button {
  aspect-ratio: 1;
  background: #667eea;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: white;
  font-size: 16px;
  font-weight: 600;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.command-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

.command-button:active {
  transform: scale(0.95);
}

.command-button.sending {
  animation: pulse 0.5s;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(0.95); }
}

.command-label {
  text-align: center;
  word-wrap: break-word;
  max-width: 100%;
}

.edit-btn, .copy-btn {
  position: absolute;
  background: rgba(0,0,0,0.3);
  border: none;
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.2s;
}

.edit-btn {
  top: 8px;
  right: 8px;
}

.copy-btn {
  top: 8px;
  right: 40px;
}

.command-button:hover .edit-btn,
.command-button:hover .copy-btn {
  opacity: 1;
}

.copy-btn.copied {
  background: rgba(67, 233, 123, 0.8);
}

.add-button {
  aspect-ratio: 1;
  background: #2a2a2a;
  border: 2px dashed #555;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  color: #555;
  transition: all 0.2s;
}

.add-button:hover {
  border-color: #777;
  color: #777;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.8);
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: #2a2a2a;
  padding: 30px;
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-content h2 {
  margin-bottom: 20px;
}

.modal-content h3 {
  margin-bottom: 15px;
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  font-size: 14px;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px;
  background: #1a1a1a;
  border: 1px solid #444;
  border-radius: 6px;
  color: white;
  font-size: 14px;
  font-family: inherit;
}

.form-group textarea {
  min-height: 150px;
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 13px;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  border-bottom: 1px solid #444;
}

.tab-btn {
  padding: 10px 20px;
  background: transparent;
  border: none;
  color: #aaa;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.tab-btn.active {
  color: white;
  border-bottom-color: #667eea;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Color Picker */
.color-picker {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.color-option {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  cursor: pointer;
  border: 3px solid transparent;
  transition: all 0.2s;
}

.color-option:hover,
.color-option.selected {
  border-color: white;
  transform: scale(1.1);
}

/* Modal Actions */
.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 30px;
}

.modal-actions button {
  flex: 1;
}

/* Canvas Preview */
.canvas-preview {
  width: 100%;
  max-width: 300px;
  border: 1px solid #444;
  border-radius: 6px;
  margin: 15px 0;
  background: #1a1a1a;
}

/* Pixel Canvas */
.pixel-canvas {
  border: 1px solid #444;
  cursor: crosshair;
  display: block;
  margin: 15px auto;
  background: black;
}

.pixel-tools {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

#colorInput {
  width: 50px;
  height: 40px;
  border: 1px solid #444;
  border-radius: 6px;
  cursor: pointer;
}

/* Log */
.log {
  background: #2a2a2a;
  padding: 15px;
  border-radius: 8px;
  max-height: 200px;
  overflow-y: auto;
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 12px;
}

.log-entry {
  padding: 4px 0;
  border-bottom: 1px solid #333;
}

.log-entry:last-child {
  border-bottom: none;
}

.log-entry.success {
  color: #4CAF50;
}

.log-entry.error {
  color: #f44336;
}

.log-entry .timestamp {
  color: #888;
  margin-right: 10px;
}
