/* Reset and base styles */
* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    Cantarell, "Helvetica Neue", sans-serif;
  background: #1a1a1a;
  color: #e0e0e0;
  line-height: 1.6;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Upload Section */
#upload-section {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
  background: radial-gradient(
    circle at 60% 60%,
    rgba(31, 24, 40, 1) 20%,
    rgba(0, 0, 0, 1) 100%
  );
}

.container {
  max-width: 900px;
  width: 100%;
  background: #2a2a2a;
  border-radius: 12px;
  padding: 40px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

h1 {
  margin: 0 0 10px 0;
  font-size: 2.5rem;
  text-align: center;
  background: #c92c61;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  text-align: center;
  color: #999;
  margin: 0 0 40px 0;
}

.editor-section-divider {
  border-bottom: 2px solid #444;
  text-align: CENTER;
  height: 13px;
  margin-bottom: 30px;
  margin-top: 30px;
}

.editor-section-divider span {
  background-color: #2a2a2a;
  padding: 0 10px;
}

.editor-section h2 {
  font-size: 1.2rem;
  margin: 0 0 20px 0;
  color: #e0e0e0;
  text-align: center;
}

/* Grid Editor */
.grid-editor-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.grid-editor {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  background: #444;
  padding: 2px;
  border-radius: 4px;
  width: fit-content;
}

.grid-cell {
  width: 40px;
  height: 40px;
  background: #1a1a1a;
  border: 1px solid #333;
  cursor: pointer;
  transition: background 0.1s;
}

.grid-cell:hover {
  border-color: #c92c61;
}

.grid-cell.active {
  background: #c92c61;
}

.grid-controls {
  display: flex;
  gap: 10px;
}

.generate-btn {
  width: 100%;
  padding: 12px;
  background: #c92c61;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    transform 0.2s,
    opacity 0.2s;
  max-width: 340px;
}

#manual-result {
  width: 100%;
  margin-top: 10px;
}

/* File Drop Zones */
.file-inputs {
  display: flex;
  flex-direction: column;
}

.file-drop-zone {
  background: #1a1a1a;
  border: 2px dashed #444;
  border-radius: 8px;
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.file-drop-zone:hover {
  border-color: #c92c61;
  background: #222;
}

.file-drop-zone.drag-over {
  border-color: #c92c61;
  background: #2a2a4a;
  transform: scale(1.02);
}

.file-drop-zone.has-file {
  border-color: #4caf50;
  background: #1a2a1a;
}

.drop-label {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 10px;
}

.file-hint {
  font-size: 0.85rem;
  color: #888;
}

.browse-btn {
  background: #444;
  color: #fff;
  border: none;
  padding: 8px 20px;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 10px;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.browse-btn:hover {
  background: #555;
}

.secondary-btn {
  padding: 10px 20px;
  background: #444;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
  transition: background 0.2s;
  margin-left: 10px;
}

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

/* Results Section */
#results-container {
  margin-top: 40px;
  padding-top: 40px;
  border-top: 2px solid #444;
}

#results-container h2 {
  margin: 0 0 20px 0;
  color: #e0e0e0;
  font-size: 1.5rem;
}

#results-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.result-item {
  background: #1a1a1a;
  border: 1px solid #444;
  border-radius: 8px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.result-image {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border: 2px solid #c92c61;
  border-radius: 4px;
  background: white;
}

.result-content {
  flex: 1;
  min-width: 0;
}

.result-filename {
  font-weight: 600;
  color: #e0e0e0;
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.result-hex-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.result-hex {
  font-family: "Courier New", monospace;
  background: #2a2a2a;
  padding: 4px 8px;
  border-radius: 4px;
  color: #ffffff;
  font-size: 1rem;
  flex: 1;
  word-break: break-all;
}

.copy-btn {
  padding: 8px 16px;
  background: #c92c61;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s;
  white-space: nowrap;
}

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

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

.copy-btn.copied {
  background: #4caf50;
}

.result-item-error {
  border-color: #f44336;
  background: #2a1a1a;
}

.result-error-icon {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  border: 2px solid #f44336;
  border-radius: 4px;
  background: #1a1a1a;
}

.result-error {
  color: #f44336;
  font-size: 0.9rem;
  margin-top: 4px;
}

@media (max-width: 768px) {
  .result-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .result-hex-container {
    flex-direction: column;
    width: 100%;
  }

  .copy-btn {
    width: 100%;
  }
}

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

  h1 {
    font-size: 2rem;
  }

  .editor-layout {
    grid-template-columns: 1fr;
  }

  .grid-cell {
    width: 30px;
    height: 30px;
  }
}
