/* =========================================================
   OctaCore Universal Admin/Support UI
   File: /assets/css/app-ui.css
   ========================================================= */

:root{
  --bg0:#050611;
  --bg1:#070913;

  --card:rgba(10,12,20,.58);
  --glass: rgba(15,23,42,.32);

  --stroke:rgba(255,255,255,.10);
  --stroke2:rgba(255,255,255,.14);

  --text:#e9e9ff;
  --muted:rgba(233,233,255,.70);

  --shadow:0 12px 30px rgba(0,0,0,.35);
  --shadow2:0 18px 50px rgba(0,0,0,.25);

  --radius:18px;

  --sidebarW:260px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  color:var(--text);
  background:
    radial-gradient(1200px 700px at 15% 10%, rgba(179,86,255,.16), transparent 55%),
    radial-gradient(900px 600px at 85% 35%, rgba(32,227,178,.10), transparent 60%),
    linear-gradient(180deg, var(--bg1), var(--bg0));
  overflow-x:hidden;
}

/* Links */
a{ color:inherit; }
a:hover{ opacity:.96; }

/* Backdrop for mobile sidebar */
.backdrop{
  position:fixed; inset:0;
  background:rgba(0,0,0,.55);
  opacity:0; pointer-events:none;
  transition:opacity .18s ease;
  z-index:80;
}
.backdrop.show{ opacity:1; pointer-events:auto; }

/* App shell */
.app{
  display:flex;
  min-height:100vh;
  width:100%;
}

/* Sidebar */
.sidebar{
  width:var(--sidebarW);
  padding:18px 14px;
  background: linear-gradient(180deg, rgba(120,65,210,.20), rgba(15,23,42,.25));
  border-right:1px solid rgba(255,255,255,.08);
  backdrop-filter: blur(10px);
}

.brand{
  display:flex; align-items:center; gap:10px;
  padding:10px 10px 14px;
  font-weight:950;
}
.brand .dot{
  width:18px;height:18px;border-radius:7px;
  background:rgba(56,189,248,.22);
  border:1px solid rgba(56,189,248,.35);
}

.side-section{
  margin-top:10px;
  padding:0 10px;
  font-size:11px;
  font-weight:900;
  letter-spacing:.18em;
  opacity:.6;
}

.navlist{
  margin-top:10px;
  display:flex;
  flex-direction:column;
  gap:8px;
  padding:0 6px;
}

.navitem{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid transparent;
  color:var(--text);
  text-decoration:none;
  font-weight:900;
  opacity:.92;
  transition:.15s ease;
}
.navitem:hover{
  background:rgba(0,0,0,.20);
  border-color:rgba(167,139,250,.28);
  transform:translateY(-1px);
}
.navitem.active{
  background:rgba(0,0,0,.24);
  border-color:rgba(167,139,250,.38);
}

.navitem .ico{
  width:28px;height:28px;border-radius:11px;
  display:flex; align-items:center; justify-content:center;
  background:rgba(167,139,250,.12);
  border:1px solid rgba(167,139,250,.22);
  flex:0 0 28px;
}

/* Content */
.content{
  flex:1;
  padding:18px 22px 34px;
  min-width:0; /* IMPORTANT: prevents flex child overflow cutting text */
}

/* Topbar / Mobilebar */
.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  margin-bottom:16px;
}
.page-title{
  margin:0;
  font-size:22px;
  font-weight:950;
}

.actions{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  justify-content:flex-end;
  min-width:0;
}

.mobilebar{
  display:none;
  position:sticky;
  top:0;
  z-index:70;
  padding:10px 0 14px;
  backdrop-filter: blur(8px);
}
.mobilebar .mrow{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:10px 12px;
  border:1px solid var(--stroke);
  background:rgba(0,0,0,.18);
  border-radius:999px;
  box-shadow: var(--shadow);
}
.hamb{
  width:42px;height:36px;
  border-radius:12px;
  border:1px solid var(--stroke);
  background:rgba(255,255,255,.06);
  color:var(--text);
  font-weight:950;
  cursor:pointer;
}

.pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:8px 12px;
  border-radius:999px;
  border:1px solid var(--stroke);
  background:rgba(255,255,255,.06);
  color:var(--text);
  text-decoration:none;
  font-size:13px;
  line-height:1;
  cursor:pointer;
}
.pill:hover{ background:rgba(255,255,255,.10); }

.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--stroke2);
  background:rgba(255,255,255,.06);
  color:var(--text);
  text-decoration:none;
  cursor:pointer;
  font-size:13px;
  font-weight:800;
}
.btn:hover{ background:rgba(255,255,255,.10); }
.btn.primary{ background:rgba(255,255,255,.14); }

