/* Kindle Factory - Clean Minimal UI */
:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #d97706;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #111827;
  --radius: 8px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans JP', sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  line-height: 1.6;
}

/* Navbar */
.navbar {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  padding: 0.75rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand { font-weight: 700; font-size: 1.1rem; color: var(--gray-900); }
.nav-links { display: flex; align-items: center; gap: 1.5rem; }
.nav-links a { color: var(--gray-500); text-decoration: none; font-size: 0.9rem; }
.nav-links a:hover { color: var(--primary); }
.nav-user { color: var(--gray-500); font-size: 0.85rem; }

/* Container */
.container { max-width: 1100px; margin: 0 auto; padding: 2rem; }

/* Typography */
h1 { font-size: 1.75rem; margin-bottom: 1rem; }
h2 { font-size: 1.25rem; margin: 2rem 0 1rem; color: var(--gray-700); }
.subtitle { color: var(--gray-500); margin-bottom: 1.5rem; }
.text-muted { color: var(--gray-500); font-size: 0.9rem; }
.text-center { text-align: center; }

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.5rem 1.25rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  background: white;
  color: var(--gray-700);
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}
.btn:hover { background: var(--gray-100); }
.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--gray-100); }
.btn-sm { padding: 0.3rem 0.75rem; font-size: 0.8rem; }
.btn-lg { padding: 0.75rem 2rem; font-size: 1.1rem; }
.btn-block { display: block; width: 100%; text-align: center; }
.btn-gem { background: linear-gradient(90deg,#4f46e5 0%,#9333ea 100%); color: white; border-color: #4f46e5; font-weight: 500; cursor: pointer; }
.btn-gem:hover { background: linear-gradient(90deg,#4338ca 0%,#7e22ce 100%); color: white; border-color: #4338ca; }

/* Forms */
label { display: block; font-weight: 500; margin-bottom: 0.3rem; font-size: 0.9rem; color: var(--gray-700); }
input, select, textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.95rem;
  margin-bottom: 1rem;
}
input:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
small { display: block; color: var(--gray-500); font-size: 0.8rem; margin-top: -0.75rem; margin-bottom: 0.75rem; }

.form-card { background: white; padding: 2rem; border-radius: var(--radius); border: 1px solid var(--gray-200); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.5rem; }
.form-actions { margin-top: 1.5rem; display: flex; gap: 1rem; justify-content: flex-end; }

.inline-form { display: flex; gap: 0.5rem; align-items: flex-end; margin-bottom: 0.75rem; }
.inline-form input, .inline-form select { margin-bottom: 0; }

/* Tables */
.table { width: 100%; border-collapse: collapse; background: white; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--gray-200); }
.table th { background: var(--gray-50); padding: 0.75rem 1rem; text-align: left; font-size: 0.85rem; color: var(--gray-500); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.table td { padding: 0.75rem 1rem; border-top: 1px solid var(--gray-100); font-size: 0.9rem; }
.table tr:hover td { background: var(--gray-50); }

/* Badges */
.badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 4px; font-size: 0.75rem; font-weight: 500; background: var(--gray-100); color: var(--gray-700); }
.badge-speaking { background: #dbeafe; color: #1e40af; }
.badge-publishing { background: #fef3c7; color: #92400e; }
.badge-business { background: #d1fae5; color: #065f46; }
.badge-lifestyle { background: #fce7f3; color: #9d174d; }
.badge-tech { background: #e0e7ff; color: #3730a3; }
.badge-draft { background: var(--gray-100); color: var(--gray-500); }
.badge-reviewed { background: #dbeafe; color: #1e40af; }
.badge-approved { background: #d1fae5; color: #065f46; }
.badge-published, .badge-live { background: #d1fae5; color: #065f46; }
.badge-rejected { background: #fee2e2; color: #991b1b; }
.badge-inactive { background: #fee2e2; color: #991b1b; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: white; padding: 1.25rem; border-radius: var(--radius); border: 1px solid var(--gray-200); text-align: center; }
.stat-value { font-size: 2rem; font-weight: 700; color: var(--gray-900); }
.stat-label { font-size: 0.8rem; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.5px; }

/* Author Grid */
.author-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.author-card { background: white; padding: 1.25rem; border-radius: var(--radius); border: 1px solid var(--gray-200); display: flex; justify-content: space-between; align-items: center; }
.author-info h3 { font-size: 1rem; margin-bottom: 0.25rem; }
.author-info h3 a { color: var(--gray-900); text-decoration: none; }
.author-info h3 a:hover { color: var(--primary); }

/* Auth Card */
.auth-card { max-width: 400px; margin: 4rem auto; background: white; padding: 2.5rem; border-radius: var(--radius); border: 1px solid var(--gray-200); }
.auth-card h1 { text-align: center; }
.auth-card .subtitle { text-align: center; }

/* Alerts */
.alert { padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: 0.9rem; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }

/* Status page */
.status-card { max-width: 600px; margin: 3rem auto; text-align: center; }
.status-running, .status-complete, .status-failed {
  background: white;
  padding: 3rem 2rem;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
}
.status-icon { font-size: 3rem; margin-bottom: 1rem; }
.status-complete .status-icon { color: var(--success); }
.status-failed .status-icon { color: var(--danger); }
.status-actions { margin-top: 2rem; display: flex; gap: 1rem; justify-content: center; }
.error-message { color: var(--danger); margin: 1rem 0; }

/* Detail grid */
.detail-grid { display: flex; gap: 2rem; flex-wrap: wrap; margin: 1rem 0; }
.detail-item { font-size: 0.9rem; }

/* Page header */
.page-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; }

/* Spinner */
.spinner {
  width: 48px; height: 48px;
  border: 4px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1.5rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Context actions */
.context-actions { margin-bottom: 1.5rem; }

/* Responsive */
/* File upload */
.file-upload-area {
  border: 2px dashed var(--gray-300);
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
  transition: border-color 0.2s;
}
.file-upload-area:hover { border-color: var(--primary); }
.file-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  color: var(--gray-500);
}
.file-icon {
  font-size: 2rem;
  width: 48px;
  height: 48px;
  line-height: 48px;
  border-radius: 50%;
  background: var(--gray-100);
  color: var(--primary);
}
.file-input { display: none; }
.file-list { margin-top: 0.75rem; text-align: left; }
.file-item {
  padding: 0.4rem 0.75rem;
  background: var(--gray-50);
  border-radius: 4px;
  margin-top: 0.25rem;
  font-size: 0.85rem;
}
.alert-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
}

/* Batch generation */
.batch-select {
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 0.85rem;
  vertical-align: middle;
}
.btn-batch {
  display: inline-block;
  padding: 0.4rem 1rem;
  background: var(--warning);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  vertical-align: middle;
}
.btn-batch:hover { background: #b45309; }
.batch-progress { margin: 1rem 0; }
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}
.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.5s ease;
}

@media (max-width: 768px) {
  .form-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .navbar { padding: 0.5rem 1rem; }
  .nav-links { gap: 0.75rem; font-size: 0.85rem; }
  .container { padding: 1rem; }
}
