/* ===== Variables ===== */
:root {
  --primary:      #7c3aed;
  --primary-dark: #6d28d9;
  --primary-light:#ede9fe;
  --success:      #16a34a;
  --danger:       #dc2626;
  --warning:      #d97706;
  --muted:        #94a3b8;
  --border:       #e2e8f0;
  --bg:           #f8fafc;
  --surface:      #ffffff;
  --text:         #1e293b;
  --text-secondary: #64748b;
  --radius:       10px;
  --shadow:       0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:    0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
input, select, textarea, button { font: inherit; }

/* ===== Navbar ===== */
.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.navbar-brand {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}
.navbar-menu {
  list-style: none;
  display: flex;
  align-items: center;
  gap: .25rem;
}
.navbar-menu li a {
  display: block;
  padding: .4rem .75rem;
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: .88rem;
  text-decoration: none;
  transition: background .15s, color .15s;
}
.navbar-menu li a:hover { background: var(--bg); color: var(--text); }
.navbar-menu .nav-highlight {
  color: var(--primary) !important;
  font-weight: 600;
}
.navbar-sep { color: var(--border); padding: 0 .25rem; }
.navbar-user { font-size: .82rem; color: var(--muted); padding: 0 .5rem; }

/* ===== Container ===== */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .5rem 1rem;
  border-radius: 7px;
  font-size: .88rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .15s, border-color .15s, color .15s, opacity .15s;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.4;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary  { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); text-decoration: none; }
.btn-outline  { background: transparent; border-color: var(--primary); color: var(--primary); }
.btn-outline:hover:not(:disabled) { background: var(--primary-light); text-decoration: none; }
.btn-ghost    { background: transparent; color: var(--text-secondary); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--bg); color: var(--text); text-decoration: none; }
.btn-danger   { background: var(--danger); color: #fff; border-color: transparent; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; text-decoration: none; }
.btn-sm  { padding: .3rem .65rem; font-size: .8rem; }
.btn-full { width: 100%; justify-content: center; }

/* ===== Alerts ===== */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: .88rem;
  border: 1px solid transparent;
}
.alert-error   { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.alert-success { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.alert-info    { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }

/* ===== Cards ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.mt-2 { margin-top: 1.5rem; }

/* ===== Page header ===== */
.page-header { margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.5rem; font-weight: 700; }
.page-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

/* ===== Stats grid ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  text-align: center;
  box-shadow: var(--shadow);
  border-top: 3px solid var(--border);
}
.stat-card--draft     { border-top-color: var(--muted); }
.stat-card--scheduled { border-top-color: var(--warning); }
.stat-card--published { border-top-color: var(--success); }
.stat-value { font-size: 2rem; font-weight: 700; line-height: 1.1; color: var(--text); }
.stat-label { font-size: .78rem; color: var(--text-secondary); margin-top: .25rem; text-transform: uppercase; letter-spacing: .04em; }

/* ===== Quick actions ===== */
.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-bottom: 1.5rem;
}

/* ===== Table ===== */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}
.table th {
  text-align: left;
  padding: .6rem .75rem;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
}
.table td {
  padding: .75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--bg); }
.post-excerpt { color: var(--text-secondary); }

/* ===== Tabs ===== */
.tabs {
  display: flex;
  gap: .25rem;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.5rem;
}
.tab {
  padding: .6rem 1rem;
  font-size: .88rem;
  color: var(--text-secondary);
  border-radius: 6px 6px 0 0;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color .15s;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab--active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ===== Forms ===== */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }

.form-group { margin-bottom: 1.25rem; }
.form-group label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: .35rem;
}
.required { color: var(--danger); }
.field-hint {
  font-size: .78rem;
  color: var(--muted);
  margin-bottom: .35rem;
  margin-top: .2rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
  font-size: .9rem;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124,58,237,.12);
}
textarea { resize: vertical; min-height: 120px; }

.form-actions {
  display: flex;
  gap: .75rem;
  align-items: center;
  padding-top: .5rem;
}

/* ===== AI card ===== */
.ai-card {
  background: #faf5ff;
  border-color: #ddd6fe;
  margin-bottom: 1.25rem;
}
.ai-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: .9rem;
  color: var(--primary-dark);
}

/* ===== Filters bar ===== */
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: center;
  margin-bottom: 1.5rem;
}
.filters-bar select {
  width: auto;
  min-width: 160px;
}

/* ===== Posts grid ===== */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: box-shadow .15s;
}
.post-card:hover { box-shadow: var(--shadow-md); }
.post-card-media img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
}
.post-card-body {
  padding: 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}
.post-card-meta { display: flex; gap: .4rem; flex-wrap: wrap; }
.post-card-content {
  font-size: .88rem;
  color: var(--text-secondary);
  line-height: 1.5;
  flex: 1;
}
.post-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: .4rem;
  border-top: 1px solid var(--border);
  margin-top: .25rem;
}

/* ===== Badges ===== */
.badge {
  display: inline-block;
  padding: .15rem .55rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}
.badge-facebook  { background: #dbeafe; color: #1d4ed8; }
.badge-instagram { background: #fce7f3; color: #be185d; }
.badge-linkedin  { background: #e0f2fe; color: #0369a1; }
.badge-general   { background: #f1f5f9; color: #475569; }
.badge-draft     { background: #f1f5f9; color: #64748b; }
.badge-scheduled { background: #fef3c7; color: #92400e; }
.badge-published { background: #dcfce7; color: #166534; }

/* ===== Misc ===== */
.text-muted { color: var(--text-secondary); }

/* ===== Login page ===== */
.login-page {
  background: linear-gradient(135deg, #ede9fe 0%, #f8fafc 60%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-wrap {
  width: 100%;
  padding: 1rem;
  display: flex;
  justify-content: center;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-md);
}
.login-logo {
  font-size: 2.5rem;
  text-align: center;
  margin-bottom: .5rem;
}
.login-title {
  font-size: 1.4rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 1.5rem;
  color: var(--text);
}
