/**
 * Point Shop frontend stylesheet
 * jauntym/pointshop v1.0.0
 */

/* === Common wrappers === */
.pointshop-wrap { max-width: 1100px; margin: 0 auto; }
.pointshop-balance {
	font-size: 1.1em;
	padding: 10px 15px;
	background: rgba(0,0,0,0.05);
	border-radius: 4px;
	margin-bottom: 20px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px;
}
.pointshop-balance strong { color: #c01818; font-size: 1.2em; }
.pointshop-balance.pointshop-guest-notice { background: #fff8e1; border: 1px solid #f5c542; color: #555; }
.pointshop-back { display: inline-block; margin-bottom: 15px; }

/* === Section dividers === */
.pointshop-section-title {
	margin-top: 25px;
	margin-bottom: 15px;
	padding-bottom: 5px;
	border-bottom: 2px solid #c01818;
}

/* === Categories grid (shop home) === */
.pointshop-categories {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 15px;
}
.pointshop-cat-card {
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 6px;
	padding: 18px;
	transition: box-shadow 0.2s, transform 0.2s;
}
.pointshop-cat-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); transform: translateY(-2px); }
.pointshop-cat-card h3 { margin: 0 0 6px 0; }
.pointshop-cat-card h3 a { text-decoration: none; }
.pointshop-cat-card .desc { color: #666; font-size: 0.9em; margin-bottom: 8px; }
.pointshop-cat-card .count { font-size: 0.85em; color: #999; }

/* === Items grid === */
.pointshop-items {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
	gap: 15px;
}
.pointshop-item-card {
	background: #fff;
	border: 2px solid #ddd;
	border-radius: 6px;
	padding: 14px;
	text-align: center;
	position: relative;
	transition: transform 0.2s, box-shadow 0.2s;
}
.pointshop-item-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.pointshop-item-card.rarity-rare { border-color: #4a90e2; }
.pointshop-item-card.rarity-epic { border-color: #9b51e0; }
.pointshop-item-card.rarity-legendary { border-color: #f5a623; box-shadow: 0 0 8px rgba(245, 166, 35, 0.3); }
.pointshop-item-card img { max-width: 100px; max-height: 100px; margin-bottom: 10px; }
.pointshop-item-card h4 { margin: 5px 0; font-size: 1em; }
.pointshop-item-card h4 a { text-decoration: none; }
.pointshop-item-card .price { font-weight: bold; color: #c01818; font-size: 1.1em; margin: 8px 0; }
.pointshop-item-card .price.cant-afford { color: #999; text-decoration: line-through; }
.pointshop-item-card .stock { font-size: 0.85em; color: #666; }
.pointshop-item-card .stock.low { color: #d9534f; font-weight: bold; }
.pointshop-item-card .rarity-label {
	font-size: 0.72em;
	text-transform: uppercase;
	letter-spacing: 1px;
	opacity: 0.7;
}

/* === Item card badges === */
.pointshop-item-card .badge {
	position: absolute;
	top: 6px;
	padding: 3px 8px;
	border-radius: 12px;
	font-size: 0.68em;
	font-weight: bold;
	text-transform: uppercase;
	z-index: 2;
}
.pointshop-item-card .badge.owned { background: #5cb85c; color: white; right: 6px; }
.pointshop-item-card .badge.oos { background: #888; color: white; right: 6px; }
.pointshop-item-card .badge.featured { background: #f5a623; color: white; left: 6px; }
.pointshop-item-card .badge.hot { background: #d9534f; color: white; left: 6px; top: 28px; }

/* === Item detail page === */
.pointshop-detail {
	max-width: 720px;
	margin: 0 auto;
	background: #fff;
	border: 2px solid #ddd;
	border-radius: 8px;
	padding: 30px;
}
.pointshop-detail.rarity-rare { border-color: #4a90e2; }
.pointshop-detail.rarity-epic { border-color: #9b51e0; }
.pointshop-detail.rarity-legendary { border-color: #f5a623; box-shadow: 0 0 12px rgba(245, 166, 35, 0.3); }
.pointshop-detail .img-wrap { text-align: center; margin-bottom: 20px; }
.pointshop-detail img { max-width: 200px; max-height: 200px; }
.pointshop-detail h2 { margin: 0 0 5px 0; text-align: center; }
.pointshop-detail .rarity-label {
	text-align: center;
	text-transform: uppercase;
	letter-spacing: 2px;
	font-size: 0.85em;
	opacity: 0.7;
}
.pointshop-detail .price { font-size: 2em; font-weight: bold; color: #c01818; margin: 15px 0; text-align: center; }
.pointshop-detail .description { background: #f9f9f9; padding: 15px; border-radius: 4px; margin: 15px 0; line-height: 1.5; }
.pointshop-detail .stats {
	display: flex;
	justify-content: space-around;
	padding: 10px 0;
	border-top: 1px solid #eee;
	border-bottom: 1px solid #eee;
	margin: 15px 0;
}
.pointshop-detail .stats .value { font-weight: bold; font-size: 1.2em; }
.pointshop-detail .stats .label { font-size: 0.85em; color: #666; }
.pointshop-detail .actions { text-align: center; margin-top: 20px; }
.pointshop-detail .actions .button { margin: 4px; padding: 10px 25px; font-size: 1em; }
.pointshop-detail .balance-note { text-align: center; color: #666; margin-top: 10px; font-size: 0.9em; }
.pointshop-detail .balance-note .insufficient { color: #d9534f; font-weight: bold; }
.pointshop-detail .feature-flags { text-align: center; margin: 8px 0; }
.pointshop-detail .feature-flags .pill {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 12px;
	font-size: 0.75em;
	margin: 2px;
	font-weight: bold;
	text-transform: uppercase;
}
.pointshop-detail .feature-flags .pill.featured { background: #f5a623; color: white; }
.pointshop-detail .feature-flags .pill.hot { background: #d9534f; color: white; }

/* === Inventory page === */
.pointshop-inv-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: 15px;
}
.pointshop-inv-card {
	background: #fff;
	border: 2px solid #ddd;
	border-radius: 6px;
	padding: 12px;
	text-align: center;
	position: relative;
}
.pointshop-inv-card.rarity-rare { border-color: #4a90e2; }
.pointshop-inv-card.rarity-epic { border-color: #9b51e0; }
.pointshop-inv-card.rarity-legendary { border-color: #f5a623; }
.pointshop-inv-card.equipped { background: #f0f8e8; border-color: #5cb85c; }
.pointshop-inv-card img { max-width: 80px; max-height: 80px; margin-bottom: 8px; }
.pointshop-inv-card h4 { margin: 4px 0; font-size: 0.95em; }
.pointshop-inv-card .meta { font-size: 0.8em; color: #888; margin: 4px 0; }
.pointshop-inv-card .gift-from { font-size: 0.8em; color: #c01818; margin: 4px 0; font-style: italic; }
.pointshop-inv-card .actions { margin-top: 8px; }
.pointshop-inv-card .actions a { font-size: 0.85em; padding: 5px 12px; }
.pointshop-equipped-flag {
	position: absolute;
	top: 5px;
	right: 5px;
	background: #5cb85c;
	color: white;
	padding: 3px 8px;
	border-radius: 12px;
	font-size: 0.7em;
	font-weight: bold;
}
.pointshop-empty {
	text-align: center;
	padding: 40px;
	background: #f9f9f9;
	border-radius: 6px;
}
.pointshop-empty a { font-weight: bold; }

/* === Featured items section on shop home === */
.pointshop-featured-banner {
	background: linear-gradient(135deg, #fff5e1, #ffe9c4);
	border: 1px solid #f5a623;
	border-radius: 8px;
	padding: 18px;
	margin-bottom: 20px;
}
.pointshop-featured-banner h3 {
	color: #c5740a;
	margin: 0 0 12px 0;
}

/* === Activity feed === */
.pointshop-activity {
	background: #f9f9f9;
	border: 1px solid #e3e3e3;
	border-radius: 6px;
	padding: 12px 18px;
	margin-top: 25px;
}
.pointshop-activity h3 { margin: 0 0 10px 0; font-size: 1em; color: #555; }
.pointshop-activity ul { list-style: none; margin: 0; padding: 0; }
.pointshop-activity li {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 6px 0;
	border-bottom: 1px dashed rgba(0,0,0,0.05);
	font-size: 0.9em;
}
.pointshop-activity li:last-child { border-bottom: none; }
.pointshop-activity img {
	width: 28px;
	height: 28px;
	border-radius: 4px;
	border: 1px solid #ddd;
	background: white;
	padding: 2px;
}
.pointshop-activity .when { color: #999; font-size: 0.85em; margin-left: auto; }

/* === Gift form === */
.pointshop-gift-form {
	max-width: 600px;
	margin: 0 auto;
	background: #fff;
	border: 2px solid #ddd;
	border-radius: 8px;
	padding: 25px;
}
.pointshop-gift-form .item-preview {
	display: flex;
	align-items: center;
	gap: 15px;
	background: #f9f9f9;
	padding: 12px;
	border-radius: 6px;
	margin-bottom: 20px;
}
.pointshop-gift-form .item-preview img { max-width: 80px; max-height: 80px; }
.pointshop-gift-form label { display: block; font-weight: bold; margin: 12px 0 5px 0; }
.pointshop-gift-form input[type="text"],
.pointshop-gift-form textarea {
	width: 100%;
	box-sizing: border-box;
	padding: 8px;
	border: 1px solid #ccc;
	border-radius: 4px;
	font-family: inherit;
}
.pointshop-gift-form .help-text { font-size: 0.85em; color: #777; margin-top: 4px; }
.pointshop-gift-form .actions { margin-top: 20px; text-align: center; }
.pointshop-gift-form .error {
	background: #fbe5e5;
	border: 1px solid #e88;
	color: #a22;
	padding: 10px;
	border-radius: 4px;
	margin-bottom: 15px;
}

/* === Equipped icons (under username in viewtopic, on profile) === */
/* Icon sizes driven by CSS variables; set via inline <style> from config.
   Value 'auto' means natural image size (no forced width/height). */
:root {
	--pointshop-icon-size: auto;
	--pointshop-icon-size-mobile: auto;
}
.pointshop-equipped-wrap {
	margin: 6px 0 0 0;
	text-align: center;
}
.pointshop-equipped {
	display: inline-flex;
	flex-wrap: wrap;
	gap: 4px;
	justify-content: center;
	align-items: center;
	max-width: 100%;
}
.pointshop-icon {
	/* When the variable is 'none', width/height are ignored (natural size).
	   When it's a px value, the icon is constrained to that size. */
	width: var(--pointshop-icon-size);
	height: var(--pointshop-icon-size);
	max-width: 100%;
	object-fit: contain;
	border-radius: 4px;
	padding: 1px;
	background: rgba(255,255,255,0.05);
	border: 1px solid #ccc;
	vertical-align: middle;
	box-sizing: border-box;
}
.pointshop-icon.pointshop-rarity-rare {
	border-color: #4a90e2;
	box-shadow: 0 0 3px rgba(74,144,226,0.4);
}
.pointshop-icon.pointshop-rarity-epic {
	border-color: #9b51e0;
	box-shadow: 0 0 4px rgba(155,81,224,0.5);
}
.pointshop-icon.pointshop-rarity-legendary {
	border-color: #f5a623;
	box-shadow: 0 0 6px rgba(245,166,35,0.7);
}
.pointshop-icon.pointshop-icon-featured {
	outline: 1px solid #f5a623;
	outline-offset: 1px;
}

/* "+N" overflow badge — clickable to open the inventory popup */
.pointshop-icon-more {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 24px;
	min-height: 24px;
	padding: 0 6px;
	border-radius: 4px;
	background: #333;
	color: #fff;
	font-size: 0.75em;
	font-weight: bold;
	cursor: pointer;
	user-select: none;
	box-sizing: border-box;
	border: 1px solid #555;
	transition: background-color 0.15s;
	/* Mobile tap reliability: remove 300ms delay, signal interactivity */
	touch-action: manipulation;
	-webkit-tap-highlight-color: rgba(0,0,0,0.15);
}
.pointshop-icon-more:hover {
	background: #555;
}

.postprofile .pointshop-equipped-wrap {
	padding-top: 4px;
	margin-top: 4px;
	border-top: 1px dashed rgba(0,0,0,0.1);
}

/* +N badge visibility: desktop badge shows on desktop, mobile badge shows on mobile.
   The per-breakpoint icon hiding (nth-of-type) is injected inline from config. */
.pointshop-icon-more-mobile {
	display: none;	/* hidden on desktop */
}
.pointshop-icon-more-desktop {
	display: inline-flex;	/* shown on desktop */
}

@media (max-width: 700px) {
	/* On mobile, apply the mobile icon size (may be 'none' for natural) */
	.pointshop-icon {
		width: var(--pointshop-icon-size-mobile);
		height: var(--pointshop-icon-size-mobile);
	}
	/* Swap which +N badge is visible */
	.pointshop-icon-more-desktop {
		display: none;
	}
	.pointshop-icon-more-mobile {
		display: inline-flex;
	}
}

/* Popup modal for showing all equipped icons when "+N" is clicked */
.pointshop-icons-modal {
	position: fixed;
	inset: 0;
	background: rgba(0,0,0,0.6);
	z-index: 9999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	animation: pointshop-modal-fade 0.15s ease-out;
}
@keyframes pointshop-modal-fade {
	from { opacity: 0; }
	to { opacity: 1; }
}
.pointshop-icons-modal-content {
	background: #fff;
	border-radius: 8px;
	max-width: 500px;
	width: 100%;
	max-height: 80vh;
	overflow-y: auto;
	padding: 20px;
	box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}
.pointshop-icons-modal-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 15px;
	padding-bottom: 10px;
	border-bottom: 1px solid #eee;
}
.pointshop-icons-modal-header h3 {
	margin: 0;
	font-size: 1.1em;
}
.pointshop-icons-modal-close {
	background: none;
	border: none;
	font-size: 1.5em;
	cursor: pointer;
	color: #888;
	padding: 0 8px;
	line-height: 1;
}
.pointshop-icons-modal-close:hover {
	color: #333;
}
.pointshop-icons-modal-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
	gap: 10px;
}
.pointshop-icons-modal-item {
	text-align: center;
	padding: 8px;
	border: 1px solid #eee;
	border-radius: 4px;
	background: #fafafa;
}
.pointshop-icons-modal-item img {
	width: 40px;
	height: 40px;
	object-fit: contain;
}
.pointshop-icons-modal-item .name {
	font-size: 0.78em;
	margin-top: 4px;
	color: #333;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.pointshop-icons-modal-item.rarity-rare { border-color: #4a90e2; }
.pointshop-icons-modal-item.rarity-epic { border-color: #9b51e0; }
.pointshop-icons-modal-item.rarity-legendary { border-color: #f5a623; }

/* === Disabled-looking buttons === */
.pointshop-disabled-btn {
	display: inline-block;
	padding: 6px 14px;
	background: #ddd;
	color: #888;
	border-radius: 4px;
	cursor: not-allowed;
}

/* === Fulfillment workflow (v1.4) === */
.pointshop-pending-fulfillment {
	margin-top: 8px;
	padding: 10px;
	background: #fff8e1;
	border: 1px solid #f5c542;
	border-radius: 4px;
	color: #6b4f0a;
	font-size: 0.9em;
}
.pointshop-pending-badge {
	display: inline-block;
	background: #d4a017;
	color: #fff;
	padding: 3px 8px;
	border-radius: 3px;
	font-weight: bold;
	margin-bottom: 5px;
}
.pointshop-fulfillment-details {
	margin-top: 8px;
	padding-top: 8px;
	border-top: 1px solid #f5c542;
	font-size: 0.85em;
}
.pointshop-fulfillment-details .meta { margin: 2px 0; }

/* === Cancelled orders (v1.5) === */
.pointshop-cancelled-order {
	margin-top: 8px;
	padding: 10px;
	background: #fdecea;
	border: 1px solid #f5b7b1;
	border-radius: 4px;
	color: #722a26;
	font-size: 0.9em;
}
.pointshop-cancelled-badge {
	display: inline-block;
	background: #c01818;
	color: #fff;
	padding: 3px 8px;
	border-radius: 3px;
	font-weight: bold;
	margin-bottom: 5px;
}
.pointshop-cancel-reason {
	margin-top: 8px;
	padding: 6px 8px;
	background: rgba(255,255,255,0.6);
	border-radius: 3px;
}
.pointshop-cancel-reason .reason-text {
	font-style: italic;
	margin-top: 3px;
	color: #5a1f1c;
}
.pointshop-dismiss-btn {
	margin-top: 8px;
	font-size: 0.85em;
}
.pointshop-inv-card.cancelled-order {
	opacity: 0.85;
}

/* === Basket (v1.5) === */
.pointshop-basket-table {
	width: 100%;
	border-collapse: collapse;
	margin: 20px 0;
}
.pointshop-basket-table th,
.pointshop-basket-table td {
	padding: 10px;
	border-bottom: 1px solid #ddd;
	text-align: left;
	vertical-align: middle;
}
.pointshop-basket-table th { background: #f4f4f4; }
.pointshop-basket-table .item-img {
	max-width: 50px;
	max-height: 50px;
	vertical-align: middle;
	margin-right: 8px;
}
.pointshop-basket-total-row {
	font-weight: bold;
	font-size: 1.05em;
	background: #f9f9f9;
}
.pointshop-basket-total-row .cant-afford { color: #c01818; }
.pointshop-basket-actions {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
	margin: 15px 0;
}
.pointshop-basket-checkout-form {
	margin-top: 20px;
	padding: 15px;
	background: #f4f7fb;
	border: 1px solid #d0d9e6;
	border-radius: 4px;
}
.pointshop-basket-checkout-form label {
	display: block;
	margin-top: 10px;
	font-weight: bold;
}
.pointshop-basket-checkout-form input[type="text"] {
	width: 100%;
	padding: 8px;
	box-sizing: border-box;
	max-width: 400px;
}
.pointshop-basket-checkout-form .help-text {
	font-size: 0.85em;
	color: #666;
	margin-top: 2px;
}

/* === Post-checkout message === */
.pointshop-post-checkout-message {
	margin: 15px 0;
	padding: 12px 15px;
	background: #e8f5e9;
	border: 1px solid #81c784;
	border-radius: 4px;
	color: #1b5e20;
}

/* === Category images (v1.5) === */
.pointshop-category-card-image {
	display: block;
	width: 100%;
	max-width: 100%;
	max-height: 120px;
	height: auto;
	margin-bottom: 8px;
	border-radius: 4px;
	object-fit: contain;
}
.pointshop-category-header-image {
	max-width: 100%;
	max-height: 200px;
	height: auto;
	margin: 0 auto 15px;
	display: block;
	border-radius: 6px;
	object-fit: contain;
}

/* === v1.6 — Form intro note === */
.pointshop-form-note {
	margin: 12px 0;
	padding: 10px 14px;
	background: #fff3cd;
	border-left: 4px solid #ffc107;
	border-radius: 3px;
	color: #856404;
	font-size: 0.95em;
}

/* === v1.6 — List/table view of inventory === */
.pointshop-inv-list {
	width: 100%;
	border-collapse: collapse;
	margin-top: 15px;
}
.pointshop-inv-list th,
.pointshop-inv-list td {
	padding: 10px 12px;
	border-bottom: 1px solid #ddd;
	text-align: left;
	vertical-align: middle;
}
.pointshop-inv-list th {
	background: #f4f4f4;
	font-weight: bold;
}
.pointshop-inv-list .status-pending { color: #856404; font-weight: bold; }
.pointshop-inv-list .status-delivered { color: #155724; }
.pointshop-inv-list .status-cancelled { color: #721c24; }
.pointshop-inv-list .status-normal { color: #555; }
.pointshop-inv-list .row-cancelled { background: #fdecea; }
.pointshop-inv-list .row-pending { background: #fffbea; }
