/* Cartoon Sketch Generator */

.csg-container {
  max-width: 620px;
  margin: 1.5em auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
}

/* ─── Toolbar ─────────────────────────────────────── */

.csg-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.csg-prompt {
  flex: 1;
  padding: 11px 14px;
  font-size: 14px;
  font-family: inherit;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  color: #111;
  outline: none;
  transition: border-color 0.15s;
}

.csg-prompt:focus {
  border-color: #6b7280;
}

.csg-prompt::placeholder {
  color: #9ca3af;
}

.csg-btn {
  padding: 11px 22px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: 8px;
  background: #111;
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, opacity 0.15s;
}

.csg-btn:hover {
  background: #333;
}

.csg-btn:disabled {
  opacity: 0.5;
  cursor: wait;
}

.csg-btn-sm {
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 500;
  background: #fff;
  color: #374151;
  border: 1.5px solid #d1d5db;
}

.csg-btn-sm:hover {
  border-color: #9ca3af;
  background: #f9fafb;
  color: #111;
}

/* ─── Style bar ───────────────────────────────────── */

.csg-style-bar {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.csg-style-btn {
  padding: 5px 12px;
  font-size: 11.5px;
  font-family: inherit;
  font-weight: 500;
  border: 1.5px solid #e5e7eb;
  border-radius: 20px;
  background: #fff;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.csg-style-btn:hover {
  border-color: #9ca3af;
  color: #374151;
}

.csg-style-btn.active {
  border-color: #111;
  background: #111;
  color: #fff;
}

/* ─── Output area ─────────────────────────────────── */

.csg-output {
  position: relative;
  min-height: 120px;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.csg-image-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}

.csg-image {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
}

/* ─── Status / Loading ────────────────────────────── */

.csg-status {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.9);
  z-index: 10;
}

.csg-status-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: #6b7280;
}

.csg-spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid #e5e7eb;
  border-top-color: #111;
  border-radius: 50%;
  animation: csg-spin 0.65s linear infinite;
}

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

/* ─── Cooldown bar ────────────────────────────────── */

.csg-cooldown-bar {
  height: 3px;
  background: #f3f4f6;
  border-radius: 2px;
  overflow: hidden;
  margin: 0;
}

.csg-cooldown-fill {
  height: 100%;
  background: #111;
  border-radius: 2px;
  width: 100%;
}

/* ─── Error ───────────────────────────────────────── */

.csg-error {
  padding: 12px 16px;
  font-size: 13px;
  color: #b91c1c;
  background: #fef2f2;
  border-top: 1px solid #fecaca;
}

/* ─── Actions bar ─────────────────────────────────── */

.csg-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.csg-prompt-preview {
  font-size: 11px;
  color: #9ca3af;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: help;
}

/* ─── Responsive ──────────────────────────────────── */

@media (max-width: 520px) {
  .csg-toolbar {
    flex-direction: column;
  }
  .csg-btn {
    width: 100%;
    text-align: center;
  }
  .csg-style-bar {
    justify-content: center;
  }
  .csg-actions {
    flex-direction: column;
    align-items: flex-start;
  }
  .csg-prompt-preview {
    width: 100%;
  }
}
