/* ── Social Content Bot v2 ──────────────────────────────── */

*,*::before,*::after { box-sizing: border-box; }

body {
  background: #0b1117;
  color: #c8d1da;
  min-height: 100vh;
  margin: 0;
}

/* ── Login ──────────────────────────────────────────────── */
.login-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: #0b1117;
}

.login-card {
  width: 380px;
  padding: 48px 40px;
  background: #151c24;
  border: 1px solid #1e2832;
  border-radius: 16px;
  text-align: center;
}

.login-brand { margin-bottom: 32px; }
.login-brand svg { margin: 0 auto 12px; }
.login-brand h1 { font-size: 22px; font-weight: 700; color: #fff; margin: 0; }
.login-brand p { font-size: 13px; color: #5a6a78; margin: 4px 0 0; }

.login-card input {
  width: 100%; padding: 12px 16px;
  background: #0b1117;
  border: 1px solid #1e2832;
  border-radius: 8px;
  color: #fff; font-size: 14px;
  font-family: var(--font);
  outline: none;
}
.login-card input:focus { border-color: var(--teal); }

.login-card button {
  width: 100%; padding: 12px; margin-top: 12px;
  background: var(--teal); color: #fff;
  border: none; border-radius: 8px;
  font-weight: 600; font-size: 14px;
  font-family: var(--font); cursor: pointer;
  transition: opacity 0.2s;
}
.login-card button:hover { opacity: 0.9; }

.login-error {
  color: #ff4444; font-size: 13px;
  margin-top: 12px; min-height: 18px;
}

/* ── Top Navigation ─────────────────────────────────────── */
.topnav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px;
  height: 56px;
  background: rgba(11, 17, 23, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #1a2230;
}

.topnav-left {
  display: flex; align-items: center; gap: 32px;
}

.brand {
  font-size: 17px; font-weight: 700; color: #fff;
  white-space: nowrap;
}
.brand span { color: var(--teal); }

.tabs {
  display: flex; gap: 4px;
}

.tab {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px; font-weight: 500;
  color: #5a6a78;
  background: transparent;
  border: none;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.15s;
}
.tab:hover { color: #9aa8b4; background: rgba(255,255,255,0.04); }
.tab.active { color: #fff; background: rgba(0, 128, 130, 0.12); }
.tab.active svg { color: var(--teal); }

.topnav-right { display: flex; align-items: center; }

.live-pill {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600;
  color: #00c853;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.live-dot {
  width: 6px; height: 6px;
  background: #00c853;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(0,200,83,0.3); }
  50% { box-shadow: 0 0 0 5px rgba(0,200,83,0); }
}

/* ── Main Content ───────────────────────────────────────── */
.main {
  max-width: 820px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

.view { display: none; }
.view.active { display: block; }

.view-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}
.view-header h2 {
  font-size: 20px; font-weight: 700; color: #fff;
  margin: 0 0 4px;
}
.view-header p {
  font-size: 13px; color: #5a6a78;
  margin: 0;
}

/* ── Form Card ──────────────────────────────────────────── */
.form-card {
  background: #151c24;
  border: 1px solid #1e2832;
  border-radius: 12px;
  padding: 24px;
}

.field { margin-bottom: 20px; }
.field:last-child { margin-bottom: 0; }

.field label {
  display: block;
  font-size: 13px; font-weight: 600;
  color: #8a96a3;
  margin-bottom: 8px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.field-hint {
  font-size: 12px; color: #4a5666;
  margin-top: 10px;
}

textarea, select {
  width: 100%; padding: 10px 14px;
  background: #0b1117;
  border: 1px solid #1e2832;
  border-radius: 8px;
  color: #e0e6ed; font-size: 13px;
  font-family: var(--font);
  outline: none;
  resize: vertical;
  transition: border-color 0.15s;
}
textarea:focus, select:focus { border-color: var(--teal); }

select {
  cursor: pointer;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%235a6a78' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
select option { background: #151c24; color: #fff; }

.filter-select {
  width: auto;
  padding: 6px 30px 6px 12px;
  font-size: 12px;
}

/* ── Chips (platform toggles) ───────────────────────────── */
.chips {
  display: flex; flex-wrap: wrap; gap: 8px;
}

.chip {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 14px;
  border-radius: 100px;
  font-size: 12px; font-weight: 500;
  color: #5a6a78;
  background: #0b1117;
  border: 1px solid #1e2832;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.15s;
}
.chip:hover { border-color: #2a3a4a; color: #8a96a3; }
.chip.active {
  color: #fff;
  background: rgba(255,255,255,0.04);
  border-color: #3a4a5a;
}

.chip-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  opacity: 0.4;
  transition: opacity 0.15s;
}
.chip.active .chip-dot { opacity: 1; }

/* ── Buttons ────────────────────────────────────────────── */
.btn-primary {
  padding: 12px 24px;
  background: var(--teal); color: #fff;
  border: none; border-radius: 8px;
  font-weight: 600; font-size: 14px;
  font-family: var(--font);
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-primary:hover { opacity: 0.9; }
.btn-primary:disabled { opacity: 0.35; cursor: not-allowed; }
.btn-full { width: 100%; margin-top: 4px; }

.btn-sm {
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 11px; font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid;
  background: transparent;
}

.btn-copy { color: #00c853; border-color: rgba(0,200,83,0.2); }
.btn-copy:hover { background: rgba(0,200,83,0.06); }

.btn-rewrite { color: var(--teal); border-color: rgba(0,128,130,0.2); }
.btn-rewrite:hover { background: rgba(0,128,130,0.06); }

.btn-save { color: #448aff; border-color: rgba(68,138,255,0.2); }
.btn-save:hover { background: rgba(68,138,255,0.06); }

.btn-delete { color: #ff4444; border-color: rgba(255,68,68,0.2); }
.btn-delete:hover { background: rgba(255,68,68,0.06); }

.btn-ghost { color: #5a6a78; border-color: #1e2832; }
.btn-ghost:hover { color: #8a96a3; background: rgba(255,255,255,0.02); }

/* ── Results Header ─────────────────────────────────────── */
.results-header {
  margin: 32px 0 16px;
}
.results-header h3 {
  font-size: 16px; font-weight: 700; color: #fff;
  margin: 0 0 4px;
}
.results-header p {
  font-size: 12px; color: #4a5666; margin: 0;
}

/* ── Content Cards ──────────────────────────────────────── */
.cards-list {
  display: flex; flex-direction: column; gap: 12px;
}

.post-card {
  background: #151c24;
  border: 1px solid #1e2832;
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.15s;
}
.post-card:hover { border-color: #2a3a4a; }

.post-card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid #1a2230;
  background: rgba(255,255,255,0.01);
}

.post-platform {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600; color: #fff;
}

.p-dot {
  width: 8px; height: 8px; border-radius: 50%;
}

.char-badge {
  font-size: 10px; font-weight: 500;
  color: #4a5666;
  margin-left: 4px;
  font-variant-numeric: tabular-nums;
}
.char-badge.over { color: #ff4444; }

.post-actions { display: flex; gap: 4px; }

.post-card-body { padding: 14px 16px; }

.post-text {
  font-size: 13px; line-height: 1.65;
  color: #b0bac4;
  white-space: pre-wrap;
  word-wrap: break-word;
  outline: none;
}
.post-text:focus {
  background: rgba(0,128,130,0.04);
  border-radius: 4px;
  padding: 8px;
  margin: -8px;
}

.post-tags {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 12px;
}

.tag {
  font-size: 10px; font-weight: 500;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(0,128,130,0.06);
  color: #5a8a8b;
}

.post-visual {
  font-size: 11px; color: #3a4a5a;
  margin-top: 10px; padding-top: 10px;
  border-top: 1px solid #1a2230;
  font-style: italic;
}

/* ── Calendar View ──────────────────────────────────────── */
.cal-item {
  display: grid;
  grid-template-columns: 90px 1fr auto;
  gap: 16px;
  align-items: start;
  padding: 16px;
  background: #151c24;
  border: 1px solid #1e2832;
  border-radius: 10px;
  margin-bottom: 10px;
  transition: border-color 0.15s;
}
.cal-item:hover { border-color: #2a3a4a; }

.cal-meta {
  display: flex; flex-direction: column; gap: 6px;
}

.cal-date {
  font-size: 12px; font-weight: 600; color: #5a6a78;
  font-variant-numeric: tabular-nums;
}

.cal-plat {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; color: #4a5666;
}

.cal-body {
  min-width: 0;
}

.cal-preview {
  font-size: 13px; line-height: 1.5; color: #8a96a3;
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cal-type {
  font-size: 10px; color: #3a4a5a;
  margin-top: 6px;
}

.cal-right {
  display: flex; flex-direction: column;
  align-items: flex-end; gap: 8px;
}

.status-badge {
  font-size: 10px; font-weight: 600;
  padding: 3px 10px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.status-draft { background: rgba(255,145,0,0.08); color: #ff9100; }
.status-scheduled { background: rgba(68,138,255,0.08); color: #448aff; }
.status-posted { background: rgba(0,200,83,0.08); color: #00c853; }

.cal-actions {
  display: flex; gap: 4px;
}

/* ── Batch Results ──────────────────────────────────────── */
.batch-day {
  margin-top: 28px;
}

.batch-day-header {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 8px;
  margin-bottom: 12px;
  border-bottom: 1px solid #1a2230;
}

.batch-day-header h4 {
  font-size: 14px; font-weight: 700; color: #fff;
  margin: 0;
}

.batch-day-header span {
  font-size: 12px; color: var(--teal); font-weight: 500;
}

.batch-save-row {
  text-align: center;
  margin: 28px 0 12px;
}

/* ── Empty State ────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: #3a4a5a;
}
.empty-state svg { margin: 0 auto 12px; }
.empty-state p { font-size: 13px; margin: 0; }

/* ── Setup Cards ────────────────────────────────────────── */
.setup-grid {
  display: flex; flex-direction: column;
  gap: 16px;
}

.setup-card {
  background: #151c24;
  border: 1px solid #1e2832;
  border-radius: 12px;
  overflow: hidden;
}

.setup-card-header {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid #1a2230;
}

.setup-icon {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  flex-shrink: 0;
}

.setup-card-header h3 {
  font-size: 14px; font-weight: 700; color: #fff;
  margin: 0 0 2px;
}

.setup-status {
  font-size: 11px; font-weight: 600;
}
.setup-status-ready { color: #00c853; }
.setup-status-pending { color: #ff9100; }
.setup-status-draft { color: #5a6a78; }

.setup-body {
  padding: 16px 20px;
  font-size: 13px; line-height: 1.65;
  color: #7a8a9a;
}

.setup-body p { margin: 0 0 12px; }

.setup-body ol {
  margin: 0 0 16px;
  padding-left: 20px;
  list-style: decimal;
}
.setup-body ol li {
  margin-bottom: 8px;
  list-style: decimal;
}

.setup-body ul {
  margin: 6px 0;
  padding-left: 18px;
  list-style: disc;
}
.setup-body ul li {
  margin-bottom: 4px;
  list-style: disc;
}

.setup-body strong { color: #b0bac4; }
.setup-body code {
  font-size: 12px;
  background: rgba(0,128,130,0.08);
  color: var(--teal);
  padding: 1px 6px;
  border-radius: 3px;
  font-family: 'SF Mono', Monaco, Consolas, monospace;
}

.setup-keys {
  margin-top: 12px;
  background: #0b1117;
  border: 1px solid #1a2230;
  border-radius: 8px;
  padding: 12px 16px;
}
.setup-keys p {
  font-size: 12px; color: #5a6a78;
  margin: 0 0 8px;
}

.setup-keys pre {
  font-size: 12px;
  color: #5a8a8b;
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  white-space: pre-wrap;
  margin: 0;
  line-height: 1.6;
}

.setup-note {
  background: rgba(0,128,130,0.04);
  border: 1px solid rgba(0,128,130,0.1);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 12px;
  color: #7a8a9a;
  margin-top: 12px;
}
.setup-note strong { color: var(--teal); }

/* ── Spinner ────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid #1e2832;
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-right: 6px;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast ──────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 20px; right: 20px;
  z-index: 1000;
  display: flex; flex-direction: column; gap: 8px;
}

.toast {
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px; font-weight: 500;
  background: #1a2e1a;
  color: #00c853;
  border: 1px solid rgba(0,200,83,0.15);
  animation: toastIn 0.25s ease-out;
}
.toast.error {
  background: #2e1a1a;
  color: #ff4444;
  border-color: rgba(255,68,68,0.15);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Loading State ──────────────────────────────────────── */
.loading-state {
  text-align: center; padding: 32px;
  color: #3a4a5a; font-size: 13px;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .topnav { padding: 0 16px; flex-wrap: wrap; height: auto; padding: 12px 16px; gap: 8px; }
  .topnav-left { flex-wrap: wrap; gap: 12px; }
  .tabs { gap: 2px; }
  .tab { padding: 6px 10px; font-size: 12px; }
  .main { padding: 20px 16px 48px; }
  .field-row { grid-template-columns: 1fr; }
  .cal-item { grid-template-columns: 1fr; }
  .cal-right { flex-direction: row; justify-content: flex-start; }
  .setup-card-header { flex-direction: column; align-items: flex-start; }
}
