/* A class-based `display:` rule anywhere below (e.g. `.wcpo-toast{display:flex}`,
   `.wcpo-btn{display:inline-flex}`) has the same specificity as the
   browser's own `[hidden]{display:none}` rule, and — being later in this
   stylesheet — was winning the tie, so toggling an element's `hidden`
   property from JS (the toast's auto-timeout, its × button, add-more
   button, etc.) silently failed to actually hide it. This single rule
   guarantees `hidden` always wins, for every element in this widget.
*/
.wcpo-widget [hidden] { display: none !important; }

.wcpo-widget {
	--wcpo-yellow: #f5b400;
	--wcpo-yellow-dark: #d99a00;
	--wcpo-ink: #1f2430;
	--wcpo-muted: #6b7280;
	--wcpo-border: #e6e6ea;
	--wcpo-bg-soft: #fafafa;
	--wcpo-green: #14b866;
	--wcpo-red: #e14b4b;
	--wcpo-radius: 14px;

	max-width: 640px;
	margin: 0 auto;
	font-family: inherit;
	color: var(--wcpo-ink);
	box-sizing: border-box;
}
.wcpo-widget *, .wcpo-widget *::before, .wcpo-widget *::after {
	box-sizing: border-box;
}

/* Dropzone */
.wcpo-dropzone {
	border: 1.5px dashed var(--wcpo-border);
	border-radius: var(--wcpo-radius);
	background: var(--wcpo-bg-soft);
	padding: 36px 20px;
	text-align: center;
	margin-bottom: 16px;
	transition: border-color .15s ease, background-color .15s ease;
}
.wcpo-dropzone--drag {
	border-color: var(--wcpo-yellow);
	background: #fff8e6;
}
.wcpo-dropzone__icon { font-size: 30px; margin-bottom: 6px; opacity: .55; }
.wcpo-dropzone__text { margin: 0 0 16px; color: var(--wcpo-muted); font-size: 15px; }

/* Buttons */
.wcpo-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	border: none;
	border-radius: 10px;
	padding: 12px 20px;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	transition: filter .12s ease, transform .05s ease;
}
.wcpo-btn:active { transform: scale(0.98); }
.wcpo-btn--primary {
	background: var(--wcpo-yellow);
	color: #241a00;
}
.wcpo-btn--primary:hover { filter: brightness(1.06); }
.wcpo-btn--primary:disabled { background: #f0d18a; cursor: not-allowed; }
.wcpo-btn--outline {
	background: #fff;
	border: 1.5px solid var(--wcpo-border);
	color: var(--wcpo-ink);
}
.wcpo-btn--outline:hover { border-color: var(--wcpo-yellow-dark); }
.wcpo-btn--text { background: transparent; color: var(--wcpo-muted); text-decoration: underline; padding: 10px 20px; }
.wcpo-btn--block { width: 100%; }
.wcpo-btn--large { padding: 15px 20px; font-size: 16px; }
a.wcpo-btn { text-decoration: none; }

/* Persistent order-confirmation panel */
.wcpo-order-success {
	text-align: center;
	padding: 34px 20px;
	border: 1px solid var(--wcpo-border);
	border-radius: var(--wcpo-radius);
	background: #fff;
}
.wcpo-order-success__icon { font-size: 40px; line-height: 1; margin-bottom: 10px; }
.wcpo-order-success__title { font-size: 18px; margin: 0 0 8px; }
.wcpo-order-success__note { color: var(--wcpo-muted); font-size: 14px; margin: 0 0 22px; }
.wcpo-order-success__actions { display: flex; flex-direction: column; gap: 10px; max-width: 320px; margin: 0 auto; }

.wcpo-icon-btn {
	border: none;
	background: transparent;
	font-size: 16px;
	cursor: pointer;
	color: var(--wcpo-muted);
	width: 32px;
	height: 32px;
	border-radius: 8px;
	flex-shrink: 0;
}
.wcpo-icon-btn:hover { background: var(--wcpo-bg-soft); }
.wcpo-icon-btn--danger { color: var(--wcpo-red); }

/* File list & cards */
.wcpo-file-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }

.wcpo-file-card {
	border: 1px solid var(--wcpo-border);
	border-radius: var(--wcpo-radius);
	padding: 14px 16px;
	background: #fff;
}

