/**
 * TMA Anzeigen-Manager – Kundenverwaltung admin styles
 * Prefix: .tma-am-customers / .tma-am-customer-portal
 */

.tma-am-customers {
	--tma-am-c-accent: #2271b1;
	--tma-am-c-accent-hover: #135e96;
	--tma-am-c-border: #c3c4c7;
	--tma-am-c-muted: #646970;
	--tma-am-c-bg: #f6f7f7;
	--tma-am-c-card: #fff;
	max-width: 1400px;
}

.tma-am-customers-header {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px 20px;
	margin: 8px 0 4px;
}

.tma-am-customers-header .wp-heading-inline {
	margin: 0;
	padding: 0;
}

.tma-am-customers-header__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: center;
}

.tma-am-customers .button-hero,
.tma-am-customers-btn.button-hero {
	padding: 8px 22px;
	font-size: 14px;
	line-height: 2;
	min-height: 40px;
	height: auto;
}

.tma-am-customers .button-primary {
	background: var(--tma-am-c-accent);
	border-color: var(--tma-am-c-accent);
}

.tma-am-customers .button-primary:hover,
.tma-am-customers .button-primary:focus {
	background: var(--tma-am-c-accent-hover);
	border-color: var(--tma-am-c-accent-hover);
}

/* Filters */
.tma-am-customers-filters {
	margin: 16px 0 12px;
	padding: 14px 16px;
	background: var(--tma-am-c-card);
	border: 1px solid var(--tma-am-c-border);
	border-radius: 4px;
	box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

.tma-am-customers-filters__row,
.tma-am-customers-filter-row {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: center;
}

.tma-am-customers-search,
.tma-am-customers-filters .search-box input[type="search"] {
	flex: 1 1 240px;
	min-width: 200px;
	max-width: 420px;
	font-size: 14px;
	padding: 6px 10px;
	min-height: 36px;
}

.tma-am-customers-filter {
	min-width: 140px;
	max-width: 200px;
}

.tma-am-customers-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	align-items: baseline;
	margin: 0 0 10px;
	color: var(--tma-am-c-muted);
	font-size: 13px;
}

.tma-am-customers-search-status.is-busy,
.tma-am-customers-import-status.is-busy {
	color: var(--tma-am-c-accent);
}

/* Table */
.tma-am-customers-table-wrap {
	overflow-x: auto;
	background: var(--tma-am-c-card);
	border: 1px solid var(--tma-am-c-border);
	border-radius: 4px;
}

.tma-am-customers-table {
	margin: 0;
	border: 0;
}

.tma-am-customers-table th,
.tma-am-customers-table td {
	padding: 10px 12px;
	vertical-align: middle;
}

.tma-am-customers-table .column-number {
	width: 90px;
}

.tma-am-customers-table .column-name {
	min-width: 160px;
}

.tma-am-customers-table .column-actions,
.tma-am-customers-actions {
	width: 220px;
	white-space: nowrap;
}

.tma-am-customers-table .column-actions .button,
.tma-am-customers-actions .button {
	margin: 2px 4px 2px 0;
}

.tma-am-customers-empty td,
.tma-am-customers-table tr.no-items td {
	padding: 24px 12px;
	text-align: center;
	color: var(--tma-am-c-muted);
}

.tma-am-customers-pagination {
	margin-top: 12px;
}

.tma-am-customers-pagination .button.disabled {
	pointer-events: none;
	opacity: 0.5;
}

/* Badges */
.tma-am-customers-badge {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 3px;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.6;
}

.tma-am-customers-badge--active {
	background: #edfaef;
	color: #007017;
}

.tma-am-customers-badge--inactive {
	background: #f6f7f7;
	color: #50575e;
}

.tma-am-customers-badge--login {
	background: #eef5fa;
	color: #135e96;
}

.tma-am-customers-badge--muted {
	background: #f0f0f1;
	color: #646970;
}

/* Top card */
.tma-am-customers-card,
.tma-am-customer-card-header {
	display: flex;
	flex-wrap: wrap;
	gap: 20px 28px;
	justify-content: space-between;
	margin: 16px 0 20px;
	padding: 18px 20px;
	background: var(--tma-am-c-card);
	border: 1px solid var(--tma-am-c-border);
	border-left: 4px solid var(--tma-am-c-accent);
	border-radius: 4px;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.tma-am-customers-card__label {
	display: block;
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--tma-am-c-muted);
	margin-bottom: 4px;
}

.tma-am-customers-card__number strong,
.tma-am-customer-number {
	font-size: 18px;
	margin: 0;
}

.tma-am-customers-card__name strong,
.tma-am-customer-name {
	font-size: 20px;
	font-weight: 600;
	margin: 0;
	color: #1d2327;
}

