/* src/styles.css */
:root {
  --primary: #4a6bff;
  --primary-hover: #3a5bef;
  --dark: #333;
  --light: #f8f9fa;
  --border: #dee2e6;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Open Sans, Helvetica Neue, sans-serif;
}

body {
  background-color: var(--light);
  color: var(--dark);
  line-height: 1.6;
}

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

header {
  text-align: center;
  margin-bottom: 2rem;
}

h1 {
  margin-bottom: .5rem;
  font-size: 2.5rem;
}

h2 {
  margin-bottom: 1.5rem;
}

h3 {
  margin-bottom: 1rem;
}

.subtitle {
  color: #666;
  font-size: 1.1rem;
}

.card {
  background-color: #fff;
  border-radius: 8px;
  margin-bottom: 2rem;
  padding: 2rem;
  box-shadow: 0 4px 6px #0000001a;
}

.config-header {
  display: flex;
  justify-content: space-between;
  align-items:  center;
  margin-bottom: 1.5rem;
}

.config-buttons {
  display: flex;
  gap: .5rem;
}

.config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.5rem;
}

.form-group {
  margin-bottom: 1rem;
}

label {
  display: block;
  margin-bottom: .5rem;
  font-weight: 600;
}

select, input {
  border: 1px solid var(--border);
  border-radius: 4px;
  width: 100%;
  padding: .5rem;
  font-size: 1rem;
}

button {
  background-color: var(--primary);
  color: #fff;
  cursor: pointer;
  border: none;
  border-radius: 4px;
  padding: .75rem 1.5rem;
  transition: background-color .2s;
  font-size: 1rem;
}

button:hover {
  background-color: var(--primary-hover);
}

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

.button-secondary:hover {
  background-color: #5a6268;
}

.upload-area {
  border: 2px dashed var(--border);
  text-align: center;
  cursor: pointer;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  padding: 2rem;
  transition: border-color .2s;
}

.upload-area:hover {
  border-color: var(--primary);
}

.upload-icon {
  color: var(--primary);
  margin-bottom: 1rem;
  font-size: 2rem;
}

.image-preview-header {
  display: flex;
  justify-content: space-between;
  align-items:  center;
  margin-bottom: 1rem;
}

.image-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.image-item {
  position: relative;
  border: 1px solid var(--border);
  overflow: hidden;
  border-radius: 4px;
  height: 100px;
}

.image-item img {
  object-fit: contain;
  width: 100%;
  height: 100%;
}

.image-item-info {
  position: absolute;
  text-align: center;
  background-color: #fffc;
  padding: 2px 4px;
  font-size: 10px;
  bottom: 0;
  left: 0;
  right: 0;
}

.remove-image {
  position: absolute;
  display: flex;
  cursor: pointer;
  color: #dc3545;
  background-color: #fffc;
  border: none;
  border-radius: 50%;
  justify-content: center;
  align-items:  center;
  width: 24px;
  height: 24px;
  font-size: 14px;
  top: 5px;
  right: 5px;
}

.result-container {
  display: none;
  margin-top: 2rem;
}

.sprite-preview {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
  max-width: 100%;
  margin-bottom: 1.5rem;
}

.sprite-preview-image {
  max-width: 100%;
}

.code-output {
  border: 1px solid var(--border);
  overflow: auto;
  white-space: pre;
  background-color: #f8f9fa;
  border-radius: 4px;
  max-height: 400px;
  padding: 1rem;
  font-family: Courier New, Courier, monospace;
}

.button-row {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
}

.loader {
  display: none;
  text-align: center;
  margin: 1rem 0;
}

.spinner {
  border: 4px solid #0000001a;
  border-left: 4px solid var(--primary);
  animation: spin 1s linear infinite;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  margin: 0 auto;
}

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

  100% {
    transform: rotate(360deg);
  }
}

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

  .config-buttons {
    width: 100%;
    margin-top: 1rem;
  }

  .config-grid {
    grid-template-columns: 1fr;
  }

  .button-row {
    flex-direction: column;
  }

  button {
    width: 100%;
  }
}
