/* Category Accordion for WooCommerce - settings page */
body.woocommerce_page_tpcafw-settings {
	background: #f5f6fa;
}

.tpa-wrap {
	--tpa-primary: #4f46e5;
	--tpa-primary-dark: #4338ca;
	--tpa-text: #111827;
	--tpa-muted: #6b7280;
	--tpa-border: #e5e7eb;
	--tpa-bg: #fff;
	--tpa-radius: 14px;
	max-width: 1180px;
	margin: 20px 20px 0 0;
	color: var(--tpa-text);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}

.tpa-wrap * {
	box-sizing: border-box;
}

/* Hero */
.tpa-hero {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 24px 28px;
	border-radius: var(--tpa-radius);
	background: linear-gradient(120deg, #4f46e5 0%, #7c3aed 100%);
	color: #fff;
	box-shadow: 0 10px 30px rgba(79, 70, 229, 0.25);
}

.tpa-hero-main {
	display: flex;
	align-items: center;
	gap: 16px;
}

.tpa-logo {
	display: grid;
	place-items: center;
	width: 52px;
	height: 52px;
	border-radius: 14px;
	background: rgba(255, 255, 255, 0.18);
}

.tpa-logo .dashicons {
	width: 28px;
	height: 28px;
	font-size: 28px;
}

.tpa-hero h2 {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0;
	padding: 0;
	color: #fff;
	font-size: 22px;
	font-weight: 700;
	line-height: 1.2;
}

.tpa-hero p {
	margin: 4px 0 0;
	color: rgba(255, 255, 255, 0.85);
	font-size: 14px;
}

.tpa-pill {
	padding: 2px 10px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.22);
	font-size: 12px;
	font-weight: 600;
}

.tpa-hero-links {
	display: flex;
	gap: 8px;
}

.tpa-hero-links a {
	padding: 8px 14px;
	border-radius: 10px;
	background: rgba(255, 255, 255, 0.16);
	color: #fff;
	font-size: 13px;
	font-weight: 600;
	text-decoration: none;
	transition: background 0.15s;
}

.tpa-hero-links a:hover,
.tpa-hero-links a:focus {
	background: rgba(255, 255, 255, 0.3);
	color: #fff;
}

/* Toast */
.tpa-toast {
	position: fixed;
	top: 48px;
	right: 24px;
	z-index: 9999;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 12px 18px;
	border-radius: 12px;
	background: #065f46;
	color: #fff;
	font-weight: 600;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
	animation: tpa-toast 4s ease forwards;
}

@keyframes tpa-toast {
	0% { opacity: 0; transform: translateY(-8px); }
	8%, 85% { opacity: 1; transform: none; }
	100% { opacity: 0; visibility: hidden; }
}

/* Tabs */
.tpa-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 22px 0 18px;
	padding: 6px;
	width: fit-content;
	max-width: 100%;
	border: 1px solid var(--tpa-border);
	border-radius: 12px;
	background: var(--tpa-bg);
}

.tpa-tab {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 9px 16px;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: var(--tpa-muted);
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s, color 0.15s;
}

.tpa-tab:hover {
	color: var(--tpa-text);
}

.tpa-tab.is-active {
	background: var(--tpa-primary);
	color: #fff;
}

.tpa-tab .dashicons {
	width: 18px;
	height: 18px;
	font-size: 18px;
}

/* Layout */
.tpa-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 360px;
	gap: 22px;
	align-items: start;
}

.tpa-panel {
	display: none;
}

.tpa-panel.is-active {
	display: block;
}

.tpa-aside {
	position: sticky;
	top: 48px;
	display: grid;
	gap: 18px;
}

