/* Smart Book Upload — frontend styles */

.sbu-upload {
	--sbu-accent: #1a5f4a;
	--sbu-accent-hover: #134836;
	--sbu-border: #d6ddd9;
	--sbu-bg: #f7f9f8;
	--sbu-text: #1c2421;
	--sbu-muted: #5c6b64;
	--sbu-danger: #a33b2d;
	--sbu-warning: #8a6d1d;
	--sbu-success: #1a5f4a;
	--sbu-info: #2c5f7c;
	--sbu-radius: 8px;
	max-width: 720px;
	margin: 1.5rem 0;
	padding: 1.5rem;
	color: var(--sbu-text);
	background:
		linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(247, 249, 248, 0.95)),
		repeating-linear-gradient(
			-12deg,
			transparent,
			transparent 10px,
			rgba(26, 95, 74, 0.03) 10px,
			rgba(26, 95, 74, 0.03) 11px
		);
	border: 1px solid var(--sbu-border);
	border-radius: var(--sbu-radius);
	box-sizing: border-box;
}

.sbu-upload *,
.sbu-upload *::before,
.sbu-upload *::after {
	box-sizing: border-box;
}

.sbu-upload__title {
	margin: 0 0 0.5rem;
	font-size: 1.5rem;
	line-height: 1.3;
	font-weight: 700;
}

.sbu-upload__description {
	margin: 0 0 1.25rem;
	color: var(--sbu-muted);
	line-height: 1.5;
}

.sbu-picker {
	display: grid;
	gap: 0.5rem;
	margin-bottom: 1.25rem;
}

.sbu-field {
	display: grid;
	gap: 0.4rem;
}

.sbu-label {
	font-weight: 600;
	font-size: 0.95rem;
}

.sbu-required {
	color: var(--sbu-danger);
	margin-left: 0.15rem;
}

