/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  line-height: 1.6;
  color: #333;
  background: #f5f5f5;
}

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

/* Header */
header {
  background: #2c3e50;
  color: white;
  padding: 30px;
  border-radius: 8px;
  margin-bottom: 30px;
}

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

.subtitle {
  color: #ecf0f1;
  font-size: 1.1em;
  margin-bottom: 20px;
}

/* Navigation */
nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
}

nav button {
  padding: 10px 20px;
  border: 2px solid #3498db;
  background: transparent;
  color: #ecf0f1;
  border-radius: 5px;
  font-size: 0.95em;
  cursor: pointer;
  transition: all 0.3s;
  font-weight: 500;
}

nav button:hover {
  background: #3498db;
  color: white;
}

nav button.active {
  background: #3498db;
  color: white;
}

/* Card Sections */
.card {
  background: white;
  padding: 30px;
  margin-bottom: 30px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.card h2 {
  color: #2c3e50;
  margin-bottom: 20px;
  font-size: 1.5em;
  border-bottom: 2px solid #3498db;
  padding-bottom: 10px;
}

.hint {
  color: #7f8c8d;
  font-size: 0.9em;
  margin-bottom: 15px;
}

/* Upload Area */
.upload-area {
  border: 2px dashed #3498db;
  border-radius: 8px;
  padding: 40px;
  text-align: center;
  transition: all 0.3s;
  cursor: pointer;
}

.upload-area:hover {
  border-color: #2980b9;
  background: #ecf0f1;
}

.upload-area.dragover {
  border-color: #27ae60;
  background: #d5f4e6;
}

.upload-icon {
  font-size: 3em;
  margin-bottom: 15px;
}

.upload-area p {
  margin: 10px 0;
}

/* Uploaded Files */
.uploaded-files {
  margin-top: 30px;
}

.uploaded-files h3 {
  color: #34495e;
  margin-bottom: 15px;
}

#filesList {
  max-height: 300px;
  overflow-y: auto;
}

.file-group {
  background: #ecf0f1;
  padding: 15px;
  margin-bottom: 10px;
  border-radius: 5px;
  border-left: 4px solid #3498db;
}

.file-group.complete {
  border-left-color: #27ae60;
}

.file-group.incomplete {
  border-left-color: #e74c3c;
}

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

.file-group-name {
  font-weight: bold;
  color: #2c3e50;
}

.file-list {
  list-style: none;
  margin: 10px 0;
}

.file-list li {
  padding: 5px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.file-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 0.85em;
  font-weight: bold;
}

.file-badge.tif {
  background: #3498db;
  color: white;
}

.file-badge.xml {
  background: #e67e22;
  color: white;
}

.file-badge.tip {
  background: #9b59b6;
  color: white;
}

.file-badge.pdf {
  background: #e74c3c;
  color: white;
}

/* Layer Source Badge */
.layer-source {
  font-size: 0.8em;
  padding: 4px 8px;
  border-radius: 3px;
  background: #2ecc71;
  color: white;
  font-weight: 500;
}

.layer-item[data-source="external"] .layer-source {
  background: #9b59b6;
  color: white;
}

/* Layers List */
.layers-list {
  min-height: 100px;
}

.layer-item {
  background: #ecf0f1;
  padding: 15px;
  margin-bottom: 10px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  gap: 15px;
  cursor: move;
  transition: all 0.2s;
}

.layer-item:hover {
  background: #d5dbdb;
}

.layer-item.dragging {
  opacity: 0.5;
}

.drag-handle {
  font-size: 1.5em;
  color: #95a5a6;
  cursor: grab;
}

.drag-handle:active {
  cursor: grabbing;
}

.layer-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.layer-visible-checkbox {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.layer-id {
  font-family: 'Courier New', monospace;
  color: #7f8c8d;
  font-size: 0.9em;
}

.layer-name-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #bdc3c7;
  border-radius: 4px;
  font-size: 1em;
  transition: border-color 0.2s;
}

.layer-name-input:focus {
  outline: none;
  border-color: #3498db;
}

.layer-checkbox {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.layer-overlay-label {
  font-size: 0.85em;
  color: #7f8c8d;
  margin-left: 8px;
  margin-right: 4px;
}

.layer-overlay-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  margin-right: 8px;
}

.layer-name {
  flex: 1;
  font-size: 1.1em;
}

.layer-name input {
  width: 100%;
  padding: 5px 10px;
  border: 1px solid #bdc3c7;
  border-radius: 4px;
  font-size: 1em;
}

.layer-name input:focus {
  outline: none;
  border-color: #3498db;
}

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

.form-group label {
  display: block;
  margin-bottom: 5px;
  color: #2c3e50;
  font-weight: 500;
}