.wcpo-file-card__row {
	display: flex;
	align-items: center;
	gap: 10px;
}
.wcpo-file-card__row--header { margin-bottom: 10px; }
.wcpo-file-card__row--footer {
	justify-content: space-between;
	margin-top: 10px;
	padding-top: 10px;
	border-top: 1px dashed var(--wcpo-border);
}
.wcpo-file-card__name {
	flex: 1;
	font-weight: 600;
	font-size: 14.5px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.wcpo-file-card__filetag { font-size: 20px; flex-shrink: 0; }
.wcpo-file-card__pages {
	font-size: 12.5px;
	color: var(--wcpo-muted);
	background: var(--wcpo-bg-soft);
	border-radius: 20px;
	padding: 3px 10px;
	flex-shrink: 0;
	white-space: nowrap;
}
.wcpo-file-card__meta { flex: 1; min-width: 0; }
.wcpo-file-card__specs { font-size: 12.5px; color: var(--wcpo-muted); margin-top: 2px; }
.wcpo-file-card__actions { display: flex; gap: 2px; }
.wcpo-file-card__price { font-weight: 700; color: var(--wcpo-ink); }

/* Uploading state */
.wcpo-progress {
	height: 8px;
	border-radius: 20px;
	background: var(--wcpo-border);
	overflow: hidden;
	margin-top: 10px;
}
.wcpo-progress__bar {
	height: 100%;
	background: var(--wcpo-green);
	border-radius: 20px;
	transition: width .15s ease;
	width: 0%;
}
.wcpo-progress__pct {
	text-align: center;
	font-size: 12px;
	color: var(--wcpo-muted);
	margin-top: 6px;
}
.wcpo-progress__note {
	text-align: center;
	font-size: 12px;
	color: var(--wcpo-ink);
	margin-top: 4px;
}
.wcpo-processing-hint {
	background: #fff8e6;
	border: 1px solid #f0dca0;
	color: #7a5b00;
	border-radius: var(--wcpo-radius);
	padding: 10px 14px;
	font-size: 12.5px;
	line-height: 1.8;
	margin-bottom: 12px;
}
.wcpo-file-card--uploading .wcpo-file-card__pages:empty { display: none; }

/* Manual page count prompt */
.wcpo-manual-pagecount {
	background: #fff6e0;
	border: 1px solid #f0dca0;
	border-radius: 10px;
	padding: 10px 12px;
	margin-bottom: 12px;
	font-size: 13px;
}
.wcpo-manual-pagecount label { display: block; margin-bottom: 6px; color: #7a5c00; }
.wcpo-manual-pagecount input {
	width: 100%;
	padding: 8px 10px;
	border-radius: 8px;
	border: 1px solid var(--wcpo-border);
	font-size: 14px;
}

/* Accordion */
.wcpo-accordion__item {
	border: 1px solid var(--wcpo-border);
	border-radius: 12px;
	margin-bottom: 8px;
	overflow: hidden;
}
.wcpo-accordion__head {
	width: 100%;
	display: flex;
	align-items: center;
	gap: 10px;
	background: var(--wcpo-bg-soft);
	border: none;
	padding: 12px 14px;
	cursor: pointer;
	text-align: right;
	font-size: 14px;
}
.wcpo-accordion__title { font-weight: 600; white-space: nowrap; }
.wcpo-accordion__subtitle { flex: 1; color: var(--wcpo-muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wcpo-accordion__chevron { transition: transform .15s ease; color: var(--wcpo-muted); }
.wcpo-accordion__item--open .wcpo-accordion__chevron { transform: rotate(180deg); }
.wcpo-accordion__body {
	display: none;
	padding: 12px 14px;
	flex-direction: column;
	gap: 10px;
}
.wcpo-accordion__item--open .wcpo-accordion__body { display: flex; }

.wcpo-radio {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	cursor: pointer;
}
.wcpo-radio input { accent-color: var(--wcpo-yellow-dark); width: 17px; height: 17px; flex-shrink: 0; }

/* Copies stepper */
.wcpo-copies-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 4px;
	font-size: 14px;
	font-weight: 600;
}
.wcpo-stepper { display: flex; align-items: center; gap: 8px; }
.wcpo-stepper button {
	width: 30px; height: 30px;
	border-radius: 8px;
	border: 1px solid var(--wcpo-border);
	background: #fff;
	font-size: 16px;
	cursor: pointer;
}
.wcpo-stepper input {
	width: 48px;
	text-align: center;
	border: 1px solid var(--wcpo-border);
	border-radius: 8px;
	padding: 6px 4px;
	font-size: 14px;
}

/* Price box */
.wcpo-price-box {
	background: var(--wcpo-bg-soft);
	border-radius: 10px;
	padding: 10px 14px;
	margin: 8px 0 14px;
	font-size: 13.5px;
}
.wcpo-price-box__row { display: flex; justify-content: space-between; padding: 3px 0; color: var(--wcpo-muted); }
.wcpo-price-box__row--total { color: var(--wcpo-ink); font-weight: 700; font-size: 15px; border-top: 1px dashed var(--wcpo-border); margin-top: 4px; padding-top: 8px; }

/* Description textarea */
.wcpo-description-field { margin-bottom: 12px; }
.wcpo-description-field label { display: block; font-size: 13px; color: var(--wcpo-muted); margin-bottom: 6px; }
.wcpo-description-field textarea {
	width: 100%;
	border: 1px solid var(--wcpo-border);
	border-radius: 10px;
	padding: 9px 12px;
	font-size: 13.5px;
	font-family: inherit;
	resize: vertical;
}

/* Discount code */
.wcpo-discount-row { display: flex; gap: 8px; margin-bottom: 8px; }
.wcpo-discount-row input {
	flex: 1;
	border: 1px solid var(--wcpo-border);
	border-radius: 10px;
	padding: 10px 12px;
	font-size: 14px;
}
.wcpo-discount-status {
	font-size: 12.5px;
	margin-bottom: 10px;
	padding: 6px 10px;
	border-radius: 8px;
}
.wcpo-discount-status--ok { background: #e7f8ef; color: #0d7a44; }
.wcpo-discount-status--error { background: #fdecec; color: var(--wcpo-red); }

/* Order summary breakdown */
.wcpo-summary-box {
	background: var(--wcpo-bg-soft);
	border-radius: 10px;
	padding: 10px 14px;
	margin-bottom: 12px;
	font-size: 13.5px;
}
.wcpo-summary-box__row { display: flex; justify-content: space-between; padding: 3px 0; color: var(--wcpo-muted); }
.wcpo-summary-box__note { font-size: 11.5px; color: var(--wcpo-muted); margin: 8px 0 0; line-height: 1.7; }

/* Order footer — the detailed breakdown (discount code + line items)
   stays in the page's normal flow, right after the file list, so it
   never covers the upload area. Only the slim total+button bar below
   is fixed to the viewport. */
.wcpo-order-footer {
	background: #fff;
	border: 1px solid var(--wcpo-border);
	border-radius: var(--wcpo-radius);
	padding: 14px 16px;
	margin-top: 8px;
}
.wcpo-order-footer__spacer { height: 76px; }

/* Slim floating total + submit bar */
.wcpo-sticky-bar {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 999;
	background: #fff;
	border-top: 1px solid var(--wcpo-border);
	box-shadow: 0 -4px 14px rgba(0,0,0,.08);
	padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
}
.wcpo-sticky-bar__inner {
	max-width: 640px;
	margin: 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}
.wcpo-sticky-bar__total { display: flex; flex-direction: column; line-height: 1.3; }
.wcpo-sticky-bar__label { font-size: 12px; color: var(--wcpo-muted); }
.wcpo-sticky-bar #wcpo-grand-total { font-size: 17px; font-weight: 800; }
.wcpo-sticky-bar .wcpo-btn { white-space: nowrap; }

/* Toast */
.wcpo-toast {
	position: fixed;
	bottom: 90px; /* clears the slim floating total/submit bar */
	left: 50%;
	transform: translateX(-50%);
	background: var(--wcpo-ink);
	color: #fff;
	padding: 12px 20px;
	border-radius: 30px;
	font-size: 13.5px;
	z-index: 9999;
	box-shadow: 0 6px 20px rgba(0,0,0,.2);
	display: flex;
	align-items: center;
	gap: 10px;
}
.wcpo-toast--error { background: var(--wcpo-red); }
.wcpo-toast a { color: #ffd76b; font-weight: 700; text-decoration: underline; }
.wcpo-toast__msg { line-height: 1.6; }
.wcpo-toast__close {
	background: rgba(255,255,255,.18);
	border: none;
	color: #fff;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	line-height: 1;
	font-size: 15px;
	cursor: pointer;
	flex: none;
}

.wcpo-qty-locked { color: var(--wcpo-muted); font-size: 13px; }

@media (max-width: 480px) {
	.wcpo-widget { max-width: 100%; }
	.wcpo-dropzone { padding: 26px 14px; }
}
