/* ============================================================
   B4 Social Dashboard — Custom Styles
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

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

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: #0f1117;
  color: #e2e8f0;
}

/* ---- Login background ---- */
.login-bg {
  background: linear-gradient(135deg, #0f1117 0%, #1a1f35 50%, #0f1117 100%);
  position: relative;
  overflow: hidden;
}
.login-bg::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(99,102,241,.18) 0%, transparent 70%);
  top: -200px; left: -150px;
  animation: float 8s ease-in-out infinite;
}
.login-bg::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(168,85,247,.14) 0%, transparent 70%);
  bottom: -100px; right: -100px;
  animation: float 10s ease-in-out infinite reverse;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-20px); }
}

/* ---- Glass card ---- */
.glass-card {
  background: rgba(255,255,255,.07);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,.12);
}

/* ---- Sidebar ---- */
.sidebar {
  background: linear-gradient(180deg, #1a1f35 0%, #13172a 100%);
  border-right: 1px solid rgba(255,255,255,.07);
  min-height: 100vh;
  width: 240px;
  flex-shrink: 0;
}
.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-radius: 10px;
  color: #94a3b8;
  transition: all .2s;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}
.sidebar-link:hover, .sidebar-link.active {
  background: rgba(99,102,241,.18);
  color: #a5b4fc;
}
.sidebar-link svg { flex-shrink: 0; }

/* ---- Top bar ---- */
.topbar {
  background: rgba(26,31,53,.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,.07);
}

/* ---- Filter bar ---- */
.filter-select, .filter-input {
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
  color: #e2e8f0;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color .2s, background .2s;
}
.filter-select:focus, .filter-input:focus {
  border-color: #6366f1;
  background: rgba(99,102,241,.08);
}
.filter-select option { background: #1a1f35; }

/* ---- Post Cards ---- */
.post-card {
  background: linear-gradient(145deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 16px;
  padding: 20px;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s;
  position: relative;
  overflow: hidden;
}
.post-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, #6366f1, #a855f7, #3b82f6);
  opacity: 0;
  transition: opacity .25s;
}
.post-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(0,0,0,.4);
  border-color: rgba(99,102,241,.35);
}
.post-card:hover::before { opacity: 1; }