.tma-am-customers-card__meta,
.tma-am-customers-card__main {
	display: flex;
	flex-wrap: wrap;
	gap: 14px 24px;
}

/* Tabs / panels */
.tma-am-customers-tabs,
.tma-am-customer-tabs {
	margin: 0;
	padding-top: 0;
}

.tma-am-customers-tab--disabled {
	opacity: 0.45;
	pointer-events: none;
	cursor: not-allowed;
}

.tma-am-customers-panel,
.tma-am-customer-panel {
	display: none;
	margin: 0 0 16px;
	padding: 20px 22px 24px;
	background: var(--tma-am-c-card);
	border: 1px solid var(--tma-am-c-border);
	border-top: 0;
	border-radius: 0 0 4px 4px;
}

.tma-am-customers-panel.is-active,
.tma-am-customer-panel.is-active {
	display: block;
}

.tma-am-customers-panel[hidden],
.tma-am-customer-panel[hidden] {
	display: none !important;
}

.tma-am-customers-panel > h2:first-child,
.tma-am-customers-panel__inner > h2:first-child {
	margin-top: 0;
}

.tma-am-customers-form-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 4px 18px;
}

.tma-am-customers-field {
	margin: 0 0 12px;
}

.tma-am-customers-field label {
	display: block;
	font-weight: 600;
	margin-bottom: 4px;
}

.tma-am-customers-field--full {
	grid-column: 1 / -1;
}

.tma-am-customers-category-checks,
.tma-am-category-checks {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 16px;
}

.tma-am-customers-category-check {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-weight: 400;
}

.tma-am-customers-form-footer,
.tma-am-customers-import-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: center;
	margin: 20px 0 8px;
}

/* Contacts */
.tma-am-contacts-list,
.tma-am-customers-contacts {
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin-bottom: 16px;
}

.tma-am-contact-row,
.tma-am-customers-contact-row {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: flex-end;
	padding: 14px 16px;
	background: var(--tma-am-c-bg);
	border: 1px solid var(--tma-am-c-border);
	border-radius: 4px;
}

.tma-am-contact-row input[type="text"],
.tma-am-contact-row input[type="email"] {
	min-width: 140px;
}

/* Notes */
.tma-am-customers-notes-list,
.tma-am-notes-list {
	list-style: none;
	margin: 0 0 20px;
	padding: 0;
}

.tma-am-customers-note {
	padding: 12px 14px;
	margin-bottom: 10px;
	background: var(--tma-am-c-bg);
	border: 1px solid var(--tma-am-c-border);
	border-radius: 4px;
}

.tma-am-customers-note__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 14px;
	margin: 0 0 6px;
	font-size: 12px;
	color: var(--tma-am-c-muted);
}

.tma-am-customers-note__text {
	line-height: 1.5;
}

/* Categories layout */
.tma-am-customers-layout,
.tma-am-customers-two-col {
	display: grid;
	grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
	gap: 20px;
	align-items: start;
	margin-top: 16px;
}

.tma-am-customers-layout__form,
.tma-am-customers-layout__list {
	min-width: 0;
	background: var(--tma-am-c-card);
	border: 1px solid var(--tma-am-c-border);
	border-radius: 4px;
	padding: 16px 18px 20px;
}

.tma-am-customers-layout__form > h2,
.tma-am-customers-layout__list > h2 {
	margin: 0 0 14px;
	padding: 0;
	font-size: 1.15em;
}

.tma-am-customers-category-form .tma-am-customers-field input[type="text"],
.tma-am-customers-category-form .tma-am-customers-field input[type="number"],
.tma-am-customers-category-form .tma-am-customers-field textarea {
	display: block;
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
}

.tma-am-customers-category-form .tma-am-customers-field input[type="number"] {
	max-width: 7em;
}

.tma-am-customers-category-form .description {
	margin: 4px 0 0;
	line-height: 1.4;
}

.tma-am-customers-category-form__meta {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px 16px;
	align-items: end;
	margin-bottom: 4px;
}

.tma-am-customers-field--status .tma-am-customers-field__label {
	display: block;
	font-weight: 600;
	margin-bottom: 6px;
}

.tma-am-customers-field--status .tma-am-customers-category-check {
	margin: 0;
	min-height: 30px;
}

.tma-am-customers-categories-table {
	margin: 0;
}

.tma-am-customers-categories-table th:nth-child(4),
.tma-am-customers-categories-table td:nth-child(4) {
	width: 6.5em;
	text-align: center;
}

.tma-am-customers-categories-table th:nth-child(5),
.tma-am-customers-categories-table td:nth-child(5) {
	width: 6em;
	white-space: nowrap;
}

.tma-am-customers-row-editing {
	background: #f0f6fc !important;
}

