/* ---- 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: #d4d4d8;
  background: #0f0f17;
}

/* ---- Header ---- */
.header {
  background: #1a1a2e;
  border-bottom: 2px solid #0f3460;
  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: #f0f0f5;
  text-decoration: none;
  letter-spacing: -0.02em;
}

.logo .accent { color: #e94560; }

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

.nav-link {
  color: #9ca3af;
  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: #e94560; }

.logout-btn { color: #6b7280; }
.logout-btn:hover { color: #e94560; }

/* ---- 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: #0f0f17;
}

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

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

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

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

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

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

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

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: #e94560;
  box-shadow: 0 0 0 3px rgba(233, 69, 96, 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 #2a2a3e;
  background: #1a1a2e;
  color: #d4d4d8;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}

.btn:hover { background: #222240; }

.btn-primary {
  background: #0f3460;
  color: #f0f0f5;
  border-color: #0f3460;
}
.btn-primary:hover { background: #154178; }

.btn-success {
  background: #065f46;
  color: #fff;
  border-color: #065f46;
}
.btn-success:hover { background: #047857; }

.btn-danger {
  background: #991b1b;
  color: #fff;
  border-color: #991b1b;
}
.btn-danger:hover { background: #b91c1c; }

.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: #052e16; color: #4ade80; border: 1px solid #14532d; }
.flash-error { background: #350a0a; color: #f87171; border: 1px solid #7f1d1d; }
.flash-warning { background: #422006; color: #fbbf24; border: 1px solid #78350f; }

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

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

.tab {
  padding: 0.5rem 1rem;
  text-decoration: none;
  color: #6b7280;
  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: #d4d4d8; }
.tab.active { color: #f0f0f5; border-bottom-color: #e94560; }

.badge {
  display: inline-block;
  background: #1a1a2e;
  color: #9ca3af;
  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: #1a1a2e;
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  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: #422006; color: #fbbf24; }
.status-scheduled { background: #0c2d48; color: #38bdf8; }
.status-published { background: #052e16; color: #4ade80; }

.meta-date { font-size: 0.8rem; color: #6b7280; }

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

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

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

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

/* ---- Generate Page ---- */
.form-section { margin-bottom: 1.5rem; }
.form-section h2 { font-size: 1rem; font-weight: 600; color: #9ca3af; 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: #2a2a3e;
}
.form-divider span {
  background: #1a1a2e; padding: 0 1rem; position: relative;
  color: #6b7280; 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 #2a2a3e; 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: #e94560; background: #1e1e36; }
.keyword-option input[type="radio"] { accent-color: #e94560; }
.keyword-label { color: #d4d4d8; }

/* ---- 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; background: #16213e; color: #f0f0f5; }

.ql-toolbar.ql-snow { border-radius: 8px 8px 0 0; border-color: #2a2a3e !important; background: #1a1a2e; }
.ql-container.ql-snow { border-radius: 0 0 8px 8px; border-color: #2a2a3e !important; }
.ql-editor { min-height: 400px; }
.ql-snow .ql-stroke { stroke: #9ca3af; }
.ql-snow .ql-fill { fill: #9ca3af; }
.ql-snow .ql-picker-label { color: #9ca3af; }
.ql-snow .ql-picker-options { background: #1a1a2e; border-color: #2a2a3e; }
.ql-snow .ql-picker-item { color: #d4d4d8; }
/* Fix Quill toolbar icons/buttons sizing */
.ql-snow .ql-toolbar button,
.ql-toolbar.ql-snow button { width: 28px; height: 24px; padding: 3px 5px; }
.ql-snow .ql-toolbar button svg,
.ql-toolbar.ql-snow button svg { width: 18px; height: 18px; }
.ql-snow .ql-toolbar .ql-picker,
.ql-toolbar.ql-snow .ql-picker { height: 24px; }
.ql-snow .ql-toolbar .ql-picker-label,
.ql-toolbar.ql-snow .ql-picker-label { padding: 0 4px; border: 1px solid transparent; }
.ql-snow .ql-toolbar .ql-picker-label svg,
.ql-toolbar.ql-snow .ql-picker-label svg { width: 18px; height: 18px; }
.ql-snow .ql-picker.ql-header .ql-picker-label::before,
.ql-snow .ql-picker.ql-header .ql-picker-item::before { font-size: 13px; }

.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: #4ade80; }
.save-error { color: #f87171; }

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

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