.post-card.high-performer {
  border-color: rgba(234,179,8,.3);
}
.post-card.high-performer::before {
  background: linear-gradient(90deg, #f59e0b, #eab308);
  opacity: 1;
}

/* ---- Page badges ---- */
.badge-page {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
  letter-spacing: .3px;
}
.badge-page-0 { background: rgba(99,102,241,.2); color: #a5b4fc; }
.badge-page-1 { background: rgba(16,185,129,.2); color: #6ee7b7; }
.badge-page-2 { background: rgba(245,158,11,.2); color: #fcd34d; }
.badge-page-3 { background: rgba(239,68,68,.2);  color: #fca5a5; }
.badge-page-4 { background: rgba(168,85,247,.2); color: #d8b4fe; }

/* ---- Media type badge ---- */
.badge-media {
  font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 20px;
  text-transform: uppercase; letter-spacing: .5px;
}
.badge-image  { background: rgba(59,130,246,.2);  color: #93c5fd; }
.badge-video  { background: rgba(239,68,68,.2);   color: #fca5a5; }
.badge-reel   { background: rgba(168,85,247,.2);  color: #d8b4fe; }
.badge-link   { background: rgba(20,184,166,.2);  color: #5eead4; }
.badge-text   { background: rgba(100,116,139,.2); color: #94a3b8; }
.badge-unknown{ background: rgba(100,116,139,.2); color: #94a3b8; }

/* ---- Stat chips ---- */
.stat-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; color: #94a3b8;
  background: rgba(255,255,255,.05);
  border-radius: 8px; padding: 4px 10px;
}
.stat-chip span { color: #e2e8f0; font-weight: 600; }

/* ---- Assign buttons ---- */
.btn-assign {
  font-size: 12px; font-weight: 600; padding: 5px 12px; border-radius: 8px;
  border: 1px solid rgba(99,102,241,.4);
  background: rgba(99,102,241,.12);
  color: #a5b4fc;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}
.btn-assign:hover {
  background: rgba(99,102,241,.3);
  border-color: #6366f1;
  color: #fff;
  transform: translateY(-1px);
}

/* ---- Assigned badge ---- */
.badge-assigned {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600;
  background: rgba(16,185,129,.15);
  border: 1px solid rgba(16,185,129,.3);
  color: #6ee7b7;
  border-radius: 20px; padding: 5px 12px;
}

/* ---- Toggle ---- */
.toggle-btn {
  padding: 7px 16px; border-radius: 8px;
  font-size: 13px; font-weight: 600;
  border: 1px solid rgba(255,255,255,.12);
  background: transparent; color: #94a3b8;
  cursor: pointer; transition: all .2s;
}
.toggle-btn.active {
  background: rgba(99,102,241,.2);
  border-color: #6366f1; color: #a5b4fc;
}

/* ---- Stat card ---- */
.stat-card {
  background: linear-gradient(145deg, rgba(255,255,255,.07), rgba(255,255,255,.03));
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 14px; padding: 20px;
}
.stat-value {
  font-size: 28px; font-weight: 700;
  background: linear-gradient(135deg, #a5b4fc, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---- Table ---- */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  background: rgba(99,102,241,.1);
  color: #94a3b8; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .8px;
  padding: 10px 16px; text-align: left;
}
.data-table td {
  padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,.05);
  font-size: 13px;
}
.data-table tr:hover td { background: rgba(255,255,255,.03); }
.data-table tr:last-child td { border-bottom: none; }

/* ---- Post image ---- */
.post-thumb {
  width: 100%; height: 150px; object-fit: cover;
  border-radius: 10px; margin-bottom: 10px;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(99,102,241,.4); border-radius: 3px; }

/* ---- Loading shimmer ---- */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,.05) 25%, rgba(255,255,255,.1) 50%, rgba(255,255,255,.05) 75%);
  background-size: 400px 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 8px;
}

/* ---- Empty state ---- */
.empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 60px 20px; color: #475569;
  gap: 12px;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .sidebar.open {
    display: block; position: fixed; z-index: 50; width: 220px;
    top: 0; left: 0; height: 100vh;
    box-shadow: 4px 0 30px rgba(0,0,0,.5);
  }
  .post-card { padding: 14px; }
}

/* ============================================================
   TAILWIND UTILITY FALLBACKS
   These mirror Tailwind classes so layout works even if
   cdn.tailwindcss.com fails to load on your server.
   ============================================================ */

/* Display */
.flex          { display: flex; }
.inline-flex   { display: inline-flex; }
.grid          { display: grid; }
.block         { display: block; }
.inline        { display: inline; }
.hidden        { display: none; }

/* Flex */
.flex-1        { flex: 1 1 0%; }
.flex-col      { flex-direction: column; }
.flex-wrap     { flex-wrap: wrap; }
.flex-shrink-0 { flex-shrink: 0; }
.items-start   { align-items: flex-start; }
.items-center  { align-items: center; }
.justify-center  { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end     { justify-content: flex-end; }

/* Gap */
.gap-1    { gap: 0.25rem; }
.gap-1\.5 { gap: 0.375rem; }
.gap-2    { gap: 0.5rem; }
.gap-3    { gap: 0.75rem; }
.gap-4    { gap: 1rem; }
.gap-5    { gap: 1.25rem; }
.gap-6    { gap: 1.5rem; }

/* Grid columns */
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .md\:hidden      { display: none; }
}
@media (min-width: 1280px) {
  .xl\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .xl\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Sizing */
.min-h-screen  { min-height: 100vh; }
.h-full        { height: 100%; }
.w-full        { width: 100%; }
.max-w-md      { max-width: 28rem; }
.min-w-\[160px\] { min-width: 160px; }

.w-2  { width: 0.5rem; }  .h-2  { height: 0.5rem; }
.w-3  { width: 0.75rem; } .h-3  { height: 0.75rem; }
.w-3\.5 { width: 0.875rem; }
.w-4  { width: 1rem; }    .h-4  { height: 1rem; }
.w-5  { width: 1.25rem; } .h-5  { height: 1.25rem; }
.w-6  { width: 1.5rem; }  .h-6  { height: 1.5rem; }
.w-8  { width: 2rem; }    .h-8  { height: 2rem; }
.w-16 { width: 4rem; }    .h-16 { height: 4rem; }

/* Padding */
.p-3  { padding: 0.75rem; }
.p-4  { padding: 1rem; }
.p-6  { padding: 1.5rem; }
.p-8  { padding: 2rem; }
.px-2 { padding-left: 0.5rem;  padding-right: 0.5rem; }
.px-4 { padding-left: 1rem;    padding-right: 1rem; }
.px-6 { padding-left: 1.5rem;  padding-right: 1.5rem; }
.py-1 { padding-top: 0.25rem;  padding-bottom: 0.25rem; }
.py-3 { padding-top: 0.75rem;  padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem;     padding-bottom: 1rem; }
.py-8 { padding-top: 2rem;     padding-bottom: 2rem; }
.pt-3 { padding-top: 0.75rem; }

/* Margin */
.m-0    { margin: 0; }
.mr-1   { margin-right: 0.25rem; }
.mr-2   { margin-right: 0.5rem; }
.mt-1   { margin-top: 0.25rem; }
.mt-2   { margin-top: 0.5rem; }
.mt-6   { margin-top: 1.5rem; }
.mb-1   { margin-bottom: 0.25rem; }
.mb-2   { margin-bottom: 0.5rem; }
.mb-3   { margin-bottom: 0.75rem; }
.mb-4   { margin-bottom: 1rem; }
.mb-5   { margin-bottom: 1.25rem; }
.mb-6   { margin-bottom: 1.5rem; }
.mb-8   { margin-bottom: 2rem; }

/* Spacing stacks */
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }

/* Typography */
.text-xs   { font-size: 0.75rem;   line-height: 1rem; }
.text-sm   { font-size: 0.875rem;  line-height: 1.25rem; }
.text-base { font-size: 1rem;      line-height: 1.5rem; }
.text-lg   { font-size: 1.125rem;  line-height: 1.75rem; }
.text-xl   { font-size: 1.25rem;   line-height: 1.75rem; }
.text-2xl  { font-size: 1.5rem;    line-height: 2rem; }
.text-3xl  { font-size: 1.875rem;  line-height: 2.25rem; }

.text-left   { text-align: left; }
.text-center { text-align: center; }
.text-right  { text-align: right; }

.font-light    { font-weight: 300; }
.font-normal   { font-weight: 400; }
.font-medium   { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }

.leading-tight   { line-height: 1.25; }
.leading-none    { line-height: 1; }
.leading-relaxed { line-height: 1.625; }
.uppercase       { text-transform: uppercase; }
.tracking-wider  { letter-spacing: 0.05em; }
.tracking-widest { letter-spacing: 0.1em; }
.truncate        { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line-clamp-3    { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.whitespace-nowrap { white-space: nowrap; }
.break-all       { word-break: break-all; }

/* Colors — Text */
.text-white       { color: #fff; }
.text-black       { color: #000; }
.text-slate-300   { color: #cbd5e1; }
.text-slate-400   { color: #94a3b8; }
.text-slate-500   { color: #64748b; }
.text-slate-600   { color: #475569; }
.text-slate-700   { color: #334155; }
.text-indigo-300  { color: #a5b4fc; }
.text-indigo-400  { color: #818cf8; }
.text-blue-200    { color: #bfdbfe; }
.text-blue-300    { color: #93c5fd; }
.text-blue-400    { color: #60a5fa; }
.text-red-200     { color: #fecaca; }
.text-red-300     { color: #fca5a5; }
.text-red-400     { color: #f87171; }
.text-emerald-300 { color: #6ee7b7; }
.text-emerald-400 { color: #34d399; }
.text-yellow-300  { color: #fcd34d; }
.text-yellow-400  { color: #facc15; }
.text-purple-300  { color: #d8b4fe; }
.text-purple-400  { color: #c084fc; }
.text-pink-400    { color: #f472b6; }

/* Colors — Background */
.bg-white\/10   { background-color: rgba(255,255,255,.10); }
.bg-white\/5    { background-color: rgba(255,255,255,.05); }
.bg-red-500\/20 { background-color: rgba(239,68,68,.20); }
.bg-transparent { background-color: transparent; }

/* Gradient backgrounds */
.bg-gradient-to-br { background-image: linear-gradient(to bottom right, var(--tw-gradient-from), var(--tw-gradient-to)); }
.bg-gradient-to-r  { background-image: linear-gradient(to right,        var(--tw-gradient-from), var(--tw-gradient-to)); }
.from-blue-500     { --tw-gradient-from: #3b82f6; }
.from-blue-600     { --tw-gradient-from: #2563eb; }
.from-indigo-500   { --tw-gradient-from: #6366f1; }
.to-purple-600     { --tw-gradient-to:   #9333ea; }
.to-purple-700     { --tw-gradient-to:   #7e22ce; }

/* Border */
.border      { border-width: 1px; border-style: solid; }
.border-b    { border-bottom-width: 1px; border-style: solid; }
.border-t    { border-top-width: 1px; border-style: solid; }
.border-none { border: none; }

.border-white\/5   { border-color: rgba(255,255,255,.05); }
.border-white\/7   { border-color: rgba(255,255,255,.07); }
.border-white\/12  { border-color: rgba(255,255,255,.12); }
.border-white\/20  { border-color: rgba(255,255,255,.20); }
.border-red-500\/30 { border-color: rgba(239,68,68,.30); }
.border-indigo-400  { border-color: #818cf8; }

/* Border radius */
.rounded      { border-radius: 0.25rem; }
.rounded-lg   { border-radius: 0.5rem; }
.rounded-xl   { border-radius: 0.75rem; }
.rounded-2xl  { border-radius: 1rem; }
.rounded-full { border-radius: 9999px; }

/* Shadow */
.shadow     { box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.shadow-lg  { box-shadow: 0 10px 15px -3px rgba(0,0,0,.3), 0 4px 6px rgba(0,0,0,.2); }
.shadow-2xl { box-shadow: 0 25px 50px -12px rgba(0,0,0,.5); }

/* Position */
.static   { position: static; }
.relative { position: relative; }
.absolute { position: absolute; }
.fixed    { position: fixed; }
.sticky   { position: sticky; }
.top-0  { top: 0; }    .right-0  { right: 0; }
.bottom-0 { bottom: 0; } .left-0  { left: 0; }
.top-3  { top: 0.75rem; } .right-3 { right: 0.75rem; }
.inset-0 { top:0; right:0; bottom:0; left:0; }
.z-50 { z-index: 50; }

/* Overflow */
.overflow-hidden  { overflow: hidden; }
.overflow-y-auto  { overflow-y: auto; }
.overflow-x-auto  { overflow-x: auto; }

/* Misc */
.cursor-pointer { cursor: pointer; }
.select-none    { user-select: none; }
.opacity-0      { opacity: 0; }
.opacity-50     { opacity: 0.5; }
.pointer-events-none { pointer-events: none; }

.transition   { transition: all 0.15s ease; }
.duration-700 { transition-duration: 700ms; }
.transform    { transform: translateZ(0); } /* trigger GPU */

.animate-pulse {
  animation: tw-pulse 2s cubic-bezier(0.4,0,0.6,1) infinite;
}
@keyframes tw-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .5; }
}

/* Forms */
.outline-none { outline: none; }
.resize-none  { resize: none; }
.appearance-none { appearance: none; }

/* Hover helpers */
.hover\:text-white:hover       { color: #fff; }
.hover\:text-indigo-300:hover  { color: #a5b4fc; }
.hover\:text-red-300:hover     { color: #fca5a5; }
.hover\:border-indigo-400:hover { border-color: #818cf8; }
.hover\:scale-\[1\.02\]:hover  { transform: scale(1.02); }
.active\:scale-\[0\.98\]:active { transform: scale(0.98); }

/* Focus ring */
.focus\:outline-none:focus     { outline: none; }
.focus\:ring-2:focus           { box-shadow: 0 0 0 2px rgba(99,102,241,.5); }
.focus\:ring-blue-400:focus    { box-shadow: 0 0 0 2px rgba(96,165,250,.5); }

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

/* Table */
.w-full table, table.w-full { width: 100%; }
.border-collapse { border-collapse: collapse; }
.text-left th, .text-left td { text-align: left; }

/* Backdrop blur */
.backdrop-filter { -webkit-backdrop-filter: blur(0); backdrop-filter: blur(0); }
.backdrop-blur-md { -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }

/* Divider */
.divide-y > * + * { border-top: 1px solid rgba(255,255,255,.05); }
