/* Tamiliyal Plagiarism Check — front end + tracker styles.
   Override --tpc-accent in your theme to match the journal's colour. */

.tpc-wrap,
.tpc-card,
.tpc-admin {
	--tpc-accent: #0f766e;
	--tpc-accent-ink: #ffffff;
	--tpc-ink: #1f2937;
	--tpc-muted: #6b7280;
	--tpc-line: #e5e7eb;
	--tpc-soft: #f8fafc;
	--tpc-card: #ffffff;
	--tpc-radius: 12px;

	--tpc-pending: #64748b;
	--tpc-received: #2563eb;
	--tpc-checking: #d97706;
	--tpc-completed: #15803d;
	--tpc-rejected: #b91c1c;

	--tpc-l0: #15803d;
	--tpc-l1: #ca8a04;
	--tpc-l2: #ea580c;
	--tpc-l3: #b91c1c;
}

.tpc-wrap { margin: 1.5em 0; color: var(--tpc-ink); }
.tpc-wrap *, .tpc-card * { box-sizing: border-box; }
.tpc-form-title { margin: 0 0 .75em; }
.tpc-muted { color: var(--tpc-muted); }
.tpc-req { color: var(--tpc-rejected); }

/* ---------- Alerts ---------- */
.tpc-alert {
	padding: .85em 1em;
	border-radius: 10px;
	border: 1px solid var(--tpc-line);
	background: var(--tpc-soft);
	margin: 0 0 1em;
	line-height: 1.5;
}
.tpc-alert-success { border-color: #bbf7d0; background: #f0fdf4; color: #14532d; }
.tpc-alert-error { border-color: #fecaca; background: #fef2f2; color: #7f1d1d; }
.tpc-code-inline {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-weight: 700;
	background: rgba(255, 255, 255, .7);
	padding: .05em .4em;
	border-radius: 6px;
	white-space: nowrap;
}

/* ---------- Form ---------- */
.tpc-form {
	background: var(--tpc-card);
	border: 1px solid var(--tpc-line);
	border-radius: var(--tpc-radius);
	padding: 1.5em;
}
.tpc-field { margin: 0 0 1.1em; }
.tpc-field label,
.tpc-label { display: block; font-weight: 600; margin-bottom: .35em; }
.tpc-field input[type="text"],
.tpc-field input[type="email"],
.tpc-field textarea {
	width: 100%;
	padding: .65em .8em;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	font: inherit;
	background: #fff;
	color: var(--tpc-ink);
}
.tpc-field input:focus,
.tpc-field textarea:focus {
	outline: 2px solid color-mix(in srgb, var(--tpc-accent) 40%, transparent);
	outline-offset: 1px;
	border-color: var(--tpc-accent);
}
.tpc-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1em; }
.tpc-check label { font-weight: 400; display: flex; gap: .5em; align-items: flex-start; }
.tpc-check input { margin-top: .3em; }
.tpc-hp { position: absolute !important; left: -9999px !important; height: 1px; overflow: hidden; }

/* Drop zone */
.tpc-drop {
	position: relative;
	display: flex !important;
	align-items: center;
	gap: 1em;
	padding: 1.4em;
	border: 2px dashed #cbd5e1;
	border-radius: var(--tpc-radius);
	background: var(--tpc-soft);
	cursor: pointer;
	font-weight: 400 !important;
	transition: border-color .15s, background .15s;
}
.tpc-drop:hover,
.tpc-drop.is-over { border-color: var(--tpc-accent); background: color-mix(in srgb, var(--tpc-accent) 6%, #fff); }
.tpc-drop.has-file { border-style: solid; border-color: var(--tpc-accent); }
.tpc-drop.has-error { border-color: var(--tpc-rejected); }
.tpc-drop input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.tpc-drop-icon { flex: none; width: 44px; height: 44px; border-radius: 10px; background: #fff; border: 1px solid var(--tpc-line); display: grid; place-items: center; color: var(--tpc-accent); }
.tpc-drop-icon svg { width: 24px; height: 24px; }
.tpc-drop-text { display: flex; flex-direction: column; gap: .2em; min-width: 0; }
.tpc-drop-name { overflow-wrap: anywhere; }
.tpc-drop-hint { color: var(--tpc-muted); font-size: .9em; }
.tpc-drop-error { display: block; color: var(--tpc-rejected); font-size: .9em; margin-top: .4em; min-height: 1em; }

/* Buttons */
.tpc-btn {
	display: inline-flex;
	align-items: center;
	gap: .45em;
	padding: .7em 1.2em;
	border-radius: 8px;
	border: 1px solid var(--tpc-line);
	background: #fff;
	color: var(--tpc-ink);
	font: inherit;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none !important;
	cursor: pointer;
	transition: filter .15s, transform .05s;
}
.tpc-btn:hover { filter: brightness(.96); }
.tpc-btn:active { transform: translateY(1px); }
.tpc-btn[disabled] { opacity: .65; cursor: progress; }
.tpc-btn-primary { background: var(--tpc-accent); border-color: var(--tpc-accent); color: var(--tpc-accent-ink) !important; }
.tpc-btn svg { width: 18px; height: 18px; }

/* ---------- Status card ---------- */
.tpc-list { display: grid; gap: 1em; }
.tpc-card {
	background: var(--tpc-card);
	color: var(--tpc-ink);
	border: 1px solid var(--tpc-line);
	border-radius: var(--tpc-radius);
	padding: 1.4em 1.5em;
	margin: 0 0 1em;
	box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
	line-height: 1.5;
}
.tpc-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1em; }
.tpc-card-title { min-width: 0; }
.tpc-card h3 { margin: .15em 0 .2em; font-size: 1.15em; line-height: 1.35; overflow-wrap: anywhere; }
.tpc-code {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: .8em;
	letter-spacing: .03em;
	color: var(--tpc-muted);
}
.tpc-meta { margin: 0; font-size: .88em; color: var(--tpc-muted); }
.tpc-file-link { color: inherit; display: inline-flex; align-items: center; gap: .25em; overflow-wrap: anywhere; }
.tpc-file-link svg { width: 14px; height: 14px; flex: none; }

/* Badges */
.tpc-badge {
	--c: var(--tpc-pending);
	display: inline-block;
	flex: none;
	padding: .25em .7em;
	border-radius: 999px;
	font-size: .78em;
	font-weight: 700;
	line-height: 1.4;
	white-space: nowrap;
	color: var(--c);
	background: color-mix(in srgb, var(--c) 12%, #fff);
	border: 1px solid color-mix(in srgb, var(--c) 30%, #fff);
}
.tpc-badge-received { --c: var(--tpc-received); }
.tpc-badge-checking { --c: var(--tpc-checking); }
.tpc-badge-completed { --c: var(--tpc-completed); }
.tpc-badge-rejected { --c: var(--tpc-rejected); }

/* Stepper */
.tpc-steps {
	--tpc-c: var(--tpc-accent);
	position: relative;
	display: flex;
	list-style: none;
	margin: 1.6em 0 1em !important;
	padding: 0 !important;
}
.tpc-status-completed .tpc-steps { --tpc-c: var(--tpc-completed); }
.tpc-steps.is-failed { --tpc-c: var(--tpc-rejected); }
.tpc-steps::before,
.tpc-steps::after {
	content: "";
	position: absolute;
	top: 17px;
	height: 4px;
	border-radius: 4px;
	left: calc(50% / var(--tpc-n));
}
.tpc-steps::before { right: calc(50% / var(--tpc-n)); background: var(--tpc-line); }
.tpc-steps::after {
	width: calc((100% - 100% / var(--tpc-n)) * var(--tpc-progress) / 100);
	background: var(--tpc-c);
}
.tpc-steps li {
	position: relative;
	z-index: 1;
	flex: 1 1 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: .3em;
	margin: 0 !important;
	padding: 0 .25em;
	list-style: none;
}
.tpc-dot {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	display: grid;
	place-items: center;
	font-weight: 700;
	font-size: .9em;
	background: #fff;
	border: 3px solid var(--tpc-line);
	color: var(--tpc-muted);
}
.tpc-dot svg { width: 18px; height: 18px; }
.tpc-steps .is-done .tpc-dot { background: var(--tpc-c); border-color: var(--tpc-c); color: #fff; }
.tpc-steps .is-current .tpc-dot {
	border-color: var(--tpc-c);
	color: var(--tpc-c);
	box-shadow: 0 0 0 0 color-mix(in srgb, var(--tpc-c) 45%, transparent);
	animation: tpc-pulse 1.8s ease-out infinite;
}
.tpc-steps .is-failed .tpc-dot { background: var(--tpc-rejected); border-color: var(--tpc-rejected); color: #fff; }
.tpc-step-label { font-weight: 600; font-size: .88em; line-height: 1.25; }
.tpc-steps .is-todo .tpc-step-label { color: var(--tpc-muted); font-weight: 500; }
.tpc-steps .is-failed .tpc-step-label { color: var(--tpc-rejected); }
.tpc-step-date { font-size: .76em; color: var(--tpc-muted); }

@keyframes tpc-pulse {
	0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--tpc-c) 45%, transparent); }
	70% { box-shadow: 0 0 0 10px transparent; }
	100% { box-shadow: 0 0 0 0 transparent; }
}
@media (prefers-reduced-motion: reduce) {
	.tpc-steps .is-current .tpc-dot { animation: none; }
}

.tpc-status-text { margin: 0 0 .5em; color: var(--tpc-muted); font-size: .95em; }

/* Result */
.tpc-result {
	display: flex;
	align-items: center;
	gap: 1.1em;
	flex-wrap: wrap;
	margin-top: 1em;
	padding: 1em 1.1em;
	border-radius: 10px;
	background: var(--tpc-soft);
	border: 1px solid var(--tpc-line);
}
.tpc-result .tpc-btn { margin-left: auto; }
.tpc-gauge {
	--g: var(--tpc-l0);
	flex: none;
	width: 84px;
	height: 84px;
	border-radius: 50%;
	display: grid;
	place-items: center;
	background: conic-gradient(var(--g) calc(var(--tpc-pct) * 1%), var(--tpc-line) 0);
}
.tpc-gauge-inner {
	width: 66px;
	height: 66px;
	border-radius: 50%;
	background: var(--tpc-soft);
	display: grid;
	place-items: center;
	font-size: 1.05em;
	color: var(--g);
}
.tpc-result-text { display: flex; flex-direction: column; gap: .15em; }
.tpc-result-label { font-weight: 700; }
.tpc-level { font-size: .9em; font-weight: 600; color: var(--g, var(--tpc-muted)); }
.tpc-level-l0 { --g: var(--tpc-l0); }
.tpc-level-l1 { --g: var(--tpc-l1); }
.tpc-level-l2 { --g: var(--tpc-l2); }
.tpc-level-l3 { --g: var(--tpc-l3); }

/* Note */
.tpc-note {
	margin-top: 1em;
	padding: .85em 1em;
	border-left: 4px solid var(--tpc-accent);
	background: var(--tpc-soft);
	border-radius: 0 8px 8px 0;
	font-size: .95em;
}
.tpc-status-rejected .tpc-note { border-left-color: var(--tpc-rejected); }
.tpc-note p { margin: .35em 0 0; }

/* Lookup */
.tpc-lookup { margin-top: 1em; }
.tpc-lookup summary { cursor: pointer; font-weight: 600; color: var(--tpc-accent); margin-bottom: .75em; }
.tpc-lookup-form { padding: 1.2em; }

/* ---------- Small screens: vertical stepper ---------- */
@media (max-width: 560px) {
	.tpc-row { grid-template-columns: 1fr; }
	.tpc-form, .tpc-card { padding: 1.1em; }
	.tpc-card-head { flex-direction: column-reverse; gap: .5em; }
	.tpc-steps { flex-direction: column; gap: 1em; }
	.tpc-steps li { flex-direction: row; text-align: left; gap: .75em; padding: 0; }
	.tpc-steps::before,
	.tpc-steps::after { top: 19px; left: 17px; width: 4px; right: auto; height: auto; }
	.tpc-steps::before { bottom: 19px; }
	.tpc-steps::after { height: calc((100% - 38px) * var(--tpc-progress) / 100); }
	.tpc-dot { flex: none; }
	.tpc-step-date { margin-left: auto; white-space: nowrap; }
	.tpc-result .tpc-btn { margin-left: 0; width: 100%; justify-content: center; }
}