.tma-am-customers-shop-advanced {
	margin: 16px 0 8px;
	padding: 10px 14px;
	background: var(--tma-am-c-bg, #f6f7f7);
	border: 1px solid var(--tma-am-c-border, #c3c4c7);
	border-radius: 4px;
}

.tma-am-customers-shop-advanced summary {
	cursor: pointer;
	font-weight: 600;
}

/* Import */
.tma-am-customers-steps,
.tma-am-import-steps {
	display: flex;
	flex-wrap: wrap;
	gap: 0;
	list-style: none;
	margin: 16px 0 20px;
	padding: 0;
}

.tma-am-customers-steps li,
.tma-am-import-steps li {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 16px;
	margin: 0;
	background: var(--tma-am-c-bg);
	border: 1px solid var(--tma-am-c-border);
	color: var(--tma-am-c-muted);
	font-size: 13px;
}

.tma-am-customers-steps li:first-child,
.tma-am-import-steps li:first-child {
	border-radius: 4px 0 0 4px;
}

.tma-am-customers-steps li:last-child,
.tma-am-import-steps li:last-child {
	border-radius: 0 4px 4px 0;
}

.tma-am-customers-steps li + li,
.tma-am-import-steps li + li {
	border-left: 0;
}

.tma-am-customers-steps li.is-current,
.tma-am-import-steps li.is-active {
	background: #eef5fa;
	border-color: var(--tma-am-c-accent);
	color: #1d2327;
	font-weight: 600;
	z-index: 1;
}

.tma-am-customers-steps li.is-done {
	background: #edfaef;
	color: #007017;
}

.tma-am-customers-steps__num {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: #fff;
	border: 1px solid currentColor;
	font-size: 12px;
	font-weight: 700;
}

.tma-am-customers-import-status {
	min-height: 1.4em;
	color: var(--tma-am-c-muted);
}

.tma-am-customers-import-mapping table,
.tma-am-customers-import-preview table,
#tma-am-import-mapping table,
#tma-am-import-preview table {
	width: 100%;
	margin-top: 12px;
}

.tma-am-customers-import-summary {
	list-style: none;
	margin: 0 0 16px;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 12px 24px;
	font-size: 15px;
}

.tma-am-customers-import-duplicates,
.tma-am-customers-import-errors,
.tma-am-customers-import-warnings {
	margin: 8px 0 16px;
	padding: 12px 14px;
	border-radius: 4px;
}

.tma-am-customers-import-duplicates,
.tma-am-customers-import-warnings {
	background: #fcf9e8;
	border: 1px solid #dba617;
	color: #614200;
}

.tma-am-customers-import-errors {
	background: #fcf0f1;
	border: 1px solid #d63638;
	color: #8a2424;
}

.tma-am-dup-row {
	background: #fcf9e8;
}

/* Portal */
.tma-am-customer-portal {
	margin: 0 0 1.5em;
}

.tma-am-customer-portal__intro {
	font-size: 1.05em;
	margin: 0 0 1em;
}

.tma-am-customer-portal__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 12px 14px;
	margin: 0 0 1.25em;
}

.tma-am-customer-portal__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 160px;
	min-height: 44px;
	padding: 10px 20px !important;
	height: auto !important;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.3;
	text-align: center;
	text-decoration: none;
	border-radius: 4px;
	border: 1px solid #c3c4c7;
	background: #fff;
	color: #1d2327;
	box-sizing: border-box;
}

.tma-am-customer-portal__btn:hover,
.tma-am-customer-portal__btn:focus {
	border-color: #2271b1;
	color: #135e96;
}

.tma-am-customer-portal__btn.button-primary {
	background: #2271b1;
	border-color: #2271b1;
	color: #fff;
}

.tma-am-customer-portal__btn.button-primary:hover {
	background: #135e96;
	border-color: #135e96;
	color: #fff;
}

@media (max-width: 960px) {
	.tma-am-customers-layout,
	.tma-am-customers-two-col {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 782px) {
	.tma-am-customers-header {
		flex-direction: column;
		align-items: flex-start;
	}

	.tma-am-customers-filters__row,
	.tma-am-customers-filter-row {
		flex-direction: column;
		align-items: stretch;
	}

	.tma-am-customers-search,
	.tma-am-customers-filter {
		max-width: none;
		width: 100%;
	}

	.tma-am-customers-card,
	.tma-am-customer-card-header {
		flex-direction: column;
	}

	.tma-am-customers-steps li,
	.tma-am-import-steps li {
		flex: 1 1 100%;
		border-radius: 4px !important;
		border: 1px solid var(--tma-am-c-border) !important;
	}

	.tma-am-customers-table .column-actions {
		width: auto;
		white-space: normal;
	}
}
