/* Blog Writer - Global Styles */
/* Following saas-designer.md principles: system fonts, no gradients, solid colors */

:root {
  --color-bg: #ffffff;
  --color-bg-secondary: #f5f5f5;
  --color-text: #1a1a1a;
  --color-text-secondary: #666666;
  --color-border: #e0e0e0;
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-success: #16a34a;
  --color-error: #dc2626;
  --color-warning: #ca8a04;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, monospace;
}

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

html {
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
}

/* Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.page {
  padding: 2rem 0;
}

/* Header */
header {
  border-bottom: 1px solid var(--color-border);
  padding: 1rem 0;
  background: var(--color-bg);
  position: sticky;
  top: 0;
  z-index: 100;
}

header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text);
  text-decoration: none;
}

nav {
  display: flex;
  gap: 1.5rem;
}

nav a {
  color: var(--color-text-secondary);
  text-decoration: none;
  font-size: 0.9375rem;
}

nav a:hover,
nav a.active {
  color: var(--color-text);
}

/* Typography */
h1 {
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
}

h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

p {
  margin-bottom: 1rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  font-size: 0.9375rem;
  font-weight: 500;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s;
}

.btn-primary {
  background: var(--color-primary);
  color: white;
}

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

.btn-secondary {
  background: var(--color-bg);
  color: var(--color-text);
  border-color: var(--color-border);
}

.btn-secondary:hover {
  background: var(--color-bg-secondary);
}

.btn-danger {
  background: var(--color-error);
  color: white;
}

.btn-danger:hover {
  background: #b91c1c;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Forms */
label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  font-family: var(--font-sans);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-bg);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea {
  min-height: 200px;
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.6;
}

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

.form-hint {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  margin-top: 0.25rem;
}

/* Cards */
.card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1.5rem;
}

.card + .card {
  margin-top: 1rem;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 1.5rem;
}

.tab {
  padding: 0.75rem 1.25rem;
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.tab:hover {
  color: var(--color-text);
}

.tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.tab-content {
  display: none;
}

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

/* Lists */
.list {
  list-style: none;
}

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  margin-bottom: 0.5rem;
}

.list-item:hover {
  background: var(--color-bg-secondary);
}

.list-item-title {
  font-weight: 500;
}

.list-item-meta {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
}

.list-item-actions {
  display: flex;
  gap: 0.5rem;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--color-text-secondary);
}

.empty-state p {
  margin-bottom: 1.5rem;
}

/* Status badges */
.badge {
  display: inline-flex;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 4px;
}

.badge-pending {
  background: #fef3c7;
  color: #92400e;
}

.badge-processing {
  background: #dbeafe;
  color: #1e40af;
}

.badge-waiting {
  background: #fce7f3;
  color: #9d174d;
}

.badge-complete {
  background: #dcfce7;
  color: #166534;
}

/* Stage progress */
.stage-progress {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.stage-step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--color-bg-secondary);
  border-radius: 6px;
  font-size: 0.8125rem;
  white-space: nowrap;
}

.stage-step.active {
  background: var(--color-primary);
  color: white;
}

.stage-step.complete {
  background: var(--color-success);
  color: white;
}

.stage-step.waiting {
  background: #fce7f3;
  color: #9d174d;
}

/* Stage output */
.stage-output {
  margin-bottom: 1.5rem;
}

.stage-output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: 6px 6px 0 0;
  cursor: pointer;
}

.stage-output-header h3 {
  margin: 0;
  font-size: 0.9375rem;
}

.stage-output-content {
  border: 1px solid var(--color-border);
  border-top: none;
  border-radius: 0 0 6px 6px;
  padding: 1rem;
  background: var(--color-bg);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.6;
  white-space: pre-wrap;
  max-height: 400px;
  overflow-y: auto;
}

.stage-output.collapsed .stage-output-content {
  display: none;
}

/* Loading */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 2rem;
  color: var(--color-text-secondary);
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Messages */
.message {
  padding: 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
}

.message-success {
  background: #dcfce7;
  color: #166534;
}

.message-error {
  background: #fee2e2;
  color: #991b1b;
}

.message-info {
  background: #dbeafe;
  color: #1e40af;
}

/* Grid */
.grid {
  display: grid;
  gap: 1rem;
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

@media (max-width: 768px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

/* Utilities */
.flex {
  display: flex;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.gap-1 {
  gap: 0.5rem;
}

.gap-2 {
  gap: 1rem;
}

.mt-1 {
  margin-top: 0.5rem;
}

.mt-2 {
  margin-top: 1rem;
}

.mt-3 {
  margin-top: 1.5rem;
}

.mb-2 {
  margin-bottom: 1rem;
}

.text-secondary {
  color: var(--color-text-secondary);
}

.text-sm {
  font-size: 0.875rem;
}

.hidden {
  display: none !important;
}
