:root{
  --bg:#0b1220;
  --panel:#0f1a2e;
  --border:#22314f;
  --text:#e5e7eb;
  --muted:#9aa7bd;
  --good:#22c55e;
  --bad:#ef4444;
  --link:#38bdf8;
}

*{ box-sizing:border-box; }

html, body{
  margin:0;
  padding:0;
  width:100%;
  max-width:100%;
  overflow-x:hidden;
  background:var(--bg);
  color:var(--text);
  font-family:Arial, Helvetica, sans-serif;
  -webkit-text-size-adjust:100%;
}

img, svg{ max-width:100%; height:auto; }

/* doar pentru text generic, NU pentru td/th ca să nu rupă numele aiurea */
h1, h2, p{
  overflow-wrap:anywhere;
  word-break:break-word;
}

/* ===== layout ===== */
.wrap{
  margin:0 auto;
  padding:20px 18px; /* aici pui spacing, nu pe body */
}

.header{
  width:100%;
  border-radius:12px;
  padding:20px;
  border:1px solid var(--border);
  background:#060b16;
}

.logo{ margin:0; letter-spacing:1px; }
.subtitle{ margin:8px 0 0; color:var(--muted); }

.grid{
  display:grid;
  gap:18px;
  margin:22px 0 30px;
}

.card{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:12px;
  padding:20px;
  overflow:hidden;
}

h2{ margin:0 0 12px; font-size:19px; }
p{ margin:10px 0; }
.muted{ color:var(--muted); }
.small{ font-size:12px; }

/* ===== tabs ===== */
.tabs{
  display:flex;
  gap:12px;
  margin:12px 0 14px;
}

.tab{
  background:rgba(255,255,255,0.05);
  border:1px solid rgba(255,255,255,0.18);
  color:var(--text);
  padding:14px 26px;
  font-size:15px;
  font-weight:600;
  border-radius:16px;
  cursor:pointer;
  letter-spacing:.3px;
}

.tab.active{
  background:rgba(56,189,248,0.18);
  border-color:rgba(56,189,248,0.45);
}

.hidden{ display:none; }

/* ===== tabel ===== */
.table-wrap{
  width:100%;
  max-width:100%;
  overflow-x:auto;
  overflow-y:hidden;
  -webkit-overflow-scrolling:touch;
  overscroll-behavior-x:contain;
}

.table-wrap table{
  min-width:1100px;
}

table{
  border-collapse:collapse;
  min-width:720px;
  table-layout:fixed;
}

th, td{
  padding:16px 16px;
  border-bottom:1px solid rgba(255,255,255,0.06);
  vertical-align:middle;
  line-height:1.25;
}

td{ font-size:15px; }

th{
  font-size:14px;
  color:#cbd5e1;
  font-weight:700;
  background:rgba(255,255,255,0.03);
  white-space:nowrap;
  width:120px;
}

/* header icon + text */
.th-flex{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  white-space:nowrap;
}

th img{
  width:18px;
  height:18px;
  flex:0 0 auto;
}

/* ===== name cell ===== */
.namecell{
  display:flex;
  align-items:center;
  gap:14px;
  min-width:0;
  font-size:16px;
  font-weight:600;
}

.avatar{
  width:64px;
  height:64px;
  border-radius:8px;
  object-fit:cover;
  background:#0b1220;
  border:1px solid rgba(255,255,255,0.15);
  flex:0 0 auto;
}

.namecell .label{
  flex:1 1 auto;
  min-width:0;
  white-space:normal;
  overflow-wrap:break-word;
  word-break:normal;
  line-height:1.15;
}

/* ===== links ===== */
a{ color:var(--link); text-decoration:none; }
a:hover{ text-decoration:underline; }

/* ===== footer ===== */
.footer{
  border-top:1px solid var(--border);
  padding:18px 0;
  color:var(--muted);
}

tr.missing td{ opacity:.6; }

/* =========================================================
   COLOANE
   ========================================================= */
th:first-child,
td:first-child{
  width:360px;
  min-width:360px;
}

/* numericile */
th.facebook-followers,
td.facebook-followers,
th.facebook-delta7,
td.facebook-delta7,
th.tiktok-followers,
td.tiktok-followers,
th.tiktok-delta7,
td.tiktok-delta7,
th.instagram-followers,
td.instagram-followers,
th.instagram-delta7,
td.instagram-delta7,
th.tiktok-avg-views,
td.tiktok-avg-views,
th.tiktok-reach,
td.tiktok-reach,
th.interaction-label,
td.interaction-label,
th.facebook-interaction,
td.facebook-interaction{
  width:150px;
  min-width:150px;
  max-width:150px;
  padding-left:12px;
  padding-right:12px;
  white-space:nowrap;
  font-variant-numeric:tabular-nums;
}

/* HEADERS: centrate */
th.facebook-followers,
th.facebook-delta7,
th.tiktok-followers,
th.tiktok-delta7,
th.instagram-followers,
th.instagram-delta7,
th.tiktok-avg-views,
th.tiktok-reach,
th.interaction-label,
th.facebook-interaction{
  text-align:center;
}

/* VALORI: centrate */
td.facebook-followers,
td.facebook-delta7,
td.tiktok-followers,
td.tiktok-delta7,
td.instagram-followers,
td.instagram-delta7,
td.tiktok-avg-views,
td.tiktok-reach,
td.interaction-label,
td.facebook-interaction{
  text-align:center;
}

