/* /assets/app.css — BuildLedger base UI */

:root{
  --bg: #0b0f14;
  --surface: #0f1620;
  --card: rgba(255,255,255,0.06);
  --card2: rgba(255,255,255,0.08);
  --border: rgba(255,255,255,0.12);
  --text: rgba(255,255,255,0.92);
  --muted: rgba(255,255,255,0.70);

  --accent: #ffb000;
  --accent2: #25c2a0;
  --danger: #ff4d4d;

  --radius: 16px;
  --shadow: 0 14px 40px rgba(0,0,0,0.45);

  --max: 1080px;
}

/* Hint to the browser/OS that this UI is dark */
html { color-scheme: dark; }

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  background:
    radial-gradient(1200px 900px at 20% 0%, rgba(255,176,0,0.08), transparent 55%),
    radial-gradient(900px 700px at 90% 20%, rgba(37,194,160,0.10), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  line-height:1.35;
}

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

.container{
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
}
.container.wide{
  width: min(1440px, calc(100% - 32px));
}

/* Header */
.site-header{
  position: sticky;
  top:0;
  z-index:10;
  backdrop-filter: blur(10px);
  background: rgba(11,15,20,0.70);
  border-bottom: 1px solid var(--border);
}
.header-inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 14px 0;
  gap: 14px;
}
.brand{
  display:flex;
  align-items:center;
  gap: 10px;
  min-width: 180px;
}
.brand-logo{
  width: 38px;
  height: 38px;
  border-radius: 10px;
  object-fit: contain;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
}
.brand-stack{ display:flex; flex-direction:column; line-height:1.1; }
.brand-text{ font-weight: 800; letter-spacing: 0.2px; }
.brand-sub{ font-size:11px; color: var(--muted); white-space:nowrap; }
.brand-sub__role{ opacity:0.9; }

.nav{
  display:flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content:flex-end;
}
.nav-link{
  padding: 8px 10px;
  border-radius: 12px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
}
.nav-link:hover{
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.10);
  color: var(--text);
  text-decoration:none;
}
.nav-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  margin-left: 6px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,176,0,0.18);
}

/* Footer */
.site-footer{
  margin-top: 36px;
  padding: 22px 0 36px;
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.20);
}
.footer-inner{ display:flex; flex-direction:column; gap: 10px; }
.footer-links{ display:flex; gap: 14px; flex-wrap:wrap; color: var(--muted); }
.footer-links a{ color: var(--muted); }
.footer-links a:hover{ color: var(--text); text-decoration:underline; }
.footer-meta{ color: var(--muted); font-size: 13px; }

/* Cards */
.card{
  margin-top: 22px;
  background: linear-gradient(180deg, var(--card), rgba(255,255,255,0.04));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.h1{ font-size: 26px; margin: 0 0 8px; }
.p{ color: var(--muted); margin: 0 0 16px; }

.form-row{ margin-bottom: 12px; }
.label{ display:block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }

/* Inputs */
.input{
  width: 100%;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  outline: none;
}
.input:focus{
  border-color: rgba(255,176,0,0.60);
  box-shadow: 0 0 0 3px rgba(255,176,0,0.18);
}

/* Selects (dark + consistent) */
select.input{
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding-right: 42px;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(255,255,255,0.75) 50%),
    linear-gradient(135deg, rgba(255,255,255,0.75) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 12px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}
select.input:invalid{ color: rgba(255,255,255,0.55) !important; }
select option{ background:#0f1318; color:#f1f5f9; }

/* Buttons */
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap: 8px;
  padding: 11px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  cursor:pointer;
  font-weight: 700;
}
.btn:hover{ background: rgba(255,255,255,0.10); }
.btn-primary{
  border-color: rgba(255,176,0,0.50);
  background: rgba(255,176,0,0.16);
}
.btn-primary:hover{ background: rgba(255,176,0,0.22); }
.btn-danger{
  border-color: rgba(255,77,77,0.55);
  background: rgba(255,77,77,0.15);
}

/* Alerts */
.alert{
  border: 1px solid rgba(255,176,0,0.35);
  background: rgba(255,176,0,0.10);
  border-radius: 14px;
  padding: 12px;
  margin: 12px 0 16px;
  color: var(--text);
}
.alert-danger{
  border-color: rgba(255,77,77,0.45);
  background: rgba(255,77,77,0.10);
}

.small-links{
  margin-top: 12px;
  display:flex;
  gap: 14px;
  flex-wrap:wrap;
  color: var(--muted);
}
.small-links a{ color: var(--muted); }
.small-links a:hover{ color: var(--text); }

/* === Deals UI === */
.hero{
  margin-top: 18px;
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03));
  box-shadow: var(--shadow);
}
.hero-top{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.hero h1{ margin: 0 0 6px; font-size: 28px; }
.hero p{ margin:0; color: var(--muted); }
.hero-actions{ display:flex; gap: 10px; flex-wrap: wrap; }

.deal-grid{
  margin-top: 18px;
  display:grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
}
.deal-card{
  grid-column: span 12;
  border-radius: var(--radius);
  overflow:hidden;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,0.07), rgba(255,255,255,0.03));
  box-shadow: var(--shadow);
  display:flex;
  flex-direction: column;
}
@media (min-width: 720px){ .deal-card{ grid-column: span 6; } }   /* 2 across */
@media (min-width: 1020px){ .deal-card{ grid-column: span 4; } }  /* 3 across */
@media (min-width: 1200px){ .deal-card{ grid-column: span 3; } }  /* 4 across */


