/*
 * IEP PDF Translator — front-end styles (Step 2).
 * Functional two-pane layout. Full dark-theme polish to match the IEP site
 * comes in Step 5.
 */
.iep-pdft-app {
	border: 1px solid #444;
	border-radius: 6px;
	padding: 16px;
	margin: 16px 0;
	background: #111;
	color: #e0e0e0;
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* Toolbar: upload control on the left, page navigation on the right. */
.iep-pdft-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 16px;
}

/* The file input is hidden; the styled label acts as the button. */
.iep-pdft-upload {
	display: inline-block;
	cursor: pointer;
	padding: 8px 14px;
	border: 1px solid #666;
	border-radius: 4px;
	background: #1d1d1d;
	color: #e0e0e0;
	font-size: 14px;
}
.iep-pdft-upload:hover {
	background: #262626;
}
.iep-pdft-upload input {
	display: none;
}

.iep-pdft-nav {
	display: flex;
	align-items: center;
	gap: 8px;
}
.iep-pdft-nav button {
	padding: 6px 12px;
	border: 1px solid #666;
	border-radius: 4px;
	background: #1d1d1d;
	color: #e0e0e0;
	font-size: 14px;
	cursor: pointer;
}
.iep-pdft-nav button:hover:not(:disabled) {
	background: #262626;
}
.iep-pdft-nav button:disabled {
	opacity: 0.4;
	cursor: default;
}
#iep-pdft-pageinfo {
	min-width: 70px;
	text-align: center;
	font-size: 14px;
	color: #bbb;
}

/* The two panes sit side by side and split the width evenly. */
.iep-pdft-panes {
	display: flex;
	gap: 16px;
	align-items: flex-start;
}
.iep-pdft-pane {
	flex: 1 1 0;
	min-width: 0; /* lets the pane shrink instead of overflowing */
}
.iep-pdft-pane-label {
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #9ad;
	margin-bottom: 6px;
}

.iep-pdft-canvas-wrap {
	background: #000;
	border: 1px solid #333;
	border-radius: 4px;
	padding: 8px;
	min-height: 200px;
}
.iep-pdft-canvas-wrap canvas {
	display: block;
	max-width: 100%;
	height: auto;
	margin: 0 auto;
}

.iep-pdft-translation {
	background: #0c0c0c;
	border: 1px solid #333;
	border-radius: 4px;
	padding: 16px;
	min-height: 200px;
	line-height: 1.6;
	font-size: 15px;
	white-space: pre-wrap; /* preserve line breaks from the translation */
}
.iep-pdft-placeholder {
	color: #777;
	font-style: italic;
	margin: 0;
}

.iep-pdft-status {
	margin: 12px 0 0;
	font-size: 13px;
	color: #9ad;
	min-height: 18px;
}
.iep-pdft-status.is-error {
	color: #e88;
}

/* On narrow screens, stack the panes vertically. */
@media ( max-width: 768px ) {
	.iep-pdft-panes {
		flex-direction: column;
	}
}

/* ---- Step 3: settings panel -------------------------------------------- */
.iep-pdft-toolbar-left {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
}

/* Generic small button used by Settings toggle, Show/Hide, etc. */
.iep-pdft-btn {
	padding: 8px 14px;
	border: 1px solid #666;
	border-radius: 4px;
	background: #1d1d1d;
	color: #e0e0e0;
	font-size: 14px;
	cursor: pointer;
}
.iep-pdft-btn:hover {
	background: #262626;
}

.iep-pdft-settings-wrap {
	position: relative;
}

.iep-pdft-caret {
	display: inline-block;
	font-size: 10px;
	transition: transform 0.15s ease;
}
#iep-pdft-settings-toggle[aria-expanded="true"] {
	background: #2a2a2a;
	border-color: #888;
}
#iep-pdft-settings-toggle[aria-expanded="true"] .iep-pdft-caret {
	transform: rotate(180deg);
}

.iep-pdft-settings {
	position: absolute;
	top: 100%;
	left: 0;
	margin-top: 8px;
	z-index: 60;
	width: min(560px, 92vw);
	max-height: min(70vh, 620px);
	overflow-y: auto;
	border: 1px solid #444;
	border-radius: 6px;
	background: #0c0c0c;
	padding: 16px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}
.iep-pdft-settings[hidden] {
	display: none;
}

.iep-pdft-field {
	margin-bottom: 16px;
}
.iep-pdft-field:last-of-type {
	margin-bottom: 0;
}
.iep-pdft-field > label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	color: #cfd8e3;
	margin-bottom: 6px;
}

.iep-pdft-field input[type="password"],
.iep-pdft-field input[type="text"],
.iep-pdft-field select,
.iep-pdft-field textarea {
	width: 100%;
	box-sizing: border-box;
	padding: 8px 10px;
	border: 1px solid #555;
	border-radius: 4px;
	background: #181818;
	color: #e0e0e0;
	font-size: 14px;
	font-family: inherit;
}
.iep-pdft-field textarea {
	resize: vertical;
	line-height: 1.5;
}

