/* Styling for the ASCII Portrait Generator */
body {
  font-family: 'Courier New', 'Monaco', 'Consolas', monospace;
  margin: 0;
  padding: 0;
  background-color: #fafafa;
  background-image: radial-gradient(circle, #e0e0e0 1px, transparent 1px);
  background-size: 20px 20px;
  color: #1a1a1a;
  line-height: 1.6;
}

header {
  background-color: transparent;
  color: #1a1a1a;
  padding: 3rem 1rem 2rem;
  text-align: center;
}

header h1 {
  margin: 0 0 1rem;
  font-size: 2rem;
  font-weight: bold;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-family: 'Courier New', 'Monaco', 'Consolas', monospace;
}

header p {
  margin: 0;
  font-size: 0.9rem;
  color: #666;
  max-width: 600px;
  margin: 0 auto;
  font-family: 'Georgia', 'Times New Roman', serif;
  line-height: 1.5;
}

main {
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.file-input-section {
  margin-bottom: 2rem;
}

.file-input-label {
  display: block;
  cursor: pointer;
  background-color: #ffffff;
  border: 2px dashed #ddd;
  border-radius: 0;
  padding: 2rem;
  text-align: center;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.file-input-label:hover {
  border-color: #dc2626;
  background-color: #fefefe;
}

.file-input-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.file-input-icon {
  font-size: 2rem;
}

.file-input-text {
  text-align: left;
}

.file-input-title {
  font-size: 1rem;
  font-weight: bold;
  color: #1a1a1a;
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.file-input-subtitle {
  font-size: 0.8rem;
  color: #666;
  font-family: 'Georgia', 'Times New Roman', serif;
}

.file-input-label input[type="file"] {
  display: none;
}

.controls label {
  display: flex;
  flex-direction: column;
  font-size: 0.8rem;
  color: #666;
  margin-bottom: 0.5rem;
}

.controls input[type="file"] {
  font-family: inherit;
  font-size: 0.8rem;
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  background-color: #fafafa;
}

.size-controls {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.size-buttons {
  display: flex;
  gap: 0.5rem;
}

.size-btn {
  background-color: #f8f8f8;
  border: 1px solid #ddd;
  padding: 0.6rem 1.2rem;
  border-radius: 0;
  cursor: pointer;
  font-size: 0.8rem;
  font-family: inherit;
  transition: all 0.2s;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.size-btn:hover {
  background-color: #f0f0f0;
  border-color: #dc2626;
}

.size-btn.active {
  background-color: #dc2626;
  color: white;
  border-color: #dc2626;
}

#widthDisplay {
  font-size: 0.7rem;
  color: #999;
  font-style: italic;
}

.preview-container {
  background-color: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 0;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #e0e0e0;
  background-color: #ffffff;
}

.preview-header .size-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.preview-header .size-controls label {
  font-size: 0.8rem;
  color: #666;
  margin: 0;
}

.preview-header .size-buttons {
  display: flex;
  gap: 0.5rem;
}

.preview-header .action-buttons {
  position: static;
  display: flex;
  gap: 0.5rem;
}

/* Hidden canvas for processing the image */
#hiddenCanvas {
  display: none;
}

/* ASCII container */
.ascii-container {
  padding: 1.5rem;
  overflow: auto;
}

.action-btn {
  background-color: #dc2626;
  color: white;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 0;
  cursor: pointer;
  font-size: 0.8rem;
  font-family: inherit;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.action-btn:hover {
  background-color: #b91c1c;
}

.action-btn:active {
  background-color: #991b1b;
}

.copy-btn.copied {
  background-color: #059669;
}

.download-btn {
  background-color: #6b7280;
}

.download-btn:hover {
  background-color: #4b5563;
}

.download-btn.hidden {
  display: none;
}

/* ASCII output area */
#asciiOutput {
  font-family: 'Courier New', 'Monaco', 'Consolas', monospace;
  font-size: 6px;
  line-height: 5px;
  white-space: pre;
  margin: 0;
  overflow-wrap: normal;
  overflow-x: auto;
  letter-spacing: -0.5px;
  font-weight: normal;
  color: #2c2c2c;
}

/* Responsive Design */
@media (max-width: 768px) {
  main {
    max-width: 100%;
    margin: 1rem auto;
    padding: 0 0.5rem;
  }

  header {
    padding: 2rem 0.5rem 1rem;
  }

  header h1 {
    font-size: 1.5rem;
    letter-spacing: 1px;
  }

  header p {
    font-size: 0.8rem;
    padding: 0 1rem;
  }

  .file-input-section {
    margin-bottom: 1.5rem;
  }

  .file-input-label {
    padding: 1.5rem 1rem;
  }

  .file-input-content {
    flex-direction: column;
    gap: 0.5rem;
  }

  .file-input-text {
    text-align: center;
  }

  .file-input-title {
    font-size: 0.9rem;
  }

  .file-input-subtitle {
    font-size: 0.7rem;
  }

  .preview-header {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    align-items: stretch;
  }

  .preview-header .size-controls {
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .preview-header .action-buttons {
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .size-btn,
  .action-btn {
    padding: 0.5rem 0.8rem;
    font-size: 0.7rem;
    min-width: auto;
    flex: 0 0 auto;
  }

  .action-btn {
    white-space: nowrap;
  }

  .ascii-container {
    padding: 1rem;
  }

  #asciiOutput {
    font-size: 4px;
    line-height: 3px;
    letter-spacing: -0.3px;
  }
}

@media (max-width: 480px) {
  header h1 {
    font-size: 1.2rem;
  }

  header p {
    font-size: 0.75rem;
  }

  .file-input-label {
    padding: 1rem 0.5rem;
  }

  .file-input-icon {
    font-size: 1.5rem;
  }

  .preview-header {
    padding: 0.75rem;
  }

  .size-btn,
  .action-btn {
    padding: 0.4rem 0.6rem;
    font-size: 0.65rem;
    min-width: auto;
    flex: 0 0 auto;
  }

  .action-btn {
    white-space: nowrap;
  }

  .ascii-container {
    padding: 0.75rem;
  }

  #asciiOutput {
    font-size: 3px;
    line-height: 2.5px;
  }
}