.deal-card__media{ display:block; text-decoration:none; }
.deal-img{
  height: 170px;
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid rgba(255,255,255,0.10);
  display:flex;
  align-items:center;
  justify-content:center;
  position: relative;
  overflow: hidden;
}
.deal-img::before{
  content:"";
  position:absolute;
  inset:0;
  background-image: var(--img);
  background-size: cover;
  background-position: center;
  filter: blur(18px);
  transform: scale(1.15);
  opacity: 0.22;
}
.deal-img img{
  position: relative;
  z-index: 1;
  width:100%;
  height:100%;
  object-fit: contain;
  padding: 10px;
  image-rendering: auto;
}

.deal-card__body{
  padding: 14px;
  display:flex;
  flex-direction: column;
  gap: 10px;
}
.deal-top{ display:flex; align-items:center; justify-content:space-between; gap: 10px; }
.store{ font-size: 13px; color: var(--muted); }
.badge{
  font-size: 12px;
  font-weight: 800;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,176,0,0.55);
  background: rgba(255,176,0,0.16);
}
.badge-expired{
  border: 1px solid rgba(255,70,70,0.55);
  background: rgba(255,70,70,0.16);
}
.deal-title{
  color: var(--text);
  text-decoration:none;
  font-weight: 800;
  font-size: 16px;
  line-height: 1.25;
}
.deal-title:hover{ text-decoration:underline; }
.price-row{ display:flex; align-items:baseline; gap: 10px; }
.price-now{ font-size: 20px; font-weight: 900; }
.price-was{ color: var(--muted); text-decoration: line-through; font-size: 14px; }
.promo{ font-size: 13px; color: var(--muted); }
.deal-actions{ display:flex; gap: 10px; flex-wrap: wrap; margin-top: 2px; }
.hr{ height:1px; background: rgba(255,255,255,0.10); border:0; margin: 12px 0; }

/* Deal page */
.deal-page{
  margin-top: 18px;
  display:grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
}
.deal-main{ grid-column: span 12; }
.deal-side{ grid-column: span 12; }
@media (min-width: 980px){
  .deal-main{ grid-column: span 8; }
  .deal-side{ grid-column: span 4; }
}
.kv{ display:flex; justify-content:space-between; gap: 10px; color: var(--muted); font-size: 13px; }
.kv strong{ color: var(--text); font-weight: 800; }
.meta-row{ display:flex; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }

