* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #0f0f0f;
  color: #e0e0e0;
  min-height: 100vh;
}

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

header {
  text-align: center;
  padding: 20px 0;
}

header h1 {
  font-size: 24px;
  color: #fff;
}

/* Panels */
.panel {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

.panel h2 {
  font-size: 16px;
  color: #aaa;
  margin-bottom: 16px;
}

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

.form-group label {
  display: block;
  font-size: 13px;
  color: #999;
  margin-bottom: 4px;
}

.form-group small {
  font-size: 11px;
  color: #666;
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .form-group {
  flex: 1;
}

input[type="text"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  background: #252525;
  border: 1px solid #444;
  border-radius: 8px;
  color: #e0e0e0;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

input:focus, select:focus, textarea:focus {
  border-color: #7c5cfc;
}

textarea {
  resize: vertical;
  font-family: inherit;
}

input[type="range"] {
  width: 100%;
  margin-top: 4px;
}

input[type="checkbox"] {
  margin-right: 6px;
  accent-color: #7c5cfc;
}

/* Buttons */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: #7c5cfc;
  color: #fff;
}

.btn-primary:hover {
  background: #6a4be0;
}

.btn-primary:disabled {
  background: #444;
  cursor: not-allowed;
}

.btn-secondary {
  background: #333;
  color: #ccc;
}

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

.btn-large {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
}

.tab {
  flex: 1;
  padding: 12px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  color: #888;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.tab.active {
  background: #7c5cfc;
  border-color: #7c5cfc;
  color: #fff;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Upload */
.upload-area {
  border: 2px dashed #444;
  border-radius: 12px;
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s;
}

.upload-area:hover {
  border-color: #7c5cfc;
}

.upload-area p {
  color: #666;
}

.preview-img {
  max-width: 100%;
  max-height: 300px;
  margin-top: 12px;
  border-radius: 8px;
}

/* Gallery */
.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.gallery-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s;
}

.gallery-item:hover {
  transform: scale(1.02);
}

.gallery-item img {
  width: 100%;
  display: block;
}

.gallery-item .overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.2s;
}

.gallery-item:hover .overlay {
  opacity: 1;
}

.overlay .btn {
  padding: 6px 10px;
  font-size: 12px;
}

/* Progress */
.progress-bar {
  height: 8px;
  background: #333;
  border-radius: 4px;
  margin: 16px 0 8px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: #7c5cfc;
  border-radius: 4px;
  width: 0%;
  transition: width 0.3s;
}

/* Loading */
.loading {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.loading[hidden] {
  display: none;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #333;
  border-top-color: #7c5cfc;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading p {
  margin-top: 16px;
  color: #aaa;
}

/* Notification */
.notification {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}

.notification[hidden] { display: none; }

.notification-error {
  background: #3a1a1a;
  border: 1px solid #f44;
  color: #f88;
}

.notification-success {
  background: #1a3a1a;
  border: 1px solid #4f4;
  color: #8f8;
}

/* Cost Monitor */
.cost-info {
  display: flex;
  gap: 20px;
}

.cost-item {
  flex: 1;
  text-align: center;
  padding: 12px;
  background: #222;
  border-radius: 8px;
}

.cost-label {
  display: block;
  font-size: 11px;
  color: #888;
  margin-bottom: 4px;
}

.cost-value {
  display: block;
  font-size: 18px;
  font-weight: 600;
  color: #4f4;
}

.cost-value.warning {
  color: #fa4;
}

.cost-value.danger {
  color: #f44;
}

/* Responsive */
@media (max-width: 600px) {
  .form-row {
    flex-direction: column;
    gap: 0;
  }
  .gallery {
    grid-template-columns: repeat(2, 1fr);
  }
}
