/* ---- 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: #3D3336;
  background: #FAF7F5;
}

/* ---- Header ---- */
.header {
  background: #2D2427;
  border-bottom: 2px solid #C9A96E;
  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: #FAF7F5;
  text-decoration: none;
  letter-spacing: -0.02em;
}

.logo .accent { color: #C9A96E; }

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

.nav-link {
  color: #BFB5B0;
  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: #C9A96E; }

.logout-btn { color: #8A7E82; }
.logout-btn:hover { color: #C9A96E; }

/* ---- 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;
  background: #FAF7F5;
}

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

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

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

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

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

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

/* ---- Forms ---- */
label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #6B5E62;
  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 #E8E0DC;
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.15s;
  margin-bottom: 1rem;
  background: #fff;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: #B76E79;
  box-shadow: 0 0 0 3px rgba(183, 110, 121, 0.12);
}

.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 #E8E0DC;
  background: #fff;
  color: #3D3336;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}

.btn:hover { background: #F5F0ED; }

.btn-primary {
  background: #2D2427;
  color: #FAF7F5;
  border-color: #2D2427;
}
.btn-primary:hover { background: #3D3336; }

.btn-success {
  background: #5A8A6E;
  color: #fff;
  border-color: #5A8A6E;
}
.btn-success:hover { background: #4D7A60; }

.btn-danger {
  background: #C45B5B;
  color: #fff;
  border-color: #C45B5B;
}
.btn-danger:hover { background: #B34A4A; }

.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: 8px;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.flash-success { background: #EDF5F0; color: #3A6B4A; border: 1px solid #D0E6D6; }
.flash-error { background: #FDF0F0; color: #B34A4A; border: 1px solid #F0D0D0; }
.flash-warning { background: #FDF8EE; color: #8D6E0F; border: 1px solid #F0E0B8; }

/* ---- 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: #2D2427;
}

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

.tab {
  padding: 0.5rem 1rem;
  text-decoration: none;
  color: #8A7E82;
  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: #3D3336; }
.tab.active { color: #2D2427; border-bottom-color: #B76E79; }

.badge {
  display: inline-block;
  background: #F0EBE8;
  color: #6B5E62;
  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: 10px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 1px 4px rgba(45, 36, 39, 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: 12px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-draft { background: #FDF8EE; color: #8D6E0F; }
.status-scheduled { background: #EEF4F8; color: #2D6A8A; }
.status-published { background: #EDF5F0; color: #3A6B4A; }

.meta-date { font-size: 0.8rem; color: #8A7E82; }

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

.article-keyword { font-size: 0.82rem; color: #A89B95; margin: 0.2rem 0 0; }
.article-actions { flex-shrink: 0; }
.empty-state { text-align: center; padding: 3rem 1rem; color: #8A7E82; }
.empty-state a { color: #B76E79; }

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

.card h2 { font-size: 1.1rem; font-weight: 700; color: #2D2427; margin-bottom: 0.75rem; }
.card h3 { font-size: 0.95rem; font-weight: 600; color: #2D2427; margin-bottom: 0.5rem; }

/* ---- Generate Page ---- */
.form-section { margin-bottom: 1.5rem; }
.form-section h2 { font-size: 1rem; font-weight: 600; color: #6B5E62; 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: #E8E0DC;
}
.form-divider span {
  background: #fff; padding: 0 1rem; position: relative;
  color: #A89B95; 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 #E8E0DC; 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: #B76E79; background: #FDF5F6; }
.keyword-option input[type="radio"] { accent-color: #B76E79; }
.keyword-label { color: #3D3336; }

/* ---- 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; }

.ql-toolbar.ql-snow { border-radius: 8px 8px 0 0; border-color: #E8E0DC; }
.ql-container.ql-snow { border-radius: 0 0 8px 8px; border-color: #E8E0DC; }
.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: #5A8A6E; }
.save-error { color: #C45B5B; }

/* ---- 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: #2D2427; }
.stat-label { display: block; font-size: 0.78rem; color: #8A7E82; text-transform: capitalize; }

/* ---- Utilities ---- */
.text-muted { color: #8A7E82; 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; }
}
