/* ── Reset & Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0f1117;
  --bg2:       #181c27;
  --bg3:       #1e2333;
  --border:    #2a2f42;
  --accent:    #6c63ff;
  --accent2:   #4f46e5;
  --text:      #e2e4ed;
  --text2:     #8b90a8;
  --success:   #22c55e;
  --warning:   #f59e0b;
  --danger:    #ef4444;
  --info:      #3b82f6;
  --radius:    10px;
  --sidebar-w: 230px;
  --font:      'Inter', system-ui, sans-serif;
}

html, body { height: 100%; font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.6; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ────────────────────────────────────────────────────────────────── */
body { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 100;
}

.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 28px 32px;
  max-width: 1300px;
}

/* ── Sidebar ───────────────────────────────────────────────────────────────── */
.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 12px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo { font-size: 22px; }
.sidebar-title { font-size: 13px; font-weight: 700; line-height: 1.3; color: var(--text); }

.brand-switcher { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.brand-select {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}
.brand-manage-link { font-size: 11px; color: var(--text2); margin-top: 5px; display: block; }

.nav-links { list-style: none; padding: 10px 0; flex: 1; }
.nav-links li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: var(--text2);
  font-size: 13px;
  font-weight: 500;
  transition: background .15s, color .15s;
  border-radius: 0;
}
.nav-links li a svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.nav-links li a:hover { background: var(--bg3); color: var(--text); text-decoration: none; }
.nav-links li.active a { background: var(--bg3); color: var(--accent); border-left: 3px solid var(--accent); }

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text2);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.logout-link { color: var(--danger); font-size: 12px; }