td.facebook-delta7,
td.tiktok-delta7,
td.instagram-delta7{
  font-weight:700;
}

.delta-plus{ color:var(--good); font-size:12px; }
.delta-minus{ color:var(--bad); font-size:12px; }

tbody tr.selected{ background-color:rgba(255,255,255,0.06); }

tbody tr:hover{
  background-color:rgba(255,255,255,0.04);
  cursor:pointer;
}

/* ===== TABLET ===== */
@media (max-width:900px){
  .avatar{ width:48px; height:48px; }
}

/* ===== MOBILE ===== */
@media (max-width:700px){
  .wrap{ padding:16px 12px; }

  .header{ padding:20px; text-align:center; }
  .logo{ font-size:22px; }
  .subtitle{ font-size:13px; line-height:1.3; }

  h2{ font-size:18px; }
  .card{ padding:16px; }

  .tabs{ gap:8px; }
  .tab{
    flex:1;
    padding:12px 14px;
    font-size:14px;
    border-radius:14px;
  }

  th, td{
    padding:14px 14px;
    font-size:14px;
  }

  .avatar{
    width:28px;
    height:28px;
    border-radius:6px;
  }

  .namecell{
    gap:10px;
    align-items:flex-start;
  }

  th:first-child,
  td:first-child{
    width:240px;
    min-width:240px;
  }

  .namecell .label{
    display:-webkit-box;
    -webkit-box-orient:vertical;
    -webkit-line-clamp:3;
    overflow:hidden;
  }

  th.facebook-followers,
  td.facebook-followers,
  th.facebook-delta7,
  td.facebook-delta7,
  th.tiktok-followers,
  td.tiktok-followers,
  th.tiktok-delta7,
  td.tiktok-delta7,
  th.instagram-followers,
  td.instagram-followers,
  th.instagram-delta7,
  td.instagram-delta7,
  th.tiktok-avg-views,
  td.tiktok-avg-views,
  th.tiktok-reach,
  td.tiktok-reach,
  th.interaction-label,
  td.interaction-label,
  th.facebook-interaction,
  td.facebook-interaction{
    width:200px;
    min-width:200px;
    max-width:200px;
    padding-left:10px;
    padding-right:10px;
  }
}

/* ===== EXTRA SMALL ===== */
@media (max-width:420px){
  th, td{ padding:13px 12px; font-size:13px; }
  .tab{ font-size:13px; padding:10px 12px; }
  .avatar{ width:26px; height:26px; }
}

/* ===== DESKTOP: tabel mai lat ===== */
@media (min-width:1100px){
  .header{
      
    text-align:center;
  }
  .card{
    text-align:center;
  }
  .tabs {
    display: block;
    gap: 12px;
    margin: 12px 0 14px;
  }
  table{ min-width:1200px; }
  th, td{ padding-left:18px; padding-right:18px; }
  .table-wrap table{
  margin-left:auto;
  margin-right:auto;
}
}

/* ===== iconițe în celule ===== */
td.tiktok-followers::before,
td.facebook-followers::before,
td.instagram-followers::before{
  content:"👤";
  margin-right:6px;
  opacity:.7;
}

td.tiktok-avg-views::before{
  content:"👁";
  margin-right:6px;
  opacity:.7;
}

/* ===== reach tooltip ===== */
.reach-label{
  position:relative;
  display:inline-flex;
  align-items:center;
  gap:4px;
}

.reach-tooltip{
  position:absolute;
  top:135%;
  left:50%;
  transform:translateX(-50%);
  background:#0b1220;
  border:1px solid var(--border);
  color:var(--text);
  padding:8px 10px;
  font-size:12px;
  line-height:1.3;
  border-radius:8px;
  white-space:normal;
  width:240px;
  opacity:0;
  pointer-events:none;
  transition:opacity .15s ease, transform .15s ease;
  box-shadow:0 6px 18px rgba(0,0,0,.35);
  z-index:9999;
}

.reach-tooltip::after{
  content:"";
  position:absolute;
  bottom:100%;
  left:50%;
  transform:translateX(-50%);
  border-width:6px;
  border-style:solid;
  border-color:transparent transparent #0b1220 transparent;
}

.reach-label:hover .reach-tooltip{
  opacity:1;
  transform:translateX(-50%) translateY(2px);
}

@media (hover:none){
  .reach-tooltip{ display:none; }
}

/* ===== interaction tooltip ===== */
.interaction-label{
  position:relative;
  display:inline-flex;
  align-items:center;
  gap:4px;
}

.interaction-tooltip{
  position:absolute;
  top:135%;
  left:50%;
  transform:translateX(-50%);
  background:#0b1220;
  border:1px solid var(--border);
  color:var(--text);
  padding:8px 10px;
  font-size:12px;
  line-height:1.3;
  border-radius:8px;
  white-space:normal;
  width:240px;
  opacity:0;
  pointer-events:none;
  transition:opacity .15s ease, transform .15s ease;
  box-shadow:0 6px 18px rgba(0,0,0,.35);
  z-index:9999;
}

.interaction-tooltip::after{
  content:"";
  position:absolute;
  bottom:100%;
  left:50%;
  transform:translateX(-50%);
  border-width:6px;
  border-style:solid;
  border-color:transparent transparent #0b1220 transparent;
}

.interaction-label:hover .interaction-tooltip{
  opacity:1;
  transform:translateX(-50%) translateY(2px);
}

@media (hover:none){
  .interaction-tooltip{ display:none; }
}
