/*
 * Azonix Licence Server — admin panel.
 *
 * Direction (from the ui-ux-pro-max design search for a SaaS licence dashboard):
 * glassmorphism + dark mode, data-dense, trust-blue primary with a warm accent.
 * Type is Plus Jakarta Sans throughout, with a monospace face reserved for the
 * one thing that is truly code here — the licence keys themselves.
 *
 * The signature element: licence keys are always rendered as monospace "chips"
 * with the segment groups visually locked, so a key reads like the credential
 * it is, everywhere it appears.
 */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;600&display=swap');

:root {
	--bg:        #0b1120;   /* near-black navy */
	--bg-2:      #0f172a;   /* panel base */
	--surface:   #131c31;   /* card */
	--surface-2: #1b2540;   /* raised */
	--line:      #24304d;   /* hairline border */
	--line-2:    #2f3d61;
	--primary:   #2563eb;   /* trust blue */
	--primary-2: #3b82f6;
	--primary-soft: rgba(59,130,246,.14);
	--accent:    #f97316;   /* warm accent, used sparingly */
	--text:      #e8edf7;
	--muted:     #94a3b8;
	--muted-2:   #64748b;
	--ok:        #22c55e;
	--ok-soft:   rgba(34,197,94,.14);
	--warn:      #f59e0b;
	--warn-soft: rgba(245,158,11,.14);
	--danger:    #ef4444;
	--danger-soft: rgba(239,68,68,.14);
	--radius:    14px;
	--radius-sm: 9px;
	--shadow:    0 10px 40px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }

html, body {
	margin: 0;
	padding: 0;
	background:
		radial-gradient(1200px 600px at 15% -10%, rgba(37,99,235,.16), transparent 60%),
		radial-gradient(900px 500px at 100% 0%, rgba(249,115,22,.07), transparent 55%),
		var(--bg);
	color: var(--text);
	font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
	font-size: 15px;
	line-height: 1.55;
	-webkit-font-smoothing: antialiased;
	min-height: 100vh;
}