/* ── Page Headers ──────────────────────────────────────────────────────────── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-title { font-size: 22px; font-weight: 700; }
.page-subtitle { color: var(--text2); font-size: 13px; margin-top: 2px; }

/* ── Cards ─────────────────────────────────────────────────────────────────── */
.card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.card-title { font-size: 14px; font-weight: 600; margin-bottom: 14px; color: var(--text); }
.card + .card { margin-top: 16px; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.stat-value { font-size: 28px; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--text2); margin-top: 2px; }
.stat-card.success .stat-value { color: var(--success); }
.stat-card.warning .stat-value { color: var(--warning); }
.stat-card.danger  .stat-value { color: var(--danger); }
.stat-card.info    .stat-value { color: var(--info); }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 7px; border: none; cursor: pointer;
  font-size: 13px; font-weight: 500; transition: opacity .15s, background .15s;
  text-decoration: none; line-height: 1;
}
.btn:hover { opacity: .88; text-decoration: none; }
.btn-primary   { background: var(--accent);  color: #fff; }
.btn-secondary { background: var(--bg3);     color: var(--text); border: 1px solid var(--border); }
.btn-success   { background: var(--success); color: #fff; }
.btn-danger    { background: var(--danger);  color: #fff; }
.btn-warning   { background: var(--warning); color: #fff; }
.btn-sm        { padding: 5px 11px; font-size: 12px; }
.btn svg       { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text2); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .04em; }
.form-control {
  width: 100%; background: var(--bg3); border: 1px solid var(--border);
  color: var(--text); padding: 9px 12px; border-radius: 7px; font-size: 13px;
  transition: border-color .15s;
}
.form-control:focus { outline: none; border-color: var(--accent); }
textarea.form-control { resize: vertical; min-height: 90px; }
.form-hint { font-size: 11px; color: var(--text2); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

.checkbox-group { display: flex; gap: 16px; flex-wrap: wrap; }
.checkbox-label { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; }
.checkbox-label input { accent-color: var(--accent); width: 15px; height: 15px; }

/* ── Tables ────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th { background: var(--bg3); color: var(--text2); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); }
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg3); }

/* ── Badges & Pills ────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600;
}
.badge-success { background: rgba(34,197,94,.15);  color: var(--success); }
.badge-warning { background: rgba(245,158,11,.15); color: var(--warning); }
.badge-danger  { background: rgba(239,68,68,.15);  color: var(--danger);  }
.badge-info    { background: rgba(59,130,246,.15);  color: var(--info);    }
.badge-muted   { background: var(--bg3);            color: var(--text2);   }

.platform-pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; margin: 1px; }
.pill-facebook  { background: rgba(24,119,242,.2); color: #4b8ef1; }
.pill-instagram { background: rgba(225,48,108,.2); color: #e1306c; }
.pill-threads   { background: rgba(255,255,255,.1); color: #ccc; }

/* ── Alerts ────────────────────────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 20px; display: flex; align-items: center; justify-content: space-between; font-size: 13px; }
.alert-success { background: rgba(34,197,94,.15);  border: 1px solid rgba(34,197,94,.3);  color: var(--success); }
.alert-error   { background: rgba(239,68,68,.15);  border: 1px solid rgba(239,68,68,.3);  color: var(--danger);  }
.alert-warning { background: rgba(245,158,11,.15); border: 1px solid rgba(245,158,11,.3); color: var(--warning); }
.alert-info    { background: rgba(59,130,246,.15);  border: 1px solid rgba(59,130,246,.3);  color: var(--info);  }
.alert-close   { background: none; border: none; cursor: pointer; color: inherit; font-size: 18px; line-height: 1; padding: 0; }

/* ── Modals ────────────────────────────────────────────────────────────────── */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 500; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; width: 520px; max-width: 95vw; max-height: 90vh; overflow-y: auto; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--text2); font-size: 22px; line-height: 1; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }

/* ── Login Page ────────────────────────────────────────────────────────────── */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box { width: 380px; }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo-icon { font-size: 40px; }
.login-logo h1 { font-size: 22px; font-weight: 700; margin-top: 8px; }
.login-logo p  { color: var(--text2); font-size: 13px; }

/* ── Misc ──────────────────────────────────────────────────────────────────── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-title  { font-size: 15px; font-weight: 600; }
.text-muted     { color: var(--text2); }
.text-sm        { font-size: 12px; }
.mt-4  { margin-top: 16px; }
.mt-8  { margin-top: 32px; }
.mb-4  { margin-bottom: 16px; }
.gap-2 { gap: 8px; }
.flex  { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

.color-preview { width: 20px; height: 20px; border-radius: 4px; border: 1px solid var(--border); display: inline-block; vertical-align: middle; }
.image-thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.post-thumb  { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text2); }
.empty-state-icon { font-size: 36px; margin-bottom: 12px; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 6px; }

.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab { padding: 10px 18px; font-size: 13px; font-weight: 500; cursor: pointer; color: var(--text2); border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; border-top: none; border-left: none; border-right: none; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.schedule-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.schedule-platform { }
.schedule-platform-title { font-size: 13px; font-weight: 600; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.time-slot { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; background: var(--bg3); border-radius: 6px; margin-bottom: 6px; border: 1px solid var(--border); }
.time-slot.inactive { opacity: .45; }
.time-slot-time { font-size: 13px; font-weight: 600; }
.time-slot-actions { display: flex; gap: 6px; }

.connect-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; align-items: center; justify-content: space-between; }
.connect-card + .connect-card { margin-top: 10px; }
.connect-info { display: flex; align-items: center; gap: 12px; }
.connect-icon { font-size: 24px; }
.connect-name { font-weight: 600; font-size: 14px; }
.connect-status { font-size: 12px; color: var(--text2); margin-top: 2px; }
.connect-status.connected { color: var(--success); }

.style-preview { width: 80px; height: 80px; border-radius: 6px; border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 9px; text-align: center; overflow: hidden; flex-shrink: 0; }

/* Filters bar */
.filters { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.filters .form-control { width: auto; }

/* Pagination */
.pagination { display: flex; gap: 4px; margin-top: 16px; }
.pagination a, .pagination span { padding: 6px 12px; border-radius: 6px; font-size: 13px; border: 1px solid var(--border); background: var(--bg2); color: var(--text2); }
.pagination a:hover { background: var(--bg3); text-decoration: none; }
.pagination .current { background: var(--accent); color: #fff; border-color: var(--accent); }