/* Image picker grid */
.image-picker { display:flex; gap:12px; flex-wrap:wrap; }
.image-card{
  position: relative;
  width: 120px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.04);
}
.image-card img{
  width:100%;
  height:90px;
  object-fit:cover;
  display:block;
}
.image-card .actions{
  position:absolute;
  bottom:6px;
  left:6px;
  right:6px;
  display:flex;
  justify-content:space-between;
  gap:6px;
}
.image-card .btn-mini{
  font-size:11px;
  padding:4px 8px;
  border-radius:999px;
  line-height:1;
}
.image-card .btn-mini.primary{ background: rgba(59,130,246,0.85); }
.image-card .btn-mini.remove{ background: rgba(239,68,68,0.85); }

/* ===== Users page – COMPACT (one-row per user) ===== */

.users-page--compact { max-width: 1260px; margin: 0 auto; }

.users-head{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:12px;
  margin-bottom: 8px;
}
.users-head__links{ display:flex; gap:10px; flex-wrap:wrap; }

.users-filters{ padding: 12px; }
.users-filters__grid{
  display:grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr .7fr auto;
  gap:10px;
  align-items:end;
}
.users-filters__btns{ display:flex; gap:10px; align-items:end; }
@media (max-width: 1100px){
  .users-filters__grid{ grid-template-columns: 1fr 1fr; }
  .users-filters__btns{ grid-column: 1 / -1; }
}

.users-table-wrap{ padding:0; overflow:auto; }
.users-table{
  width:100%;
  border-collapse: collapse;
  table-layout: fixed; /* enables ellipsis */
}
.users-table thead th{
  position: sticky;
  top: 0;
  z-index: 2;
  backdrop-filter: blur(10px);
  background: rgba(10, 14, 18, 0.75);
  border-bottom: 1px solid rgba(255,255,255,0.10);
  font-size: 12px;
  color: rgba(255,255,255,0.75);
  padding: 10px 10px;
  white-space: nowrap;
}
.users-table tbody td{
  padding: 8px 10px;     /* tighter */
  border-bottom: 1px solid rgba(255,255,255,0.08);
  vertical-align: middle;
  font-size: 13px;
}
.users-table tbody tr:hover td{ background: rgba(255,255,255,0.03); }

.u-right{ text-align:right; }
.u-empty{ padding:14px !important; color: rgba(255,255,255,0.7); }