.form-group input {
  width: 100%;
  padding: 10px;
  border: 1px solid #bdc3c7;
  border-radius: 4px;
  font-size: 1em;
}

.form-group input:focus {
  outline: none;
  border-color: #3498db;
}

/* Buttons */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 5px;
  font-size: 1em;
  cursor: pointer;
  transition: all 0.3s;
  font-weight: 500;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
  background: #2980b9;
}

.btn-success {
  background: #27ae60;
  color: white;
}

.btn-success:hover:not(:disabled) {
  background: #229954;
}

.btn-danger {
  background: #e74c3c;
  color: white;
  padding: 6px 12px;
  font-size: 0.9em;
}

.btn-danger:hover:not(:disabled) {
  background: #c0392b;
}

/* Deployment Status */
.deploy-status {
  margin-top: 30px;
  padding: 20px;
  background: #ecf0f1;
  border-radius: 5px;
}

.status-message {
  font-size: 1.1em;
  margin-bottom: 15px;
  color: #2c3e50;
  font-weight: 500;
}

.progress-bar {
  width: 100%;
  height: 30px;
  background: #bdc3c7;
  border-radius: 15px;
  overflow: hidden;
  margin-bottom: 20px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3498db, #2ecc71);
  width: 0%;
  transition: width 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
}

.deploy-logs {
  max-height: 300px;
  overflow-y: auto;
  background: #2c3e50;
  color: #ecf0f1;
  padding: 15px;
  border-radius: 5px;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
  line-height: 1.5;
}

.log-entry {
  margin: 5px 0;
  padding: 3px 0;
}

.log-entry.log-info {
  color: #ecf0f1;
}

.log-entry.log-error {
  color: #e74c3c;
  font-weight: bold;
}

.log-entry.log-success {
  color: #2ecc71;
  font-weight: bold;
}

.deploy-logs .log-line {
  margin: 5px 0;
}

.deploy-logs .log-error {
  color: #e74c3c;
}

.deploy-logs .log-success {
  color: #2ecc71;
}

/* Group Styles */
.btn-add-group {
  margin-bottom: 1rem;
  padding: 0.5rem 1rem;
  background: #28a745;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.95em;
  transition: background 0.2s;
}

.btn-add-group:hover {
  background: #218838;
}

.group-container {
  margin-bottom: 1rem;
  border: 2px solid #007bff;
  border-radius: 6px;
  background: #f8f9fa;
}

.group-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: #e7f1ff;
  border-bottom: 1px solid #007bff;
  cursor: default;
}

.group-header.dragging {
  opacity: 0.5;
}

.group-handle {
  cursor: grab;
  color: #007bff;
  font-size: 1.2rem;
  font-weight: bold;
  user-select: none;
}

.group-handle:active {
  cursor: grabbing;
}

.group-toggle {
  cursor: pointer;
  user-select: none;
  font-size: 0.9rem;
  color: #007bff;
  width: 20px;
  text-align: center;
  font-weight: bold;
}

.group-name-input {
  flex: 1;
  padding: 0.4rem 0.6rem;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-weight: 600;
  color: #007bff;
  background: white;
  font-size: 0.95em;
}

.group-name-input:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 0.2rem rgba(0,123,255,0.25);
}

.btn-delete-group {
  background: #dc3545;
  color: white;
  border: none;
  border-radius: 4px;
  width: 28px;
  height: 28px;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.2s;
}

.btn-delete-group:hover {
  background: #c82333;
}

.group-layers {
  padding: 0.5rem;
  min-height: 40px;
  background: white;
}

.group-layers .layer-item {
  margin-left: 1.5rem;
  border-left: 3px solid #007bff;
  background: white;
}

.layer-item[data-group-id] {
  background: white;
}

.layer-item.dragging {
  opacity: 0.5;
}

.group-container.dragging {
  opacity: 0.5;
}

/* Drop indicator styles */
.drop-indicator {
  height: 4px;
  background: #3498db;
  border-radius: 2px;
  margin: 4px 0;
  position: relative;
  animation: pulse 0.5s ease-in-out infinite;
}

.drop-indicator::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  background: #3498db;
  border-radius: 50%;
}

.drop-indicator::after {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  background: #3498db;
  border-radius: 50%;
}

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

.drop-target-active {
  background: #e3f2fd !important;
  border: 2px dashed #3498db !important;
}

/* Footer */
footer {
  text-align: center;
  padding: 20px;
  color: #7f8c8d;
}

footer a {
  color: #3498db;
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* Utility Classes */
.text-success {
  color: #27ae60;
}

.text-error {
  color: #e74c3c;
}

.text-warning {
  color: #f39c12;
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 10px;
  }

  header {
    padding: 20px;
  }

  .card {
    padding: 20px;
  }
}
