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

html, body, #app {
  width: 100%;
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: #f5f5f5;
  color: #333;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* Login Screen */
.login-screen {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
  background: white;
  padding: 40px;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 400px;
}

.login-box h1 {
  margin-bottom: 10px;
  font-size: 24px;
  color: #333;
  text-align: center;
}

.login-box p {
  text-align: center;
  color: #666;
  margin-bottom: 30px;
  font-size: 14px;
}

.login-box .error {
  color: #d32f2f;
  background: #ffebee;
  padding: 10px;
  border-radius: 4px;
  margin-bottom: 20px;
  font-size: 13px;
  border-left: 4px solid #d32f2f;
}

.login-box .locked {
  color: #c62828;
  background: #ffcdd2;
  padding: 12px;
  border-radius: 4px;
  margin-bottom: 20px;
  font-size: 13px;
  border-left: 4px solid #c62828;
}

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

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

.form-group input[type="password"],
.form-group input[type="text"] {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  transition: border-color 0.2s;
}

.form-group input[type="password"]:focus,
.form-group input[type="text"]:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

button {
  padding: 12px 24px;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  width: 100%;
  background: #667eea;
  color: white;
  margin-bottom: 10px;
}

.btn-primary:hover {
  background: #5568d3;
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-primary:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.btn-secondary {
  background: #f5f5f5;
  color: #333;
  border: 1px solid #ddd;
  margin-right: 10px;
  margin-bottom: 10px;
}

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

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

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

.btn-success {
  background: #388e3c;
  color: white;
}

.btn-success:hover {
  background: #2e7d32;
}

/* Panel Screen */
.panel-screen {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: #f5f5f5;
}

.header {
  background: white;
  border-bottom: 1px solid #ddd;
  padding: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header h1 {
  font-size: 24px;
  color: #333;
}

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

.user-email {
  font-size: 13px;
  color: #666;
  margin-right: 20px;
}

.main-content {
  flex: 1;
  overflow-y: auto;
}

.content-area {
  max-width: 1200px;
  margin: 0 auto;
  padding: 30px 20px;
}

/* Command Groups */
.command-group {
  margin-bottom: 40px;
}

.group-title {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid #667eea;
}

.command-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.command-card {
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
}

.command-card:hover {
  border-color: #667eea;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
  transform: translateY(-2px);
}

.command-card.with-params {
  cursor: auto;
}

.command-label {
  font-weight: 600;
  color: #333;
  margin-bottom: 6px;
  font-size: 14px;
}

.command-description {
  font-size: 13px;
  color: #666;
  margin-bottom: 0;
}

.command-card.simple {
  cursor: pointer;
}

.command-card.simple:hover {
  border-color: #667eea;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
}

/* Param Forms */
.param-form {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #eee;
}

.param-field {
  margin-bottom: 12px;
}

.param-field label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: #666;
  margin-bottom: 6px;
}

.param-field select,
.param-field input {
  width: 100%;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
}

.param-field select:focus,
.param-field input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.param-buttons {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.param-buttons button {
  flex: 1;
  padding: 8px 12px;
  font-size: 12px;
}

/* Collection Order Panel */
.collection-panel {
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 40px;
}

.collection-panel h2 {
  font-size: 16px;
  margin-bottom: 16px;
  color: #333;
}

.collection-list {
  background: #f9f9f9;
  border: 1px solid #eee;
  border-radius: 4px;
  max-height: 400px;
  overflow-y: auto;
}

.collection-item {
  padding: 12px;
  border-bottom: 1px solid #eee;
  cursor: move;
  display: flex;
  align-items: center;
  background: white;
  transition: background 0.1s;
}

.collection-item:last-child {
  border-bottom: none;
}

.collection-item:hover {
  background: #f5f5f5;
}

.collection-item.dragging {
  opacity: 0.5;
  background: #e3f2fd;
}

.collection-item.drag-over {
  border-top: 2px solid #667eea;
}

.drag-handle {
  margin-right: 10px;
  cursor: grab;
  color: #999;
  font-weight: bold;
  font-size: 16px;
}

.collection-name {
  flex: 1;
  color: #333;
  font-size: 14px;
}

.collection-buttons {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.collection-buttons button {
  padding: 10px 16px;
  font-size: 13px;
}

/* Result Card */
.result-card {
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 16px;
  margin-top: 20px;
  margin-bottom: 20px;
}

.result-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.result-code {
  font-weight: 600;
  font-size: 14px;
  padding: 4px 8px;
  border-radius: 4px;
  min-width: 50px;
  text-align: center;
}

.result-code.success {
  background: #c8e6c9;
  color: #1b5e20;
}

.result-code.error {
  background: #ffcdd2;
  color: #b71c1c;
}

.result-duration {
  font-size: 12px;
  color: #666;
  margin-left: auto;
}

.result-badges {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.badge {
  display: inline-block;
  padding: 4px 8px;
  background: #f0f0f0;
  border-radius: 12px;
  font-size: 11px;
  color: #666;
}

.badge.warning {
  background: #fff3cd;
  color: #856404;
}

.badge.info {
  background: #d1ecf1;
  color: #0c5460;
}

.output-section {
  margin-bottom: 12px;
}

.output-section h4 {
  font-size: 12px;
  font-weight: 600;
  color: #666;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.output-box {
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 10px;
  font-family: "Monaco", "Menlo", "Ubuntu Mono", monospace;
  font-size: 12px;
  color: #333;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 300px;
  overflow-y: auto;
  line-height: 1.4;
}

.output-box.empty {
  color: #999;
  font-style: italic;
}

/* Loading Spinner */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 8px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-indicator {
  display: flex;
  align-items: center;
  color: #666;
  font-size: 14px;
  margin-top: 20px;
}

/* Confirm Dialog */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal {
  background: white;
  border-radius: 8px;
  padding: 24px;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal h2 {
  margin-bottom: 16px;
  font-size: 18px;
  color: #333;
}

.modal p {
  margin-bottom: 20px;
  color: #666;
  font-size: 14px;
}

.modal-buttons {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.modal-buttons button {
  padding: 10px 16px;
  font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
  .command-buttons {
    grid-template-columns: 1fr;
  }

  .header-content {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }

  .header-right {
    flex-direction: column;
    width: 100%;
  }

  .user-email {
    margin-right: 0;
    margin-bottom: 10px;
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
  }
}
