/**
 * GestOO Peppol Connector for WooCommerce – Admin styles
 * Aligns integration form with WordPress admin (form-table, inputs, selects).
 */

/* =========================================================================
   Settings tabs – General | Diagnostic | Test order
   ========================================================================= */

.gestoo-peppol-settings-tabs {
	margin-top: 1.5em;
}

.gestoo-peppol-tab-nav {
	display: flex;
	flex-wrap: wrap;
	gap: 0;
	border-bottom: 2px solid #c3c4c7;
	margin-bottom: 0;
	padding: 0;
	list-style: none;
	background: transparent;
}

.gestoo-peppol-tab-link {
	display: inline-block;
	padding: 12px 20px;
	margin-bottom: -2px;
	border-bottom: 3px solid transparent;
	color: #2c3338;
	text-decoration: none;
	font-weight: 600;
	font-size: 14px;
	cursor: pointer;
	transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.gestoo-peppol-tab-link:hover {
	color: #2271b1;
	background: #f6f7f7;
}

.gestoo-peppol-tab-link.gestoo-peppol-tab-active {
	color: #2271b1;
	border-bottom-color: #2271b1;
	background: #f0f6fc;
}

.gestoo-peppol-tab-pane {
	display: none;
	padding: 20px 0 0;
}

.gestoo-peppol-tab-pane.gestoo-peppol-pane-active {
	display: block;
}

/* Hide phantom row generated by the custom field type gestoo_peppol_api_token_help */
tr:has(input[name="woocommerce_gestoo_peppol_api_token_help"]) {
	display: none !important;
}

/* Spinner animation for the API token live-test */
@keyframes gestoo-spin {
	to { transform: rotate(360deg); }
}

/* Spinner animation for API token test, diagnostic, test payload */
.gestoo-peppol-spinner {
	display: inline-block;
	width: 14px;
	height: 14px;
	border: 2px solid #c3c4c7;
	border-top-color: #2271b1;
	border-radius: 50%;
	animation: gestoo-spin 0.6s linear infinite;
	vertical-align: middle;
	margin-right: 6px;
}
.gestoo-peppol-spinner.is-active {
	visibility: visible;
}

/* Multiselect: same look as WP admin select, usable height */
.woocommerce table.form-table select[name="woocommerce_gestoo_peppol_trigger_statuses"] {
	min-height: 120px;
	width: 100%;
	max-width: 25em;
	padding: 2px;
	line-height: 1.5;
	border: 1px solid #8c8f94;
	box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.07);
	background-color: #fff;
	color: #2c3338;
	font-size: 14px;
	border-radius: 2px;
}

.woocommerce table.form-table select[name="woocommerce_gestoo_peppol_trigger_statuses"]:focus {
	border-color: #2271b1;
	box-shadow: 0 0 0 1px #2271b1;
	outline: 2px solid transparent;
}

/* API token input: consistent with WP admin */
.woocommerce table.form-table input[name="woocommerce_gestoo_peppol_api_token"] {
	width: 100%;
	max-width: 25em;
	padding: 2px 8px;
	line-height: 1.5;
	border: 1px solid #8c8f94;
	box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.07);
	background-color: #fff;
	color: #2c3338;
	font-size: 14px;
	border-radius: 2px;
}

.woocommerce table.form-table input[name="woocommerce_gestoo_peppol_api_token"]:focus {
	border-color: #2271b1;
	box-shadow: 0 0 0 1px #2271b1;
	outline: 2px solid transparent;
}

/* =========================================================================
   Orders list columns – Peppol status badges
   ========================================================================= */

.gestoo-peppol-badge {
	display: inline-block;
	padding: 2px 7px;
	border-radius: 3px;
	font-size: 11px;
	font-weight: 600;
	line-height: 1.6;
	white-space: nowrap;
	vertical-align: middle;
}

.gestoo-peppol-badge--delivered {
	background: #d1f0e0;
	color: #145a32;
}

.gestoo-peppol-badge--invoice-ok {
	background: #e3f2e1;
	color: #2d6a2d;
}

