/* licenses-page.css (extracted from licenses.html for maintainability)
   World-class / enterprise UI polish for Codreum Licenses
   - Keeps all existing functionality; UI-only.
*/

html.no-auth-flash #authAction{visibility:hidden}
html.guard body{display:none}

/* Date helpers */
.page-licenses .dt{ text-decoration: underline dotted; text-underline-offset: 2px; cursor: help; }

/* Category selector (future-ready, light-touch) */
.page-licenses .lic-cat-row{display:flex;align-items:flex-end;justify-content:space-between;gap:12px;flex-wrap:wrap;margin:10px 0 8px;}
.page-licenses .lic-cat{display:flex;flex-direction:column;gap:4px;}
.page-licenses .lic-select{padding:8px 10px;border:1px solid var(--line,#e7ecf3);border-radius:10px;background:var(--card,#fff);color:var(--ink,#0e1116);font-size:14px;min-width:220px;max-width:100%;}
.page-licenses .lic-select:focus{outline:2px solid rgba(37,99,235,.35);outline-offset:2px;}
.page-licenses .lic-badge{display:inline-flex;align-items:center;gap:6px;padding:4px 10px;border-radius:999px;font-weight:600;font-size:12px;white-space:nowrap;}
.page-licenses .lic-badge.cat-labs{background:rgba(var(--labs-rgb, 37 99 235)/0.12);color:var(--labs,#2563eb);}
.page-licenses .lic-badge.cat-play{background:rgba(var(--play-rgb, 16 185 129)/0.12);color:var(--play,#10b981);}
.page-licenses .lic-badge.cat-web3{background:rgba(var(--web3-rgb, 139 92 246)/0.12);color:var(--web3,#8b5cf6);}
.page-licenses .lic-badge.cat-apps{background:rgba(var(--apps-rgb, 236 72 153)/0.12);color:var(--apps,#ec4899);}

/* Actions toolbar (enterprise style) */
.page-licenses .lic-actionsbar{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:14px;
  flex-wrap:wrap;
  margin:12px 0 14px;
  padding:12px 12px;
  border:1px solid var(--line,#e7ecf3);
  border-radius:14px;
  background:linear-gradient(180deg, rgba(255,255,255,.9), rgba(255,255,255,1));
  box-shadow:0 1px 0 rgba(16,24,40,.04);
}
.page-licenses .lic-actionsbar-left{min-width:220px;display:flex;flex-direction:column;gap:2px;}
.page-licenses .lic-actionsbar-title{font-size:12px;font-weight:900;letter-spacing:.08em;text-transform:uppercase;color:var(--muted,#5b6472);}
.page-licenses .lic-actionsbar-hint{font-size:12px;color:var(--muted,#5b6472);}

.page-licenses .lic-actionsbar-right{display:flex;gap:12px;flex-wrap:wrap;align-items:flex-start;}
.page-licenses .lic-act{display:flex;flex-direction:column;gap:4px;min-width:190px;max-width:260px;}
.page-licenses .lic-act .btn{width:auto;min-height:36px;padding:8px 12px;border-radius:12px;font-weight:800;}
.page-licenses .lic-act-note{font-size:12px;color:var(--muted,#5b6472);line-height:1.3;}

/* --- Buttons: always look like real buttons (even when disabled) ---
   - Disabled state uses tinted color (not gray), so it still looks intentional.
   - Primary is promoted via shadow (not by removing color from others).
*/
.page-licenses .lic-actionsbar .btn{border-radius:12px;font-weight:800;}

/* Renew + Add (brand family) */
.page-licenses .lic-actionsbar #renewBtn,
.page-licenses .lic-actionsbar #addResBtn{
  background: rgba(37,99,235,.90);
  border: 1px solid rgba(37,99,235,.60);
  color: var(--brand-ink,#fff);
}
.page-licenses .lic-actionsbar #renewBtn:hover,
.page-licenses .lic-actionsbar #addResBtn:hover{background: rgba(37,99,235,.96);border-color: rgba(37,99,235,.72);}

/* Disabled but still branded (no dull gray) */
.page-licenses .lic-actionsbar #renewBtn:disabled,
.page-licenses .lic-actionsbar #addResBtn:disabled{
  background: rgba(37,99,235,.16);
  border-color: rgba(37,99,235,.28);
  color: rgba(37,99,235,.85);
  opacity: 1;              /* override default disabled fade */
  cursor: default;         /* avoid STOP cursor */
}

/* Primary (contextual) */
.page-licenses .lic-actionsbar #renewBtn.primary,
.page-licenses .lic-actionsbar #addResBtn.primary{
  background: var(--brand,#2563eb);
  border-color: rgba(37,99,235,.85);
  color: var(--brand-ink,#fff);
  box-shadow: 0 10px 22px rgba(37,99,235,.18);
}

/* Connect Terraform: distinct accent */
.page-licenses .lic-actionsbar #tfBtn{
  background: rgba(15,23,42,.92);
  border: 1px solid rgba(15,23,42,.72);
  color: rgba(255,255,255,.96);
}
.page-licenses .lic-actionsbar #tfBtn:hover{background: rgba(15,23,42,.98);border-color: rgba(15,23,42,.82);}
.page-licenses .lic-actionsbar #tfBtn:disabled{
  background: rgba(15,23,42,.10);
  border-color: rgba(15,23,42,.20);
  color: rgba(15,23,42,.78);
  opacity: 1;
  cursor: default;
}

/* Download/File column alignment */
.page-licenses th.col-dl,
.page-licenses td.col-dl{ text-align:right; padding-right:14px; white-space:nowrap; }

/* ===================== Auto-renew toggle (enhanced UI) =====================
   Enhancement JS adds html.lic-renew-toggles and inserts .cr-switch.
   We hide the legacy pill/button to avoid duplication.
*/

.lic-renew-toggles .page-licenses td.col-renew{
  white-space: nowrap;
}

/* Hide legacy pill + button + <br> once toggle is active */
.lic-renew-toggles .page-licenses td.col-renew [id^="pill-"]{ display:none !important; }
.lic-renew-toggles .page-licenses td.col-renew .tag{ display:none !important; }
.lic-renew-toggles .page-licenses td.col-renew br{ display:none !important; }

/* Keep legacy button present for JS click delegation, but remove from layout */
.lic-renew-toggles .page-licenses td.col-renew button[id^="btn-"]{
  position:absolute !important;
  left:-99999px !important;
  width:1px !important;
  height:1px !important;
  overflow:hidden !important;
  opacity:0 !important;
  pointer-events:none !important;
}

/* Toggle control */
.page-licenses .cr-switch{
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  gap:10px;
  user-select:none;
  white-space:nowrap;
  margin-bottom: 2px;
}

.lic-renew-toggles .page-licenses .cr-switch input{
  position:absolute;
  opacity:0;
  pointer-events:none;
}

.lic-renew-toggles .page-licenses .cr-track{
  width:40px;
  height:22px;
  border-radius:999px;
  background: rgba(245, 158, 11, .22); /* OFF = amber (manual mode) */
  border:1px solid rgba(245, 158, 11, .35);
  position:relative;
  display:inline-block;
  vertical-align:middle;
  transition: background .15s ease, border-color .15s ease;
}

.lic-renew-toggles .page-licenses .cr-thumb{
  width:18px;
  height:18px;
  border-radius:999px;
  background:#fff;
  position:absolute;
  top:1px;
  left:1px;
  box-shadow: 0 1px 2px rgba(15,23,42,.18);
  transition: transform .15s ease;
}

.lic-renew-toggles .page-licenses .cr-switch[data-on="1"] .cr-track{
  background: rgba(22, 163, 74, .55); /* ON = green */
  border-color: rgba(22, 163, 74, .55);
}
.lic-renew-toggles .page-licenses .cr-switch[data-on="1"] .cr-thumb{ transform: translateX(18px); }

.lic-renew-toggles .page-licenses .cr-state{
  font-size:12px;
  min-width: 26px;
  font-weight:800;
}
.lic-renew-toggles .page-licenses .cr-switch[data-on="1"] .cr-state{ color: rgba(22, 163, 74, .95); }
.lic-renew-toggles .page-licenses .cr-switch[data-on="0"] .cr-state{ color: rgba(180, 83, 9, .95); }

/* During in-flight updates: keep color (no "blank" / gray flicker). */
.lic-renew-toggles .page-licenses .cr-switch[data-pending="1"]{ opacity:.82; }

/* Disabled/blocked: keep state visible, just make it non-interactive (no STOP cursor). */
.lic-renew-toggles .page-licenses .cr-switch[aria-disabled="true"]{
  cursor: default;
  opacity: .62;
}

/* ===================== Codreum branded notice/confirm modal ===================== */
#crMsgModal[aria-hidden="true"]{display:none}
#crMsgModal[aria-hidden="false"]{display:grid}
#crMsgCancel[hidden]{display:none}

#crMsgModal .cr-sheet-msg{
  width: min(560px, calc(100vw - 48px));
  max-width: 560px;
}

#crMsgModal .cr-hd-msg{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:14px;
  padding:16px 18px 12px 18px;
  border-bottom:1px solid rgba(231,236,243,.95);
}

#crMsgModal .cr-hd-msg-left{display:flex;flex-direction:column;gap:4px;min-width:0}
#crMsgModal .cr-hd-msg .cr-tt{margin:0;font-size:18px;line-height:1.2}
#crMsgModal .cr-sub{font-size:13px;line-height:1.25;color:#5b6472;max-width:58ch}

#crMsgModal .cr-x{
  border:1px solid rgba(231,236,243,.95);
  background:#fff;
  color:#0e1116;
  width:36px;
  height:36px;
  border-radius:10px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
}
#crMsgModal .cr-x:hover{background:rgba(231,236,243,.55)}
#crMsgModal .cr-x:active{transform:translateY(1px)}

#crMsgModal .cr-body-msg{padding:12px 18px 6px 18px}
#crMsgModal .cr-msg{
  white-space:pre-line;
  color:#0e1116;
  font-size:14px;
  line-height:1.55;
  max-width:62ch;
}

#crMsgModal .cr-ft-msg{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:10px;
  padding:12px 18px 16px 18px;
  border-top:1px solid rgba(231,236,243,.95);
}

/* Codreum Apps licenses table */
.page-licenses .lic-apps-shell{width:100%;overflow-x:auto}
.page-licenses .lic-apps-table{width:100%;border-collapse:collapse}
.page-licenses .lic-apps-table th,
.page-licenses .lic-apps-table td{vertical-align:top}
.page-licenses .lic-apps-product-name{font-weight:400;color:var(--ink,#0e1116)}
.page-licenses .lic-apps-renewcell{display:flex;flex-direction:column;gap:8px;min-width:170px}
.page-licenses .lic-apps-renew-toggle{width:max-content;max-width:100%}
.page-licenses .lic-apps-renew-toggle:disabled{opacity:1;cursor:default}
.page-licenses .lic-apps-table .col-app-file{text-align:right;white-space:nowrap}
.page-licenses .lic-apps-empty{padding:18px 0;color:var(--muted,#5b6472)}


/* Codreum Apps table aligns with Labs layout */
.page-licenses .lic-apps-table .col-radio{width:28px}
.page-licenses .lic-apps-table td.col-radio{vertical-align:middle}
.page-licenses .lic-apps-table td.col-renew{white-space:nowrap}
.page-licenses .lic-apps-table td.col-product{font-weight:400}
.page-licenses .lic-apps-table .col-dl{text-align:right;white-space:nowrap}

/* Codreum Apps add-on flow */
.page-licenses .apps-addon-body{display:grid;gap:16px;padding:12px 20px 16px}
.page-licenses .apps-addon-meta{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px 16px}
.page-licenses .apps-addon-options,
.page-licenses .apps-addon-summary-list{display:grid;gap:12px}
.page-licenses .apps-addon-live-card{min-height:0}
.page-licenses .apps-addon-summary-item{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;padding:12px 14px;border:1px solid #e7ecf3;border-radius:12px;background:#fff}
.page-licenses .apps-addon-summary-item span{display:flex;flex-direction:column;gap:4px;min-width:0}
.page-licenses .apps-addon-summary-item small{color:#6b7280}
@media (max-width: 720px){
  .page-licenses .apps-addon-meta{grid-template-columns:1fr}
}