.iep-pdft-key-row {
	display: flex;
	gap: 8px;
}
.iep-pdft-key-row input {
	flex: 1 1 auto;
}
.iep-pdft-key-row .iep-pdft-btn {
	flex: 0 0 auto;
}

.iep-pdft-hint {
	margin: 6px 0 0;
	font-size: 12px;
	color: #888;
}
.iep-pdft-hint a {
	color: #9ad;
}

.iep-pdft-saved {
	margin: 4px 0 0;
	font-size: 13px;
	color: #7c9;
}
.iep-pdft-saved[hidden] {
	display: none;
}

/* ---- Step 4: translation pane states ----------------------------------- */
.iep-pdft-pane-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	margin-bottom: 6px;
}
.iep-pdft-pane-head .iep-pdft-pane-label {
	margin-bottom: 0;
}

.iep-pdft-btn-sm {
	padding: 4px 10px;
	font-size: 12px;
}
.iep-pdft-btn-sm[hidden] {
	display: none;
}

.iep-pdft-translation.state-placeholder,
.iep-pdft-translation.state-loading {
	color: #888;
	font-style: italic;
}
.iep-pdft-translation.state-loading {
	animation: iep-pdft-pulse 1.4s ease-in-out infinite;
}
@keyframes iep-pdft-pulse {
	0%, 100% { opacity: 1; }
	50%      { opacity: 0.5; }
}
.iep-pdft-translation.state-error {
	color: #e88;
	font-style: normal;
}
.iep-pdft-translation.state-done {
	color: #e0e0e0;
	font-style: normal;
}

/* ---- Multi-provider settings ------------------------------------------- */
.iep-pdft-field[hidden] {
	display: none;
}
.iep-pdft-privacy {
	border-left: 2px solid #456;
	padding-left: 8px;
	color: #9aa;
}
.iep-pdft-field input[type="text"] {
	width: 100%;
	box-sizing: border-box;
	padding: 8px 10px;
	border: 1px solid #555;
	border-radius: 4px;
	background: #181818;
	color: #e0e0e0;
	font-size: 14px;
	font-family: inherit;
}

/* ---- Citation + checkbox ----------------------------------------------- */
.iep-pdft-check {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 14px;
	color: #cfd8e3;
	cursor: pointer;
	user-select: none;
}
.iep-pdft-check input {
	margin: 0;
}

.iep-pdft-citation {
	border: 1px solid #333;
	border-radius: 4px;
	background: #0c0c0c;
	padding: 12px 16px;
	margin-bottom: 16px;
}
.iep-pdft-citation[hidden] {
	display: none;
}
.iep-pdft-citation-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	margin-bottom: 8px;
}
.iep-pdft-citation-title {
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #9ad;
}
.iep-pdft-citation-body {
	font-size: 14px;
	line-height: 1.6;
	white-space: pre-wrap;
	color: #e0e0e0;
}
.iep-pdft-citation-body.state-loading {
	color: #888;
	font-style: italic;
	animation: iep-pdft-pulse 1.4s ease-in-out infinite;
}
.iep-pdft-citation-body.state-error {
	color: #e88;
}

/* ---- Compare mode ------------------------------------------------------ */
.iep-pdft-sublabel {
	display: block;
	margin-top: 10px;
	font-size: 13px;
	font-weight: 600;
	color: #cfd8e3;
	margin-bottom: 6px;
}
.iep-pdft-divider {
	border: none;
	border-top: 1px solid #333;
	margin: 4px 0 14px;
}
.iep-pdft-compare-section[hidden] { display: none; }

.iep-pdft-results {
	display: flex;
	flex-direction: column;
	gap: 12px;
}
.iep-pdft-result { min-width: 0; }
.iep-pdft-result[hidden] { display: none; }
.iep-pdft-result-label {
	font-size: 12px;
	font-weight: 600;
	color: #9ad;
	margin-bottom: 4px;
}
.iep-pdft-result-label[hidden] { display: none; }

/* ---- Info modal -------------------------------------------------------- */
.iep-pdft-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}
.iep-pdft-modal[hidden] { display: none; }
.iep-pdft-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.7);
}
.iep-pdft-modal-box {
	position: relative;
	max-width: 640px;
	width: 100%;
	max-height: 85vh;
	display: flex;
	flex-direction: column;
	background: #141414;
	border: 1px solid #333;
	border-radius: 8px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}
.iep-pdft-modal-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 16px 20px;
	border-bottom: 1px solid #2a2a2a;
}
.iep-pdft-modal-head h2 {
	margin: 0;
	font-size: 18px;
	color: #fff;
}
.iep-pdft-modal-body {
	padding: 16px 20px 22px;
	overflow-y: auto;
	color: #d8d8d8;
	font-size: 14px;
	line-height: 1.6;
}
.iep-pdft-modal-body h3 {
	margin: 18px 0 6px;
	font-size: 14px;
	color: #9ad;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}
.iep-pdft-modal-body h3:first-child { margin-top: 0; }
.iep-pdft-modal-body p { margin: 0 0 8px; }
.iep-pdft-modal-body ul { margin: 0 0 8px; padding-left: 20px; }
.iep-pdft-modal-body li { margin-bottom: 6px; }
.iep-pdft-modal-body strong { color: #f0f0f0; }
