/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: #2d2d2d;
  background: #f4f4f8;
}

/* ---- Header ---- */
.header {
  background: #1a1a2e;
  border-bottom: 3px solid #c47b9b;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.logo {
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  letter-spacing: -0.02em;
}

.logo .accent { color: #c47b9b; }

.nav { display: flex; gap: 1.25rem; align-items: center; }

.nav-link {
  color: #b0b0c8;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: color 0.15s;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}

.nav-link:hover { color: #c47b9b; }

.logout-btn { color: #888; }
.logout-btn:hover { color: #c47b9b; }

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

/* ---- Auth ---- */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.auth-card {
  background: #fff;
  border-radius: 8px;
  padding: 2.5rem 2rem;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  width: 100%;
  max-width: 400px;
}

.auth-logo {
  font-size: 1.8rem;
  font-weight: 800;
  color: #1a1a2e;
  text-align: center;
  margin-bottom: 0.25rem;
}

.auth-logo .accent { color: #c47b9b; }

.auth-subtitle {
  text-align: center;
  color: #7a7a8e;
  margin-bottom: 1.5rem;
}

.auth-back {
  display: block;
  text-align: center;
  margin-top: 1rem;
  color: #7a7a8e;
  font-size: 0.88rem;
  text-decoration: none;
}

.auth-back:hover { color: #c47b9b; }

/* ---- Forms ---- */
label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #555;
  margin-bottom: 0.35rem;
}

input[type="text"],
input[type="email"],
input[type="datetime-local"],
textarea,
select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.15s;
  margin-bottom: 1rem;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: #c47b9b;
  box-shadow: 0 0 0 3px rgba(196, 123, 155, 0.15);
}

.input-full { width: 100%; }
.form-group { margin-bottom: 1rem; }

/* ---- Buttons ---- */
.btn {
  display: inline-block;
  padding: 0.55rem 1.25rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  border: 1px solid #ddd;
  background: #fff;
  color: #333;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}

.btn:hover { background: #f0f0f5; }

.btn-primary {
  background: #1a1a2e;
  color: #fff;
  border-color: #1a1a2e;
}
.btn-primary:hover { background: #2a2a45; }

.btn-success {
  background: #2d8a5e;
  color: #fff;
  border-color: #2d8a5e;
}
.btn-success:hover { background: #257a50; }

.btn-danger {
  background: #d44;
  color: #fff;
  border-color: #d44;
}
.btn-danger:hover { background: #c33; }

.btn-sm { padding: 0.35rem 0.85rem; font-size: 0.82rem; }
.btn-full { width: 100%; display: block; }

.btn-loading {
  opacity: 0.7;
  cursor: wait;
}

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

/* ---- Flash Messages ---- */
.flash {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.flash-success { background: #e8f5e9; color: #2d6a2e; border: 1px solid #c8e6c9; }
.flash-error { background: #fde8e8; color: #c33; border: 1px solid #f5c6c6; }
.flash-warning { background: #fff8e1; color: #8d6e0f; border: 1px solid #ffe082; }

/* ---- Page Header ---- */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.page-header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: #1a1a2e;
}

/* ---- Status Tabs ---- */
.status-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  border-bottom: 2px solid #e0e0e6;
  padding-bottom: 0;
}

.tab {
  padding: 0.5rem 1rem;
  text-decoration: none;
  color: #7a7a8e;
  font-size: 0.88rem;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}

.tab:hover { color: #333; }
.tab.active { color: #1a1a2e; border-bottom-color: #c47b9b; }

.badge {
  display: inline-block;
  background: #e8e8ee;
  color: #555;
  padding: 0.1rem 0.5rem;
  border-radius: 10px;
  font-size: 0.75rem;
  margin-left: 0.25rem;
}

/* ---- Article List ---- */
.article-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.article-row {
  background: #fff;
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.article-info { flex: 1; min-width: 0; }

.article-status-line {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.status-badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-draft { background: #fff3cd; color: #856404; }
.status-scheduled { background: #d1ecf1; color: #0c5460; }
.status-published { background: #d4edda; color: #155724; }

.meta-date { font-size: 0.8rem; color: #7a7a8e; }

.article-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: #1a1a2e;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.article-keyword {
  font-size: 0.82rem;
  color: #999;
  margin: 0.2rem 0 0;
}

.article-actions { flex-shrink: 0; }

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #7a7a8e;
}

.empty-state a { color: #c47b9b; }

/* ---- Cards ---- */
.card {
  background: #fff;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  margin-bottom: 1rem;
}

.card h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 0.75rem;
}

.card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: #1a1a2e;
  margin-bottom: 0.5rem;
}

/* ---- Generate Page ---- */
.form-section {
  margin-bottom: 1.5rem;
}

.form-section h2 {
  font-size: 1rem;
  font-weight: 600;
  color: #555;
  margin-bottom: 0.75rem;
}

.form-divider {
  text-align: center;
  margin: 1.5rem 0;
  position: relative;
}

.form-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: #e0e0e6;
}

.form-divider span {
  background: #fff;
  padding: 0 1rem;
  position: relative;
  color: #999;
  font-size: 0.88rem;
  font-weight: 500;
}

.keyword-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.5rem;
}

.keyword-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid #e0e0e6;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  font-size: 0.88rem;
  margin-bottom: 0;
}

.keyword-option:hover { border-color: #c47b9b; background: #fdf5f8; }

.keyword-option input[type="radio"] { accent-color: #c47b9b; }

.keyword-label { color: #333; }

/* ---- Editor ---- */
.editor-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1.25rem;
  align-items: start;
}

.editor-main { min-width: 0; }

#editor {
  min-height: 400px;
  font-size: 1rem;
  line-height: 1.7;
}

/* Quill overrides */
.ql-toolbar.ql-snow { border-radius: 6px 6px 0 0; border-color: #ddd; }
.ql-container.ql-snow { border-radius: 0 0 6px 6px; border-color: #ddd; }
.ql-editor { min-height: 400px; }

.editor-toolbar-bottom {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}

.save-status {
  font-size: 0.85rem;
  font-weight: 500;
}

.save-success { color: #2d8a5e; }
.save-error { color: #d44; }

/* ---- Settings ---- */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.25rem;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
}

.toggle-label { font-size: 0.95rem; }

.stats-grid {
  display: flex;
  gap: 1.5rem;
}

.stat { text-align: center; }

.stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: #1a1a2e;
}

.stat-label {
  display: block;
  font-size: 0.78rem;
  color: #7a7a8e;
  text-transform: capitalize;
}

/* ---- Utilities ---- */
.text-muted { color: #7a7a8e; font-size: 0.88rem; }
.text-center { text-align: center; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .editor-layout {
    grid-template-columns: 1fr;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .keyword-grid {
    grid-template-columns: 1fr;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .header-inner {
    padding: 0 1rem;
  }

  .nav { gap: 0.75rem; }
}
