/* Brian — shared base styles (every UI page links this) */

:root {
	--bg: #000000;
	--bg-grad: radial-gradient(1200px 600px at 80% -10%, rgba(237,23,76,0.10), transparent 60%),
	           radial-gradient(900px 500px at -10% 110%, rgba(237,23,76,0.06), transparent 60%);
	--surface: #0e0e0e;
	--surface-2: #161616;
	--border: #1f1f1f;
	--border-strong: #2a2a2a;
	--brand: #ed174c;
	--brand-lt: #ff3866;
	--brand-soft: rgba(237,23,76,0.12);
	--text: #ffffff;
	--muted: #888888;
	--ok: #3ec28a;
	--err: #ed174c;
	--live: #5ab8ff;
	--wait: #f5b524;
	--idle: #888888;
	--radius: 14px;
	--radius-sm: 8px;
	--shadow: 0 1px 0 rgba(255,255,255,0.03) inset, 0 20px 60px -20px rgba(0,0,0,0.8);
}

* { box-sizing: border-box; }
html, body {
	margin: 0; padding: 0;
	background: var(--bg);
	background-image: var(--bg-grad);
	background-attachment: fixed;
	color: var(--text);
	font-family: 'Space Grotesk', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
	font-size: 14px;
	-webkit-font-smoothing: antialiased;
	min-height: 100vh;
}

/* layoutTop.php nav strip */
body > a {
	display: inline-block;
	padding: 6px 12px;
	margin: 4px 2px;
	color: var(--muted);
	text-decoration: none;
	font-size: 13px;
	letter-spacing: 0.02em;
	border-radius: var(--radius-sm);
	transition: color 0.15s ease, background 0.15s ease;
}
body > a:hover { color: var(--brand); background: var(--brand-soft); }

.app { max-width: 1280px; margin: 0 auto; padding: 32px 40px 80px; }

/* Topbar */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.topbar .title { display: flex; align-items: baseline; gap: 14px; min-width: 0; }
.topbar h1 { margin: 0; font-size: 28px; font-weight: 600; letter-spacing: -0.02em; }
.topbar .subtitle { font-size: 12px; color: var(--muted); font-family: 'JetBrains Mono', monospace; text-transform: uppercase; letter-spacing: 0.12em; }

.tag { font-family: 'JetBrains Mono', monospace; font-size: 11px; padding: 4px 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.1em; }
.tag.brand { color: var(--brand); background: var(--brand-soft); border: 1px solid rgba(237,23,76,0.30); }

/* Buttons */
.btn {
	font-family: inherit; font-size: 13px;
	color: var(--text); background: var(--surface-2);
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-sm);
	padding: 9px 14px;
	cursor: pointer; text-decoration: none;
	display: inline-flex; align-items: center; gap: 6px;
	transition: border-color 0.15s, background 0.15s, transform 0.05s, box-shadow 0.15s;
}
.btn:hover:not(:disabled) { border-color: var(--brand); }
.btn:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.btn:disabled, .btn.disabled-link { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

.btn-primary {
	background: linear-gradient(180deg, var(--brand-lt) 0%, var(--brand) 100%);
	color: #fff; font-weight: 600;
	border: 1px solid var(--brand);
	letter-spacing: 0.02em;
}
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 8px 24px -8px rgba(237,23,76,0.6); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary svg { vertical-align: -2px; margin-right: 4px; }

.btn-ghost { background: transparent; border-color: var(--border); color: var(--muted); }
.btn-block { width: 100%; justify-content: center; }
.btn-lg { padding: 12px 18px; font-size: 14px; }

/* Cards */
.card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	overflow: hidden;
}
.card-header {
	padding: 12px 18px;
	border-bottom: 1px solid var(--border);
	background: var(--surface-2);
	font-size: 11px; font-weight: 600;
	letter-spacing: 0.12em; text-transform: uppercase;
	color: var(--muted);
	display: flex; justify-content: space-between; align-items: center;
}
.card-body { padding: 18px; }

/* Form fields */
label.field {
	display: block;
	font-size: 11px; font-weight: 600;
	letter-spacing: 0.1em; text-transform: uppercase;
	color: var(--muted);
	margin-bottom: 8px;
}
input[type=text], input[type=number], select {
	width: 100%;
	font-family: inherit; font-size: 14px;
	color: var(--text);
	background: #0a0a0a;
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-sm);
	padding: 10px 12px;
	outline: none;
	transition: border-color 0.15s, box-shadow 0.15s;
}
input[type=number] { font-family: 'JetBrains Mono', monospace; }
input[type=text]:focus, input[type=number]:focus, select:focus {
	border-color: var(--brand);
	box-shadow: 0 0 0 3px var(--brand-soft);
}

/* Toggle switch */
.switch { position: relative; display: inline-block; width: 38px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
	position: absolute; cursor: pointer; inset: 0;
	background: #2a2a2a; border-radius: 22px;
	transition: 0.2s;
}
.slider::before {
	content: ''; position: absolute;
	height: 16px; width: 16px;
	left: 3px; bottom: 3px;
	background: #888; border-radius: 50%;
	transition: 0.2s;
}
.switch input:checked + .slider { background: var(--brand-soft); }
.switch input:checked + .slider::before { transform: translateX(16px); background: var(--brand); }