.userchip{
  display:flex;
  align-items:center;
  gap:10px;
  padding:8px 12px;
  border-radius:14px;
  border:1px solid var(--stroke);
  background:rgba(0,0,0,.18);
  min-width:240px;
  min-width:0;
}
.avatar{
  width:30px;height:30px;
  border-radius:12px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:950;
  background:rgba(167,139,250,.20);
  border:1px solid rgba(167,139,250,.35);
}
.userchip .meta{ line-height:1.05; min-width:0; }
.userchip .name{ font-weight:950; font-size:13px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.userchip .role{ font-weight:900; font-size:11px; opacity:.75; }
.updated{ font-weight:900; font-size:12px; opacity:.75; }

/* Generic layout helpers */
.grid{ display:grid; gap:14px; }
.row{ display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.muted{ color:var(--muted); font-size:12px; font-weight:700; }

/* Card */
.card{
  background:var(--card);
  border:1px solid var(--stroke);
  border-radius:var(--radius);
  padding:16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  min-width:0;
}

/* Forms */
label{display:block; font-size:13px; color:var(--muted); margin:10px 0 6px}
input, select, textarea{
  width:100%;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--stroke2);
  background:rgba(0,0,0,.18);
  color:var(--text);
  outline:none;
  min-width:0;
}
textarea{min-height:140px; resize:vertical}
input::placeholder, textarea::placeholder{ color:rgba(233,233,255,.45); }

/* Tables */
.table-wrap{
  overflow:auto;
  border-radius: var(--radius);
  -webkit-overflow-scrolling: touch;
}
.table{
  width:100%;
  border-collapse:collapse;
  margin-top:10px;
  min-width:760px;
}
.table th,.table td{
  text-align:left;
  padding:10px 8px;
  border-top:1px solid rgba(255,255,255,.08);
  font-size:13px;
  vertical-align:middle;
}
.table th{ color:var(--muted); font-weight:800; }
.table td a{ text-decoration:none; }
.table td a:hover{ text-decoration:underline; }

/* Badges */
.badge{
  display:inline-flex;
  padding:4px 10px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.14);
  background:rgba(255,255,255,.06);
  font-size:12px;
  text-transform:lowercase;
}
.badge.open{background:rgba(80,140,255,.12); border-color:rgba(80,140,255,.26)}
.badge.waiting{background:rgba(255,200,80,.12); border-color:rgba(255,200,80,.26)}
.badge.closed{background:rgba(160,160,160,.10); border-color:rgba(160,160,160,.22)}

/* =========================================================
   KPI cards (tickets stats row)
   ========================================================= */
.kpi-grid{
  display:grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap:14px;
  margin-bottom:14px;
}
@media (max-width: 980px){
  .kpi-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px){
  .kpi-grid{ grid-template-columns: 1fr; }
}

/* Anchors MUST be block to avoid blue inline link collapse */
.kpi{
  display:block;
  text-decoration:none;
  color:var(--text);
  padding:16px;
  position:relative;
  overflow:hidden;
  transition: background .15s ease, border-color .15s ease;
  cursor:pointer;
}
.kpi:hover{
  background:rgba(255,255,255,.07);
  border-color:rgba(255,255,255,.16);
}
.kpi-top{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
}
.kpi-title{
  font-size:12px;
  font-weight:900;
  color:rgba(233,233,255,.70);
}
.kpi-value{
  margin-top:8px;
  font-size:24px;
  font-weight:950;
  line-height:1;
}
.kpi-sub{
  margin-top:10px;
  font-size:12px;
  color:rgba(233,233,255,.55);
}
.kpi-ico{
  width:30px;
  height:30px;
  border-radius:12px;
  display:grid;
  place-items:center;
  background:rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.10);
  flex:0 0 30px;
  font-size:14px;
}
.kpi.is-active{
  background:rgba(179,86,255,.10);
  border-color:rgba(179,86,255,.26);
}
.kpi.open .kpi-ico{
  background:rgba(80,140,255,.10);
  border-color:rgba(80,140,255,.18);
}
.kpi.waiting .kpi-ico{
  background:rgba(255,200,80,.10);
  border-color:rgba(255,200,80,.18);
}
.kpi.closed .kpi-ico{
  background:rgba(160,160,160,.10);
  border-color:rgba(160,160,160,.18);
}
.kpi.all .kpi-ico{
  background:rgba(32,227,178,.10);
  border-color:rgba(32,227,178,.18);
}

/* Responsive shell */
@media (max-width: 980px){
  .content{ padding:14px 14px 26px; }
}
@media (max-width: 860px){
  .app{ flex-direction:column; }
  .sidebar{
    position:fixed;
    left:0; top:0; bottom:0;
    transform:translateX(-104%);
    transition:transform .18s ease;
    z-index:90;
    width: min(92vw, var(--sidebarW));
  }
  .sidebar.open{ transform:translateX(0); }
  .mobilebar{ display:block; }
  .topbar{ display:none; }
}

/* ---------------------------------------------------------
   SAFE overflow fixes (do NOT change layout/nav behavior)
   --------------------------------------------------------- */
html, body{
  max-width:100%;
  overflow-x:hidden;
  -webkit-text-size-adjust:100%;
}
img, video, canvas, svg{
  max-width:100%;
  height:auto;
}