/* Cards */
.tpa-card {
	margin-bottom: 18px;
	padding: 24px;
	border: 1px solid var(--tpa-border);
	border-radius: var(--tpa-radius);
	background: var(--tpa-bg);
	box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.tpa-aside .tpa-card {
	margin-bottom: 0;
}

.tpa-card-head {
	margin-bottom: 8px;
}

.tpa-card-head h3 {
	margin: 0;
	font-size: 17px;
	font-weight: 700;
}

.tpa-card-head p {
	margin: 4px 0 0;
	color: var(--tpa-muted);
	font-size: 13px;
}

.tpa-note {
	margin: 16px 0 0;
	padding: 10px 14px;
	border-radius: 10px;
	background: #eef2ff;
	color: #3730a3;
	font-size: 13px;
}

/* Setting rows */
.tpa-setting {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
	padding: 16px 0;
	border-bottom: 1px solid var(--tpa-border);
}

.tpa-setting:last-of-type {
	border-bottom: 0;
}

.tpa-text label {
	font-size: 14px;
	font-weight: 600;
}

.tpa-text p {
	margin: 3px 0 0;
	color: var(--tpa-muted);
	font-size: 13px;
	line-height: 1.5;
}

.tpa-control {
	flex: none;
}

/* Switch */
.tpa-switch {
	position: relative;
	display: inline-block;
	width: 44px;
	height: 24px;
}

.tpa-switch input {
	position: absolute;
	opacity: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	cursor: pointer;
	z-index: 1;
}

.tpa-slider {
	position: absolute;
	inset: 0;
	border-radius: 999px;
	background: #d1d5db;
	transition: background 0.2s;
}

.tpa-slider::before {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
	transition: transform 0.2s;
}

.tpa-switch input:checked + .tpa-slider {
	background: var(--tpa-primary);
}

.tpa-switch input:checked + .tpa-slider::before {
	transform: translateX(20px);
}

.tpa-switch input:focus-visible + .tpa-slider {
	outline: 2px solid var(--tpa-primary);
	outline-offset: 2px;
}

/* Segmented control */
.tpa-seg {
	display: inline-flex;
	padding: 3px;
	border-radius: 10px;
	background: #f3f4f6;
}

.tpa-seg-opt {
	position: relative;
	margin: 0;
}

.tpa-seg-opt input {
	position: absolute;
	opacity: 0;
	inset: 0;
	margin: 0;
	cursor: pointer;
}

.tpa-seg-opt span {
	display: block;
	padding: 6px 12px;
	border-radius: 8px;
	color: var(--tpa-muted);
	font-size: 13px;
	font-weight: 600;
	white-space: nowrap;
}

.tpa-seg-opt input:checked + span {
	background: #fff;
	color: var(--tpa-primary);
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.tpa-seg-opt input:focus-visible + span {
	outline: 2px solid var(--tpa-primary);
}

/* Inputs */
.tpa-select,
.tpa-number {
	min-width: 190px;
	height: 38px;
	border: 1px solid #d1d5db;
	border-radius: 10px;
	background-color: #fff;
	color: var(--tpa-text);
}

.tpa-number {
	min-width: 90px;
	width: 90px;
}

.tpa-select:focus,
.tpa-number:focus {
	border-color: var(--tpa-primary);
	box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
	outline: none;
}

.tpa-range {
	display: flex;
	align-items: center;
	gap: 12px;
}

.tpa-range input[type="range"] {
	width: 170px;
	accent-color: var(--tpa-primary);
}

.tpa-range output {
	min-width: 52px;
	padding: 3px 8px;
	border-radius: 8px;
	background: #eef2ff;
	color: var(--tpa-primary);
	font-size: 12px;
	font-weight: 700;
	text-align: center;
}

.tpa-color {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 4px 12px 4px 4px;
	border: 1px solid #d1d5db;
	border-radius: 10px;
	background: #fff;
	cursor: pointer;
}

.tpa-color input[type="color"] {
	width: 32px;
	height: 32px;
	padding: 0;
	border: 0;
	border-radius: 7px;
	background: none;
	cursor: pointer;
}

.tpa-color code {
	background: none;
	padding: 0;
	font-size: 13px;
	text-transform: uppercase;
}

/* Preview */
.tpa-preview {
	margin-top: 10px;
	padding: 6px 18px;
	border: 1px dashed #d1d5db;
	border-radius: 12px;
	background: #fafafa;
}

.tpa-preview.hide-count .tpcafw-count,
.tpa-preview.hide-viewall .tpcafw-view-all {
	display: none;
}

/* Usage tab */
.tpa-methods {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 14px;
	margin-top: 16px;
}

.tpa-method {
	padding: 16px;
	border: 1px solid var(--tpa-border);
	border-radius: 12px;
	background: #fafafa;
}

.tpa-method .dashicons {
	width: 28px;
	height: 28px;
	margin-bottom: 8px;
	font-size: 28px;
	color: var(--tpa-primary);
}

.tpa-method h4 {
	margin: 0 0 4px;
	font-size: 14px;
}

.tpa-method p {
	margin: 0;
	color: var(--tpa-muted);
	font-size: 13px;
}

.tpa-table-wrap {
	margin-top: 14px;
	overflow-x: auto;
}

.tpa-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
}

.tpa-table th {
	padding: 10px 12px;
	border-bottom: 1px solid var(--tpa-border);
	color: var(--tpa-muted);
	font-size: 12px;
	text-align: left;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.tpa-table td {
	padding: 10px 12px;
	border-bottom: 1px solid #f3f4f6;
}

.tpa-copy {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-top: 10px;
	padding: 8px 8px 8px 14px;
	border-radius: 10px;
	background: #f3f4f6;
}

.tpa-copy code {
	background: none;
	padding: 0;
	font-size: 13px;
}

/* Save bar */
.tpa-savebar {
	position: sticky;
	bottom: 0;
	z-index: 20;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-top: 8px;
	padding: 14px 20px;
	border: 1px solid var(--tpa-border);
	border-radius: var(--tpa-radius);
	background: rgba(255, 255, 255, 0.95);
	box-shadow: 0 -4px 20px rgba(16, 24, 40, 0.06);
	backdrop-filter: blur(6px);
}

.tpa-status {
	color: var(--tpa-muted);
	font-size: 13px;
}

.tpa-status.is-dirty {
	color: #b45309;
	font-weight: 600;
}

.tpa-savebar-actions {
	display: flex;
	align-items: center;
	gap: 10px;
}

.tpa-wrap .button {
	border-radius: 10px;
}

.tpa-wrap .button.tpa-save {
	padding: 4px 22px;
	border-color: var(--tpa-primary);
	background: var(--tpa-primary);
	font-weight: 600;
}

.tpa-wrap .button.tpa-save:hover,
.tpa-wrap .button.tpa-save:focus {
	border-color: var(--tpa-primary-dark);
	background: var(--tpa-primary-dark);
}

@media (max-width: 1100px) {
	.tpa-layout {
		grid-template-columns: 1fr;
	}

	.tpa-aside {
		position: static;
		order: -1;
	}
}

@media (max-width: 700px) {
	.tpa-setting {
		flex-direction: column;
		align-items: flex-start;
	}

	.tpa-methods {
		grid-template-columns: 1fr;
	}

	.tpa-hero-links {
		flex-wrap: wrap;
	}
}