.sbu-input,
.sbu-input--textarea {
	width: 100%;
	padding: 0.65rem 0.75rem;
	border: 1px solid var(--sbu-border);
	border-radius: 6px;
	background: #fff;
	color: var(--sbu-text);
	font: inherit;
	line-height: 1.4;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.sbu-input:focus,
.sbu-input--textarea:focus {
	outline: none;
	border-color: var(--sbu-accent);
	box-shadow: 0 0 0 3px rgba(26, 95, 74, 0.15);
}

.sbu-input--file {
	padding: 0.5rem;
	background: #fff;
}

.sbu-help,
.sbu-filename,
.sbu-item__filename {
	margin: 0;
	font-size: 0.875rem;
	color: var(--sbu-muted);
	word-break: break-all;
}

.sbu-progress {
	position: relative;
	margin-top: 0.75rem;
	margin-bottom: 1.1rem;
	height: 8px;
	background: #e4ebe7;
	border-radius: 999px;
	overflow: visible;
}

.sbu-progress__bar {
	position: absolute;
	left: 0;
	top: 0;
	bottom: 0;
	width: 0;
	border-radius: 999px;
	background-image: linear-gradient(90deg, var(--sbu-accent), #2d8a6e);
	transition: width 0.2s ease;
}

.sbu-progress__text {
	position: absolute;
	right: 0;
	top: calc(100% + 0.35rem);
	font-size: 0.8rem;
	color: var(--sbu-muted);
	white-space: nowrap;
}

.sbu-stack {
	display: grid;
	gap: 0.65rem;
	margin-bottom: 1.25rem;
}

.sbu-item {
	border: 1px solid var(--sbu-border);
	border-radius: 8px;
	background: #fff;
	overflow: hidden;
	box-shadow: 0 1px 0 rgba(28, 36, 33, 0.04);
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.sbu-item.is-expanded {
	border-color: rgba(26, 95, 74, 0.35);
	box-shadow: 0 4px 18px rgba(28, 36, 33, 0.06);
}

.sbu-item.is-error {
	border-color: #e7c2bb;
}

.sbu-item.is-done {
	opacity: 0.72;
}

.sbu-item__header {
	display: flex;
	align-items: stretch;
	gap: 0;
	min-height: 52px;
}

.sbu-item__toggle {
	appearance: none;
	flex: 1;
	display: grid;
	grid-template-columns: 1.25rem minmax(0, 1fr) auto;
	align-items: center;
	gap: 0.65rem;
	width: 100%;
	margin: 0;
	padding: 0.85rem 0.9rem;
	border: 0;
	background: transparent;
	color: inherit;
	font: inherit;
	text-align: left;
	cursor: pointer;
}

.sbu-item__chevron {
	width: 0.55rem;
	height: 0.55rem;
	border-right: 2px solid var(--sbu-muted);
	border-bottom: 2px solid var(--sbu-muted);
	transform: rotate(-45deg);
	transition: transform 0.18s ease;
	justify-self: center;
}

.sbu-item.is-expanded .sbu-item__chevron {
	transform: rotate(45deg);
	margin-top: -0.15rem;
}

.sbu-item__title {
	font-weight: 600;
	line-height: 1.35;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.sbu-item__meta {
	font-size: 0.8rem;
	color: var(--sbu-muted);
	white-space: nowrap;
}

.sbu-item.is-ready .sbu-item__meta {
	color: var(--sbu-success);
}

.sbu-item.is-error .sbu-item__meta {
	color: var(--sbu-danger);
}

.sbu-item.is-uploading .sbu-item__meta {
	color: var(--sbu-info);
}

.sbu-item__remove {
	appearance: none;
	border: 0;
	border-left: 1px solid var(--sbu-border);
	background: transparent;
	color: var(--sbu-muted);
	width: 2.75rem;
	font-size: 1.35rem;
	line-height: 1;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}

.sbu-item__remove:hover {
	background: #fceeed;
	color: var(--sbu-danger);
}

.sbu-item__body {
	display: none;
	padding: 0 1rem 1rem;
	border-top: 1px solid var(--sbu-border);
	background: linear-gradient(180deg, #fbfcfb, #fff);
}

.sbu-item.is-expanded .sbu-item__body {
	display: grid;
	gap: 0.85rem;
	animation: sbu-expand 0.18s ease;
}

@keyframes sbu-expand {
	from {
		opacity: 0.35;
		transform: translateY(-4px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.sbu-item__fields {
	display: grid;
	gap: 0.85rem;
}

.sbu-item__msg {
	margin: 0;
}

.sbu-item__progress .sbu-progress {
	margin-top: 0.85rem;
	margin-bottom: 1rem;
}

.sbu-actions {
	display: flex;
	align-items: center;
	gap: 0.85rem;
	flex-wrap: wrap;
}

.sbu-queue-count {
	font-size: 0.9rem;
	color: var(--sbu-muted);
}

.sbu-button {
	appearance: none;
	border: none;
	border-radius: 6px;
	padding: 0.7rem 1.25rem;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	background: var(--sbu-accent);
	color: #fff;
	transition: background 0.15s ease, opacity 0.15s ease, transform 0.1s ease;
}

.sbu-button:hover:not(:disabled) {
	background: var(--sbu-accent-hover);
}

.sbu-button:active:not(:disabled) {
	transform: translateY(1px);
}

.sbu-button:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

.sbu-messages {
	margin-bottom: 1rem;
}

.sbu-notice {
	padding: 0.75rem 1rem;
	border-radius: 6px;
	border: 1px solid transparent;
	font-size: 0.95rem;
	line-height: 1.45;
}

.sbu-notice--success {
	background: #e8f5ef;
	border-color: #b7dcc9;
	color: var(--sbu-success);
}

.sbu-notice--error {
	background: #fceeed;
	border-color: #e7c2bb;
	color: var(--sbu-danger);
}

.sbu-notice--warning {
	background: #fbf6e6;
	border-color: #e6d7a8;
	color: var(--sbu-warning);
}

.sbu-notice--info {
	background: #eaf3f8;
	border-color: #b9d2e0;
	color: var(--sbu-info);
}

@media (max-width: 600px) {
	.sbu-upload {
		padding: 1rem;
		margin: 1rem 0;
	}

	.sbu-upload__title {
		font-size: 1.25rem;
	}

	.sbu-button {
		width: 100%;
	}

	.sbu-item__toggle {
		grid-template-columns: 1rem minmax(0, 1fr);
		grid-template-rows: auto auto;
	}

	.sbu-item__meta {
		grid-column: 2;
	}

	.sbu-item__title {
		white-space: normal;
	}
}