/* Pills (status indicators) */
.pill {
	display: inline-flex; align-items: center; gap: 6px;
	padding: 4px 10px; border-radius: 999px;
	font-size: 11px; font-weight: 500;
	letter-spacing: 0.06em; text-transform: uppercase;
	border: 1px solid transparent;
}
.pill::before {
	content: ''; width: 6px; height: 6px; border-radius: 50%;
	background: currentColor; box-shadow: 0 0 8px currentColor;
}
.pill.ok   { color: var(--ok);   background: rgba(62,194,138,0.10);  border-color: rgba(62,194,138,0.25); }
.pill.err  { color: var(--err);  background: rgba(237,23,76,0.10);   border-color: rgba(237,23,76,0.30); }
.pill.live { color: var(--live); background: rgba(90,184,255,0.10);  border-color: rgba(90,184,255,0.25); }
.pill.wait { color: var(--wait); background: rgba(245,181,36,0.10);  border-color: rgba(245,181,36,0.25); }
.pill.idle { color: var(--idle); background: rgba(154,142,130,0.10); border-color: rgba(154,142,130,0.20); }
.pill.proc {
	color: #ff2d55; background: rgba(255,45,85,0.12); border-color: rgba(255,45,85,0.45);
	animation: pillFlash 0.9s ease-in-out infinite;
}
@keyframes pillFlash {
	0%, 100% { background: rgba(255,45,85,0.10); box-shadow: 0 0 0 rgba(255,45,85,0); }
	50%      { background: rgba(255,45,85,0.30); box-shadow: 0 0 14px rgba(255,45,85,0.7); }
}

/* Icon button (32px square) */
.icon-btn {
	display: inline-flex; align-items: center; justify-content: center;
	width: 32px; height: 32px;
	border-radius: var(--radius-sm);
	color: var(--muted);
	background: transparent;
	border: 1px solid transparent;
	text-decoration: none;
	cursor: pointer;
	transition: all 0.12s ease;
}
.icon-btn:hover { color: var(--brand); background: var(--brand-soft); border-color: rgba(237,23,76,0.25); }
.icon-btn.danger:hover { color: var(--brand); background: var(--brand-soft); border-color: rgba(237,23,76,0.30); }
.icon-btn svg { width: 16px; height: 16px; }

/* Full-page progress overlay (job submit, export-all, etc.) */
.progress-overlay {
	position: fixed; inset: 0;
	background: rgba(0,0,0,0.85);
	backdrop-filter: blur(6px);
	display: none;
	align-items: center; justify-content: center;
	z-index: 100;
}
.progress-overlay.active { display: flex; }
.progress-card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 32px;
	min-width: 380px;
	text-align: center;
}
.progress-card .pc-title { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.progress-card .pc-sub { color: var(--muted); font-size: 13px; margin-bottom: 20px; font-family: 'JetBrains Mono', monospace; }
.progress-bar {
	height: 6px;
	background: var(--border);
	border-radius: 999px;
	overflow: hidden;
	margin-bottom: 12px;
}
.progress-fill {
	height: 100%;
	background: linear-gradient(90deg, var(--brand-lt), var(--brand));
	width: 0%;
	transition: width 0.2s ease;
	box-shadow: 0 0 12px var(--brand);
}
.progress-card .pc-pct {
	font-family: 'JetBrains Mono', monospace;
	font-size: 24px; font-weight: 600;
	color: var(--brand);
}

/* Generic modal (singleShot upload, clone-job, etc.) */
.modal {
	position: fixed; inset: 0;
	background: rgba(0,0,0,0.85);
	backdrop-filter: blur(8px);
	display: none; align-items: center; justify-content: center;
	z-index: 100;
}
.modal.active { display: flex; }
.modal-card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	width: 440px; max-width: 92vw;
	overflow: hidden;
	box-shadow: 0 30px 80px -20px rgba(0,0,0,0.9);
}
.modal-head {
	padding: 14px 18px;
	border-bottom: 1px solid var(--border);
	display: flex; justify-content: space-between; align-items: center;
}
.modal-head .title { font-size: 15px; font-weight: 600; }
.modal-close {
	background: transparent; border: 0; color: var(--muted);
	cursor: pointer; padding: 4px 8px; border-radius: var(--radius-sm);
	transition: color 0.15s, background 0.15s;
}
.modal-close:hover { color: var(--brand); background: var(--brand-soft); }
.modal-body { padding: 18px; }

/* Misc */
.kbd { font-family: 'JetBrains Mono', monospace; font-size: 10px; padding: 2px 6px; border-radius: 4px; border: 1px solid var(--border-strong); color: var(--muted); }
.spinner-inline {
	display: inline-block;
	width: 14px; height: 14px;
	border: 2px solid var(--border-strong);
	border-top-color: var(--brand);
	border-radius: 50%;
	animation: spin 0.7s linear infinite;
	margin-right: 8px;
	vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }
