/* Social Post — App Styles */
*, *::before, *::after { box-sizing: border-box; }

:root {
  --bg:        #0f1117;
  --surface:   #1a1f2e;
  --border:    #2d3348;
  --text:      #e2e8f0;
  --muted:     #64748b;
  --accent:    #6366f1;
  --accent-dk: #4f46e5;
  --success:   #16a34a;
  --warning:   #d97706;
  --danger:    #dc2626;
  --fb:        #1877f2;
  --ig:        #e1306c;
  --threads:   #000;
  --mastodon:  #6364ff;
  --bluesky:   #0085ff;
  --radius:    10px;
}

body { margin: 0; font-family: 'Inter', system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; }

/* ---- Layout ---- */
.layout { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }

/* ---- Sidebar ---- */
.sidebar { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 20px 20px 12px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 1rem; color: #fff; }
.brand-icon { font-size: 1.3rem; }
.nav-list { list-style: none; margin: 0; padding: 12px 8px; flex: 1; }
.nav-list li a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 0.88rem; transition: all .15s; }
.nav-list li a:hover, .nav-list li a.active { background: rgba(99,102,241,.12); color: #fff; }
.nav-list li a.active { color: #a5b4fc; }
.nav-icon { font-size: 1rem; width: 18px; text-align: center; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid var(--border); font-size: 0.82rem; display: flex; flex-direction: column; gap: 4px; }
.user-name { color: var(--text); font-weight: 500; }
.logout-link { color: var(--muted); text-decoration: none; }
.logout-link:hover { color: var(--danger); }

/* ---- Main ---- */
.main-content { min-width: 0; }
.page-header { padding: 28px 32px 0; }
.page-header h1 { margin: 0; font-size: 1.4rem; font-weight: 600; }
.page-body { padding: 24px 32px 40px; }

/* ---- Cards ---- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 20px; }
.card-title { font-size: 0.95rem; font-weight: 600; margin: 0 0 16px; color: var(--text); }

/* ---- Forms ---- */
label { display: block; font-size: 0.82rem; color: var(--muted); margin-bottom: 5px; margin-top: 14px; font-weight: 500; }
label:first-child { margin-top: 0; }
input[type=text], input[type=email], input[type=password], input[type=url],
input[type=datetime-local], input[type=number], select, textarea {
  width: 100%; padding: 9px 12px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 0.9rem; font-family: inherit;
  transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; min-height: 100px; }
select option { background: var(--surface); }

/* ---- Buttons ---- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border: none; border-radius: 8px; cursor: pointer; font-size: 0.88rem; font-weight: 500; font-family: inherit; transition: all .15s; text-decoration: none; }
.btn-primary   { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dk); }
.btn-outline   { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-full { width: 100%; justify-content: center; }

/* ---- Badges ---- */
.badge { display: inline-block; padding: 3px 8px; border-radius: 20px; font-size: 0.75rem; font-weight: 500; }
.badge-green  { background: rgba(22,163,74,.18); color: #4ade80; }
.badge-yellow { background: rgba(217,119,6,.18); color: #fbbf24; }
.badge-red    { background: rgba(220,38,38,.18); color: #f87171; }
.badge-blue   { background: rgba(99,102,241,.18); color: #a5b4fc; }
.badge-gray   { background: rgba(100,116,139,.18); color: #94a3b8; }

/* ---- Alerts ---- */
.alert { padding: 12px 16px; border-radius: 8px; font-size: 0.88rem; margin-bottom: 16px; }
.alert-error   { background: rgba(220,38,38,.12); border: 1px solid rgba(220,38,38,.3); color: #fca5a5; }
.alert-success { background: rgba(22,163,74,.12); border: 1px solid rgba(22,163,74,.3); color: #86efac; }
.alert-info    { background: rgba(99,102,241,.12); border: 1px solid rgba(99,102,241,.3); color: #a5b4fc; }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th { text-align: left; padding: 10px 12px; font-size: 0.78rem; color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--border); text-transform: uppercase; letter-spacing: .04em; }
td { padding: 11px 12px; border-bottom: 1px solid rgba(45,51,72,.6); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,.02); }

/* ---- Platform chips ---- */
.platform-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 20px; font-size: 0.78rem; font-weight: 500; margin: 2px; }
.chip-facebook_page, .chip-facebook_group { background: rgba(24,119,242,.15); color: #60a5fa; }
.chip-instagram  { background: rgba(225,48,108,.15); color: #f472b6; }
.chip-threads    { background: rgba(100,116,139,.15); color: #cbd5e1; }
.chip-mastodon   { background: rgba(99,100,255,.15); color: #a5b4fc; }
.chip-bluesky    { background: rgba(0,133,255,.15); color: #7dd3fc; }

/* ---- Compose ---- */
.compose-grid { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
.char-counter { font-size: 0.78rem; color: var(--muted); text-align: right; margin-top: 4px; }
.char-counter.warn { color: var(--warning); }
.char-counter.over { color: var(--danger); }
.preview-box { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 14px; font-size: 0.85rem; color: var(--muted); min-height: 80px; white-space: pre-wrap; }
.image-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.image-thumb { position: relative; width: 80px; height: 80px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.image-thumb img { width: 100%; height: 100%; object-fit: cover; }
.image-thumb .remove { position: absolute; top: 3px; right: 3px; background: rgba(0,0,0,.7); color: #fff; border: none; border-radius: 50%; width: 20px; height: 20px; cursor: pointer; font-size: 0.7rem; display: flex; align-items: center; justify-content: center; }
.account-selector { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto; }
.account-check { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); cursor: pointer; font-size: 0.85rem; transition: border-color .15s; }
.account-check:hover { border-color: var(--accent); }
.account-check input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; }
.account-check.selected { border-color: var(--accent); background: rgba(99,102,241,.08); }

/* ---- Dashboard stats ---- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.stat-value { font-size: 1.8rem; font-weight: 700; color: #fff; }
.stat-label { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }

/* ---- Accounts grid ---- */
.accounts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.account-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.account-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.account-platform-dot { width: 10px; height: 10px; border-radius: 50%; }

/* ---- Connect buttons ---- */
.connect-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.connect-btn { display: flex; align-items: center; gap: 10px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; font-size: 0.88rem; color: var(--text); text-decoration: none; font-weight: 500; transition: all .15s; }
.connect-btn:hover { border-color: var(--accent); }
.connect-icon { font-size: 1.3rem; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .compose-grid { grid-template-columns: 1fr; }
  .page-body { padding: 16px; }
}