.gestoo-peppol-badge--submitted {
	background: #d6eaf8;
	color: #154360;
}

.gestoo-peppol-badge--pending {
	background: #fdebd0;
	color: #784212;
}

.gestoo-peppol-badge--error {
	background: #fce8e6;
	color: #7b241c;
}

.gestoo-peppol-badge--none {
	background: #f0f0f1;
	color: #50575e;
}

.gestoo-peppol-badge--skipped {
	background: #f0f0f1;
	color: #50575e;
}

/* Log info button (ℹ️) */
.gestoo-peppol-log-btn {
	background: none;
	border: none;
	cursor: pointer;
	padding: 0 3px;
	font-size: 14px;
	vertical-align: middle;
	opacity: .75;
}

.gestoo-peppol-log-btn:hover {
	opacity: 1;
}

/* Sync/retry button loading state – icône qui tourne */
.gestoo-peppol-sync-btn.gestoo-peppol-btn-loading {
	cursor: wait;
}
.gestoo-peppol-sync-btn.gestoo-peppol-btn-loading .dashicons-update {
	animation: gestoo-spin 0.8s linear infinite;
}

/* Peppol Actions – icons cohérents (Dashicons, même taille) */
.gestoo-peppol-sync-btn .dashicons-update,
.gestoo-peppol-external-link .dashicons-external {
	font-size: 16px;
	width: 16px;
	height: 16px;
	line-height: 1;
	vertical-align: middle;
}

/* Inline error under sync button */
.gestoo-peppol-inline-error {
	display: block;
	color: #b32d2e;
	font-size: 11px;
	margin-top: 3px;
}

/* =========================================================================
   Log modal
   ========================================================================= */

#gestoo-peppol-log-modal {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 160000; /* above WP admin bar (99999) */
}

.gestoo-peppol-modal-overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, .55);
	display: flex;
	align-items: center;
	justify-content: center;
}

.gestoo-peppol-modal-box {
	position: relative;
	background: #fff;
	border-radius: 4px;
	box-shadow: 0 4px 24px rgba(0, 0, 0, .25);
	padding: 24px 28px 20px;
	width: 90%;
	max-width: 620px;
	max-height: 80vh;
	overflow-y: auto;
}

.gestoo-peppol-modal-box h3 {
	margin: 0 0 14px;
	font-size: 16px;
	font-weight: 600;
	color: #1d2327;
}

.gestoo-peppol-modal-close {
	position: absolute;
	top: 10px;
	right: 14px;
	background: none;
	border: none;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	color: #646970;
	padding: 2px 6px;
}

.gestoo-peppol-modal-close:hover {
	color: #1d2327;
}

/* Last error notice inside modal */
.gestoo-peppol-last-error {
	background: #fce8e6;
	border-left: 3px solid #b32d2e;
	padding: 8px 10px;
	margin-bottom: 14px;
	font-size: 13px;
	color: #3c3c3c;
	border-radius: 0 3px 3px 0;
}

/* Log table inside modal */
.gestoo-peppol-log-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
}

.gestoo-peppol-log-table thead th {
	text-align: left;
	padding: 6px 8px;
	border-bottom: 2px solid #dcdcde;
	color: #3c434a;
	font-weight: 600;
}

.gestoo-peppol-log-table tbody tr:nth-child(odd) {
	background: #f6f7f7;
}

.gestoo-peppol-log-table tbody td {
	padding: 6px 8px;
	border-bottom: 1px solid #f0f0f1;
	vertical-align: top;
	color: #3c434a;
}

.gestoo-peppol-log-date {
	white-space: nowrap;
	color: #646970;
	font-size: 11px;
	width: 140px;
}

/* =========================================================================
   Test order (dry-run payload) – Settings page
   ========================================================================= */

#gestoo-peppol-test-result pre {
	border-radius: 2px;
}

#gestoo-peppol-test-json {
	font-family: Consolas, Monaco, monospace;
	font-size: 12px;
	line-height: 1.4;
	margin-top: 8px;
}