a { color: var(--primary-2); text-decoration: none; }
a:hover { color: #93c5fd; }

/* ---- Shell ---- */
.az-shell { display: flex; min-height: 100vh; }

.az-side {
	width: 244px;
	flex-shrink: 0;
	background: linear-gradient(180deg, rgba(19,28,49,.9), rgba(11,17,32,.9));
	border-right: 1px solid var(--line);
	padding: 22px 16px;
	position: sticky;
	top: 0;
	height: 100vh;
	backdrop-filter: blur(8px);
}

.az-brand {
	display: flex;
	align-items: center;
	gap: 11px;
	padding: 6px 8px 22px;
	border-bottom: 1px solid var(--line);
	margin-bottom: 16px;
}
.az-brand .mark {
	width: 34px; height: 34px; border-radius: 9px;
	background: linear-gradient(135deg, var(--primary), var(--primary-2));
	display: grid; place-items: center;
	font-weight: 800; color: #fff; font-size: 17px;
	box-shadow: 0 6px 18px rgba(37,99,235,.4);
}
.az-brand .name { font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.az-brand .sub { color: var(--muted-2); font-size: 11.5px; margin-top: 1px; }

.az-nav { display: flex; flex-direction: column; gap: 3px; }
.az-nav a {
	display: flex; align-items: center; gap: 10px;
	padding: 10px 12px; border-radius: var(--radius-sm);
	color: var(--muted); font-weight: 500; font-size: 14px;
	transition: background .14s ease, color .14s ease;
}
.az-nav a:hover { background: var(--surface); color: var(--text); }
.az-nav a.active { background: var(--primary-soft); color: #bfdbfe; }
.az-nav a .ic { width: 17px; text-align: center; opacity: .9; }

.az-side-foot { position: absolute; bottom: 18px; left: 16px; right: 16px; }
.az-side-foot .who { color: var(--muted-2); font-size: 12px; padding: 0 8px 8px; }

/* ---- Main ---- */
.az-main { flex: 1; min-width: 0; padding: 26px 30px 60px; }

.az-topbar {
	display: flex; align-items: center; justify-content: space-between;
	gap: 16px; margin-bottom: 24px;
}
.az-topbar h1 { font-size: 21px; font-weight: 700; margin: 0; letter-spacing: -.02em; }
.az-topbar .crumb { color: var(--muted-2); font-size: 13px; margin-top: 2px; }

/* ---- Buttons ---- */
.btn {
	display: inline-flex; align-items: center; gap: 8px;
	padding: 9px 15px; border-radius: var(--radius-sm);
	font-family: inherit; font-size: 13.5px; font-weight: 600;
	border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text);
	cursor: pointer; transition: all .14s ease; text-decoration: none;
}
.btn:hover { border-color: var(--primary-2); color: #fff; }
.btn-primary {
	background: linear-gradient(135deg, var(--primary), var(--primary-2));
	border-color: transparent; color: #fff;
	box-shadow: 0 6px 18px rgba(37,99,235,.35);
}
.btn-primary:hover { color: #fff; filter: brightness(1.08); }
.btn-ghost { background: transparent; }
.btn-danger { background: var(--danger-soft); border-color: rgba(239,68,68,.4); color: #fca5a5; }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: transparent; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }

/* ---- Cards ---- */
.az-card {
	background: linear-gradient(180deg, rgba(27,37,64,.5), rgba(19,28,49,.7));
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 20px 22px;
	box-shadow: var(--shadow);
}
.az-card + .az-card { margin-top: 18px; }
.az-card h2 { font-size: 15px; font-weight: 700; margin: 0 0 4px; }
.az-card .hint { color: var(--muted); font-size: 13px; margin: 0 0 16px; }

/* ---- Stat grid ---- */
.az-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.az-stat {
	background: linear-gradient(180deg, rgba(27,37,64,.55), rgba(19,28,49,.75));
	border: 1px solid var(--line); border-radius: var(--radius);
	padding: 18px 18px 16px; position: relative; overflow: hidden;
}
.az-stat::after {
	content: ''; position: absolute; right: -20px; top: -20px;
	width: 90px; height: 90px; border-radius: 50%;
	background: var(--primary-soft); opacity: .6;
}
.az-stat .label { color: var(--muted); font-size: 12.5px; font-weight: 500; letter-spacing: .02em; }
.az-stat .value { font-size: 30px; font-weight: 800; margin-top: 6px; letter-spacing: -.02em; position: relative; }
.az-stat .value.ok { color: var(--ok); }
.az-stat .value.warn { color: var(--warn); }
.az-stat .value.muted { color: var(--muted); }

/* ---- Tables ---- */
.az-table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); }
table.az-table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 720px; }
.az-table thead th {
	text-align: left; padding: 12px 16px;
	background: var(--bg-2); color: var(--muted);
	font-weight: 600; font-size: 12px; letter-spacing: .03em; text-transform: uppercase;
	border-bottom: 1px solid var(--line);
	white-space: nowrap;
}
.az-table tbody td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.az-table tbody tr:last-child td { border-bottom: 0; }
.az-table tbody tr { transition: background .12s ease; }
.az-table tbody tr:hover { background: rgba(37,99,235,.06); }

/* ---- Key chip (the signature element) ---- */
.key-chip {
	display: inline-flex; align-items: center; gap: 6px;
	font-family: 'JetBrains Mono', ui-monospace, monospace;
	font-size: 13px; font-weight: 600; letter-spacing: .02em;
	background: var(--bg); border: 1px solid var(--line-2);
	padding: 5px 10px; border-radius: 8px; color: #cdd9f0;
	cursor: pointer; transition: all .14s ease; white-space: nowrap;
}
.key-chip:hover { border-color: var(--primary-2); color: #fff; }
.key-chip .copy-ic { opacity: .5; font-size: 11px; }
.key-chip.big { font-size: 16px; padding: 9px 15px; }

/* ---- Badges ---- */
.badge {
	display: inline-flex; align-items: center; gap: 5px;
	padding: 3px 10px; border-radius: 100px;
	font-size: 11.5px; font-weight: 600; letter-spacing: .01em;
	border: 1px solid transparent; text-transform: capitalize;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.active  { background: var(--ok-soft);   color: #4ade80; }
.badge.trial   { background: var(--primary-soft); color: #60a5fa; }
.badge.expired { background: var(--warn-soft); color: #fbbf24; }
.badge.suspended { background: var(--warn-soft); color: #fb923c; }
.badge.revoked { background: var(--danger-soft); color: #f87171; }
.badge.deactivated { background: rgba(100,116,139,.16); color: var(--muted); }

.plan-pill {
	display: inline-flex; padding: 2px 9px; border-radius: 6px;
	font-size: 11.5px; font-weight: 600; background: var(--surface-2);
	border: 1px solid var(--line-2); color: var(--muted);
}

/* ---- Forms ---- */
.az-field { margin-bottom: 16px; }
.az-field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: #cbd5e1; }
.az-field .desc { color: var(--muted-2); font-size: 12px; margin-top: 5px; }
.az-input, .az-select, textarea.az-input {
	width: 100%; padding: 10px 13px;
	background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
	color: var(--text); font-family: inherit; font-size: 14px;
	transition: border-color .14s ease, box-shadow .14s ease;
}
.az-input:focus, .az-select:focus, textarea.az-input:focus {
	outline: none; border-color: var(--primary-2);
	box-shadow: 0 0 0 3px var(--primary-soft);
}
.az-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg-opt {
	flex: 1; min-width: 88px; text-align: center;
	padding: 11px 10px; border-radius: var(--radius-sm);
	border: 1px solid var(--line-2); background: var(--bg);
	cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--muted);
	transition: all .14s ease; position: relative;
}
.seg-opt:hover { border-color: var(--line-2); color: var(--text); }
.seg-opt.on { border-color: var(--primary-2); background: var(--primary-soft); color: #bfdbfe; }
.seg-opt input { position: absolute; opacity: 0; pointer-events: none; }
.seg-opt .sub { display: block; font-size: 11px; font-weight: 500; color: var(--muted-2); margin-top: 2px; }

/* ---- Messages ---- */
.az-msg { padding: 12px 15px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 18px; }
.az-msg.ok { background: var(--ok-soft); border: 1px solid rgba(34,197,94,.35); color: #86efac; }
.az-msg.err { background: var(--danger-soft); border: 1px solid rgba(239,68,68,.35); color: #fca5a5; }

/* ---- Empty state ---- */
.az-empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.az-empty .big { font-size: 17px; font-weight: 600; color: var(--text); margin-bottom: 6px; }

/* ---- Key reveal (after creating a license) ---- */
.key-reveal {
	background: linear-gradient(135deg, rgba(37,99,235,.16), rgba(249,115,22,.08));
	border: 1px solid var(--primary-2); border-radius: var(--radius);
	padding: 24px; text-align: center; margin-bottom: 22px;
}
.key-reveal .lbl { color: var(--muted); font-size: 13px; margin-bottom: 10px; }

/* ---- Detail meta ---- */
.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--line); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.meta-cell { background: var(--surface); padding: 15px 17px; }
.meta-cell .k { color: var(--muted-2); font-size: 11.5px; font-weight: 500; letter-spacing: .03em; text-transform: uppercase; margin-bottom: 5px; }
.meta-cell .v { font-size: 15px; font-weight: 600; }

.usage-bar { height: 7px; background: var(--bg); border-radius: 100px; overflow: hidden; margin-top: 8px; }
.usage-bar .fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-2)); border-radius: 100px; }
.usage-bar .fill.full { background: linear-gradient(90deg, var(--warn), var(--accent)); }

/* ---- Login ---- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card {
	width: 100%; max-width: 380px;
	background: linear-gradient(180deg, rgba(27,37,64,.6), rgba(19,28,49,.85));
	border: 1px solid var(--line); border-radius: 18px; padding: 34px 30px;
	box-shadow: var(--shadow);
}
.login-card .mark {
	width: 48px; height: 48px; border-radius: 12px; margin: 0 auto 18px;
	background: linear-gradient(135deg, var(--primary), var(--primary-2));
	display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 22px;
	box-shadow: 0 8px 24px rgba(37,99,235,.45);
}
.login-card h1 { text-align: center; font-size: 20px; margin: 0 0 4px; }
.login-card .sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 24px; }

.toast {
	position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
	background: var(--surface-2); border: 1px solid var(--primary-2); color: #fff;
	padding: 11px 18px; border-radius: 10px; font-size: 13.5px; font-weight: 600;
	opacity: 0; pointer-events: none; transition: all .25s ease; z-index: 50;
	box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- Responsive ---- */
@media (max-width: 900px) {
	.az-stats { grid-template-columns: repeat(2, 1fr); }
	.az-side { width: 68px; padding: 18px 10px; }
	.az-brand .name, .az-brand .sub, .az-nav a span:not(.ic), .az-side-foot .who { display: none; }
	.az-brand { justify-content: center; }
	.az-nav a { justify-content: center; }
	.az-row { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
	.az-stats { grid-template-columns: 1fr; }
	.az-main { padding: 20px 16px 40px; }
}

@media (prefers-reduced-motion: reduce) {
	* { transition: none !important; }
}
