/* ==========================================================================
   Reset & Base Styles
   ========================================================================== */

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  margin: 0;
  padding: 2rem;
  background: #f5f5f5;
  color: #333;
}

/* ==========================================================================
   Layout Components
   ========================================================================== */

.container {
  max-width: 1200px;
  margin: 0 auto;
  background: white;
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

h1 {
  margin: 0 0 2rem 0;
  color: #111;
  font-size: 2rem;
}

.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: #f8f9fa;
  border-radius: 8px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.lock-checkbox {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: #666;
}

.lock-checkbox input[type="checkbox"] {
  width: auto;
  margin: 0;
  cursor: pointer;
}

label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #666;
}

input, select {
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
}

input:focus, select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

/* ==========================================================================
   Form Elements & Buttons
   ========================================================================== */

button {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-primary {
  background: #e0e7ff;
  color: #3730a3;
  border: 1px solid #c7d2fe;
}

.btn-primary:hover {
  background: #c7d2fe;
  color: #312e81;
  border-color: #a5b4fc;
}

.btn-secondary {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #e5e7eb;
}

.btn-secondary:hover {
  background: #e5e7eb;
  border-color: #d1d5db;
}

/* Special button styles */
.btn-shuffle {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
  font-weight: 600;
  transform: scale(1.05);
}

.btn-shuffle:hover {
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
  color: white;
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5);
  transform: scale(1.08);
}

.btn-lock {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.btn-lock:hover {
  background: #fde68a;
  color: #78350f;
  border-color: #fcd34d;
}

.btn-unlock {
  background: #d1fae5;
  color: #064e3b;
  border: 1px solid #a7f3d0;
}

.btn-unlock:hover {
  background: #a7f3d0;
  color: #065f46;
  border-color: #6ee7b7;
}

.btn-download {
  background: #dbeafe;
  color: #1e3a8a;
  border: 1px solid #bfdbfe;
}

.btn-download:hover {
  background: #bfdbfe;
  color: #1e40af;
  border-color: #93c5fd;
}

.btn-success {
  background: #10b981;
  color: white;
}

.btn-success:hover {
  background: #059669;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button:disabled:hover {
  /* Keep the same background as non-hover state when disabled */
  background: inherit;
  border-color: inherit;
}

/* ==========================================================================
   Preview Components
   ========================================================================== */

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.preview-card {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
}

.preview-card h3 {
  margin: 0 0 1rem 0;
  font-size: 1.125rem;
  color: #444;
}

.avatar-container {
  display: inline-block;
  position: relative;
  margin-bottom: 1rem;
}

.avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.banner {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  margin-bottom: 1rem;
  display: block;
}

.style-options {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.style-option {
  padding: 0.5rem 1rem;
  border: 2px solid #e5e7eb;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  background: white;
}

.style-option:hover {
  border-color: #3b82f6;
}

.style-option.active {
  border-color: #3b82f6;
  background: #eff6ff;
  color: #3b82f6;
}

/* ==========================================================================
   Color Palette Components
   ========================================================================== */

.color-palette {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s;
}

.color-swatch:hover {
  transform: scale(1.1);
}

.color-swatch.active {
  border-color: #333;
}

/* ==========================================================================
   Action Buttons
   ========================================================================== */

.action-buttons {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: #f8f9fa;
  border-radius: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.action-buttons button {
  min-width: 120px;
}

.info {
  margin-top: 2rem;
  padding: 1rem;
  background: #eff6ff;
  border-radius: 8px;
  font-size: 0.875rem;
  color: #1e40af;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
  body {
    padding: 1rem;
  }
  
  .container {
    padding: 1.5rem;
  }
  
  h1 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
  }
  
  .controls {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .preview-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .banner {
    width: 100%;
    height: auto;
  }
  
  .action-buttons {
    padding: 1rem;
    gap: 0.75rem;
  }
  
  .action-buttons button {
    min-width: 100px;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
  }
  
  /* Stack control groups vertically on mobile */
  .control-group {
    flex-direction: column;
    align-items: stretch;
  }
  
  .control-group label {
    width: 100%;
    margin-bottom: 0.25rem;
  }
  
  .control-group input,
  .control-group select {
    width: 100%;
  }
  
  .lock-checkbox {
    align-self: flex-start;
  }
  
  /* Hash control buttons layout */
  .control-group > div[style*="display: flex"] {
    width: 100%;
  }
  
  .control-group > div[style*="display: flex"] > div[style*="display: flex"] {
    flex: 1;
    justify-content: flex-end;
  }
  
  /* Download format selectors */
  .preview-card > div[style*="display: flex"] {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .preview-card select {
    width: 100%;
  }
  
  .preview-card button {
    width: 100%;
  }
}

@media (max-width: 480px) {
  body {
    padding: 0.5rem;
    font-size: 14px;
  }
  
  .container {
    padding: 1rem;
    border-radius: 8px;
  }
  
  h1 {
    font-size: 1.25rem;
  }
  
  .controls {
    padding: 1rem;
    gap: 1rem;
  }
  
  .control-group label {
    font-size: 0.875rem;
  }
  
  /* Smaller hash buttons on mobile */
  #randomHashBtn,
  #useUsernameBtn {
    font-size: 0.65rem !important;
    padding: 0.2rem 0.3rem !important;
    white-space: nowrap;
  }
  
  /* Color palette adjustments */
  .color-palette {
    gap: 0.25rem;
    flex-wrap: wrap;
  }
  
  .color-swatch {
    width: 28px;
    height: 28px;
  }
  
  /* Avatar adjustments */
  .avatar {
    width: 100px;
    height: 100px;
  }
  
  /* Action buttons */
  .action-buttons {
    flex-direction: column;
    padding: 0.75rem;
  }
  
  .action-buttons button {
    width: 100%;
    font-size: 0.8rem;
    padding: 0.6rem;
  }
  
  /* Preview cards */
  .preview-card {
    padding: 1rem;
  }
  
  .preview-card h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
  }
  
  /* Lock checkbox smaller text */
  .lock-checkbox label {
    font-size: 0.75rem;
  }
  
  /* Dropdown selects */
  select {
    font-size: 0.875rem;
  }
}