.u-user__name{
  font-weight: 900;
  display:flex;
  align-items:center;
  gap:8px;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.u-user__meta{
  font-size: 11px;
  color: rgba(255,255,255,0.65);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.u-email, .u-created{
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.u-ctrl{ white-space: nowrap; }

.u-inline{
  display:inline-flex;
  gap:8px;
  align-items:center;
}

.u-select{
  height: 32px !important;
  padding: 6px 10px !important;
  border-radius: 12px !important;
  font-size: 12px !important;
}
.u-btn{
  height: 32px !important;
  padding: 0 10px !important;
  border-radius: 12px !important;
  font-size: 12px !important;
  font-weight: 900 !important;
}

.u-pill{
  display:inline-flex;
  align-items:center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
}
.u-pill--ok{ border-color: rgba(37,194,160,0.45); background: rgba(37,194,160,0.12); }
.u-pill--bad{ border-color: rgba(255,77,77,0.45); background: rgba(255,77,77,0.12); }
.u-pill--muted{ opacity: .8; }
.u-pill--warn{ border-color: rgba(255,176,0,0.45); background: rgba(255,176,0,0.12); }

.u-dot{
  display:inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.18);
  vertical-align: middle;
  margin-right: 6px;
}
.u-dot--ok{ background: rgba(37,194,160,0.75); }
.u-dot--muted{ background: rgba(255,255,255,0.18); }

.u-hide-sm{ display:inline; }
@media (max-width: 860px){
  .u-hide-sm{ display:none; }
}

/* Actions dropdown */
.u-dd{ position: relative; display:inline-block; }
.u-dd__btn{
  height: 32px !important;
  padding: 0 10px !important;
  border-radius: 12px !important;
  font-size: 12px !important;
  font-weight: 900 !important;
}
.u-dd[open] .u-dd__btn{
  border-color: rgba(255,176,0,0.45);
  background: rgba(255,176,0,0.10);
}
.u-dd__panel{
  position:absolute;
  right:0;
  margin-top: 8px;
  width: 230px;
  z-index: 50;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 14px;
  background: rgba(15, 22, 32, 0.98);
  box-shadow: 0 16px 50px rgba(0,0,0,0.55);
  padding: 10px;
}
.u-dd__title{
  font-weight: 900;
  font-size: 12px;
  color: rgba(255,255,255,0.80);
  margin-bottom: 8px;
}
.u-dd__row{ margin: 0 0 8px; }
.u-dd__action{
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 900;
  justify-content: center;
}
.u-dd__sep{
  height:1px;
  background: rgba(255,255,255,0.10);
  margin: 10px 0;
}
.u-dd__hint{
  font-size: 11px;
  color: rgba(255,255,255,0.65);
  margin-top: 6px;
}

/* ===== Affiliate Clicks – Compact Offer Tooltip ===== */

.offer-cell {
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.offer-name {
  position: relative;
  cursor: help;
  font-weight: 700;
}

/* Tooltip */
.offer-name::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  max-width: 420px;
  white-space: normal;
  background: #0f1318;
  color: #f1f5f9;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.18);
  box-shadow: 0 12px 30px rgba(0,0,0,0.45);
  font-size: 12px;
  line-height: 1.3;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity .15s ease, transform .15s ease;
  z-index: 50;
}

.offer-name:hover::after {
  opacity: 1;
  transform: translateY(0);
}
.users-table-wrap table {
  min-width: 1200px;
}

.users-table-wrap td,
.users-table-wrap th {
  white-space: nowrap;
}


/* Insights modal (sitewide) */
.bl-modal{display:none;position:fixed;inset:0;z-index:9999;}
.bl-modal__backdrop{position:absolute;inset:0;background:rgba(0,0,0,.55);}
.bl-modal__panel{position:relative;max-width:920px;margin:6vh auto;background:rgba(20,22,25,.96);border:1px solid rgba(255,255,255,0.14);border-radius:16px;box-shadow:0 18px 70px rgba(0,0,0,.65);overflow:hidden;}
.bl-modal__head{display:flex;align-items:center;justify-content:space-between;padding:12px 14px;border-bottom:1px solid rgba(255,255,255,0.10);}
.bl-modal__body{padding:14px;max-height:72vh;overflow:auto;}
@media (max-width:720px){.bl-modal__panel{margin:4vh 10px;}}

/* ------------------------------------------------------------------
   Insights modal (sitewide)
   Used by /assets/insights.js on pages that have [data-ins-panel] triggers.
------------------------------------------------------------------- */
.bl-modal{display:none;position:fixed;inset:0;z-index:9999;}
.bl-modal__backdrop{position:absolute;inset:0;background:rgba(0,0,0,.55);}
.bl-modal__panel{position:relative;max-width:920px;margin:6vh auto;background:rgba(20,22,25,.96);border:1px solid rgba(255,255,255,0.14);border-radius:16px;box-shadow:0 18px 70px rgba(0,0,0,.65);overflow:hidden;}
.bl-modal__head{display:flex;align-items:center;justify-content:space-between;padding:12px 14px;border-bottom:1px solid rgba(255,255,255,0.10);}
.bl-modal__title{font-weight:900;}
.bl-modal__close{background:transparent;border:1px solid rgba(255,255,255,0.14);color:inherit;border-radius:10px;padding:6px 10px;cursor:pointer;opacity:.9;}
.bl-modal__body{padding:14px;max-height:72vh;overflow:auto;}
@media (max-width: 720px){
  .bl-modal__panel{margin:4vh 10px;}
}

/* Compact insights button (optional helper) */
.insights{padding:0;overflow:hidden;}
.insights__summary{display:flex;align-items:center;gap:10px;padding:12px 14px;cursor:pointer;list-style:none;}
.insights__title{font-weight:900;opacity:.92;}
.insights__headline{font-weight:800;opacity:.9;}
.insights__mini{margin-left:auto;display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end;}
.insights__pill{font-size:12px;line-height:1;padding:6px 10px;border-radius:999px;border:1px solid rgba(255,255,255,0.14);background:rgba(255,255,255,0.04);white-space:nowrap;opacity:.92;}
.insights__caret{opacity:.6;margin-left:4px;}
@media (max-width: 520px){ .insights__headline{display:none;} }
