/**
 * swftbox WooCommerce Admin Styles
 *
 * @package swftbox_WooCommerce
 * @since 1.0.0
 */

/* Settings Page Container */
.swftbox-settings {
	max-width: 800px;
	margin: 20px 0;
}

/* Header with Logo */
.swftbox-header {
	margin-bottom: 16px;
}

.swftbox-logo {
	width: 120px;
	height: auto;
}

.swftbox-settings h1 {
	font-size: 24px;
	font-weight: 600;
	margin-bottom: 20px;
	color: #1d2327;
}

/* Card Container */
.swftbox-card {
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	padding: 24px;
	margin-bottom: 20px;
	box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

.swftbox-card h2 {
	font-size: 18px;
	font-weight: 600;
	margin: 0 0 16px;
	padding: 0;
	color: #1d2327;
}

/* Form Elements */
.swftbox-form-row {
	margin-bottom: 20px;
}

.swftbox-form-row label {
	display: block;
	font-weight: 600;
	margin-bottom: 8px;
	color: #1d2327;
}

.swftbox-form-row input[type="text"],
.swftbox-form-row input[type="password"] {
	width: 100%;
	max-width: 400px;
	padding: 8px 12px;
	border: 1px solid #8c8f94;
	border-radius: 4px;
	font-size: 14px;
}

.swftbox-form-row input[type="text"]:focus,
.swftbox-form-row input[type="password"]:focus {
	border-color: #faca02;
	box-shadow: 0 0 0 1px #faca02;
	outline: none;
}

.swftbox-form-row .description {
	margin-top: 8px;
	color: #646970;
	font-size: 13px;
}

/* Instructions List */
.swftbox-instructions {
	margin-top: 12px;
	padding: 16px;
	background: #f6f7f7;
	border-radius: 4px;
	font-size: 13px;
	color: #646970;
}

.swftbox-instructions p {
	margin: 0 0 12px;
}

.swftbox-instructions ol {
	margin: 0;
	padding-left: 20px;
}

.swftbox-instructions li {
	margin-bottom: 8px;
	line-height: 1.5;
}

.swftbox-instructions li:last-child {
	margin-bottom: 0;
}

.swftbox-instructions a {
	color: #2271b1;
	text-decoration: none;
}

.swftbox-instructions a:hover {
	color: #135e96;
	text-decoration: underline;
}

/* Disabled/Read-only Inputs */
.swftbox-form-row input.swftbox-input-disabled[disabled] {
	background: #f6f7f7;
	color: #646970;
	cursor: not-allowed;
}

/* Last Sync Text */
.swftbox-last-sync {
	color: #646970;
	font-size: 13px;
	margin-left: 16px;
}

/* Status Indicator */
.swftbox-status {
	display: inline-flex;
	align-items: center;
	padding: 6px 12px;
	border-radius: 4px;
	font-size: 13px;
	font-weight: 500;
}

.swftbox-status-connected {
	background: #d7f7c2;
	color: #006600;
}

.swftbox-status-disconnected {
	background: #fcf0f1;
	color: #cc0000;
}

.swftbox-status-icon {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	margin-right: 8px;
}

.swftbox-status-connected .swftbox-status-icon {
	background: #00a32a;
}

.swftbox-status-disconnected .swftbox-status-icon {
	background: #d63638;
}

/* Buttons */
.swftbox-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 8px 16px;
	border-radius: 4px;
	font-size: 14px;
	font-weight: 500;
	text-decoration: none;
	cursor: pointer;
	transition: all 0.2s ease;
}

.swftbox-button-primary {
	background: #faca02;
	border: 1px solid #faca02;
	color: #1d1d1d;
}

.swftbox-button-primary:hover {
	background: #e0b502;
	border-color: #e0b502;
	color: #1d1d1d;
}

.swftbox-button-secondary {
	background: #fff;
	border: 1px solid #8c8f94;
	color: #2c3338;
}

.swftbox-button-secondary:hover {
	background: #f6f7f7;
	border-color: #2c3338;
	color: #1d2327;
}

/* Logo in Menu - WordPress handles base64 SVG icons automatically */
/* No custom styling needed - icon uses WordPress default sizing */

/* Notice Styles */
.swftbox-notice {
	padding: 12px 16px;
	border-radius: 4px;
	margin-bottom: 20px;
}

.swftbox-notice-success {
	background: #d7f7c2;
	border-left: 4px solid #00a32a;
}

.swftbox-notice-error {
	background: #fcf0f1;
	border-left: 4px solid #d63638;
}

.swftbox-notice-warning {
	background: #fcf9e8;
	border-left: 4px solid #dba617;
}

.swftbox-notice-info {
	background: #f0f6fc;
	border-left: 4px solid #72aee6;
}

/* Connection Info Box */
.swftbox-connection-info {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px;
	background: #f6f7f7;
	border-radius: 4px;
}

.swftbox-connection-info .swftbox-status {
	margin-right: auto;
}

/* Form Styles */
.swftbox-form {
	width: 100%;
}

.swftbox-form .submit {
	margin: 20px 0 0;
	padding: 20px 0 0;
	border-top: 1px solid #c3c4c7;
}

/* Webhook Status Table */
.swftbox-webhook-table {
	margin-top: 16px;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
}

.swftbox-webhook-table th {
	background: #f6f7f7;
	font-weight: 600;
	text-align: left;
	padding: 12px;
	border-bottom: 1px solid #c3c4c7;
}

.swftbox-webhook-table td {
	padding: 12px;
	border-bottom: 1px solid #c3c4c7;
	vertical-align: middle;
}

.swftbox-webhook-table tr:last-child td {
	border-bottom: none;
}

.swftbox-webhook-table code {
	background: #f0f0f1;
	padding: 2px 6px;
	border-radius: 3px;
	font-size: 12px;
}

/* Webhook Status Badges */
.swftbox-webhook-status {
	display: inline-block;
	padding: 4px 10px;
	border-radius: 4px;
	font-size: 12px;
	font-weight: 500;
}

.swftbox-webhook-active {
	background: #d7f7c2;
	color: #006600;
}

.swftbox-webhook-inactive {
	background: #fcf9e8;
	color: #9d6d00;
}

.swftbox-webhook-missing {
	background: #fcf0f1;
	color: #cc0000;
}

/* No webhooks message */
.swftbox-no-webhooks {
	padding: 16px;
	background: #f6f7f7;
	border-radius: 4px;
	color: #646970;
	text-align: center;
	margin-top: 12px;
}

/* OAuth Connection Section */
.swftbox-oauth-status {
	margin-top: 16px;
}

.swftbox-oauth-connected,
.swftbox-oauth-disconnected {
	padding: 20px;
	background: #f6f7f7;
	border-radius: 4px;
}

.swftbox-oauth-connected {
	background: #f0fdf4;
	border: 1px solid #bbf7d0;
}

.swftbox-oauth-disconnected {
	background: #fef3f2;
	border: 1px solid #fecaca;
}

.swftbox-oauth-status .swftbox-status {
	margin-bottom: 12px;
}

.swftbox-oauth-status .description {
	margin: 12px 0;
	color: #646970;
	font-size: 13px;
	line-height: 1.5;
}

.swftbox-oauth-actions {
	margin-top: 16px;
}

.swftbox-button-connect {
	padding: 10px 24px;
	font-size: 14px;
}

.swftbox-button-connect:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

.swftbox-button-disconnect {
	background: #fff;
	border-color: #d63638;
	color: #d63638;
}

.swftbox-button-disconnect:hover {
	background: #d63638;
	border-color: #d63638;
	color: #fff;
}

.swftbox-oauth-hint {
	display: block;
	margin-top: 8px;
	color: #9ca3af;
	font-size: 12px;
	font-style: italic;
}

/* Webhook Health Banner */
.swftbox-health-banner {
	display: flex;
	align-items: flex-start;
	padding: 16px;
	margin: 16px 0;
	border-radius: 4px;
	gap: 12px;
}

.swftbox-health-healthy {
	background: #d7f7c2;
	border: 1px solid #a3e680;
}

.swftbox-health-unverified {
	background: #f0f6fc;
	border: 1px solid #72aee6;
}

.swftbox-health-warning {
	background: #fcf9e8;
	border: 1px solid #dba617;
}

.swftbox-health-error {
	background: #fcf0f1;
	border: 1px solid #f5a9a9;
}

.swftbox-health-icon {
	font-size: 20px;
	width: 20px;
	height: 20px;
	flex-shrink: 0;
	margin-top: 2px;
}

.swftbox-health-healthy .swftbox-health-icon {
	color: #00a32a;
}

.swftbox-health-unverified .swftbox-health-icon {
	color: #2271b1;
}

.swftbox-health-warning .swftbox-health-icon {
	color: #9d6d00;
}

.swftbox-health-error .swftbox-health-icon {
	color: #d63638;
}

.swftbox-health-content {
	flex: 1;
}

.swftbox-health-content strong {
	display: block;
	margin-bottom: 4px;
	color: #1d2327;
}

.swftbox-health-content p {
	margin: 0;
	color: #646970;
	font-size: 13px;
}

.swftbox-health-issues {
	margin: 8px 0 0;
	padding-left: 20px;
	list-style: disc;
}

.swftbox-health-issues li {
	margin-bottom: 4px;
	color: #646970;
	font-size: 13px;
}

.swftbox-health-issues li:last-child {
	margin-bottom: 0;
}

/* Disabled Webhook Status Badge */
.swftbox-webhook-disabled {
	background: #fcf0f1;
	color: #cc0000;
}

/* Webhook Actions Section */
.swftbox-webhook-actions {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-top: 16px;
	padding-top: 16px;
	border-top: 1px solid #c3c4c7;
}

.swftbox-reconnect-status {
	font-size: 13px;
	color: #646970;
}

.swftbox-reconnect-status.success {
	color: #00a32a;
}

.swftbox-reconnect-status.error {
	color: #d63638;
}

.swftbox-reconnect-status.loading {
	color: #646970;
	font-style: italic;
}

/* Health Check Info */
.swftbox-health-check-info {
	margin-top: 12px;
	color: #646970;
	font-size: 12px;
	font-style: italic;
}

/* Loading state for buttons */
#swftbox-reconnect-webhooks.loading,
#swftbox-verify-connection.loading {
	opacity: 0.7;
	cursor: wait;
}

#swftbox-reconnect-webhooks.loading::after,
#swftbox-verify-connection.loading::after {
	content: "";
	display: inline-block;
	width: 12px;
	height: 12px;
	margin-left: 8px;
	border: 2px solid #1d1d1d;
	border-radius: 50%;
	border-top-color: transparent;
	animation: swftbox-spin 1s linear infinite;
}

@keyframes swftbox-spin {
	to {
		transform: rotate(360deg);
	}
}

/* Verify Connection Status */
.swftbox-verify-status {
	font-size: 13px;
	color: #646970;
}

.swftbox-verify-status.success {
	color: #00a32a;
}

.swftbox-verify-status.error {
	color: #d63638;
}

.swftbox-verify-status.loading {
	color: #646970;
	font-style: italic;
}

/* Webhook description spacing */
.swftbox-webhook-description {
	margin-top: 8px;
	margin-bottom: 12px;
}

/* Sync credentials action spacing */
.swftbox-sync-credentials-action {
	margin-top: 10px;
}

/* Responsive */
@media screen and (max-width: 782px) {
	.swftbox-settings {
		margin: 10px 0;
	}

	.swftbox-card {
		padding: 16px;
	}

	.swftbox-form-row input[type="text"],
	.swftbox-form-row input[type="password"] {
		max-width: 100%;
	}

	.swftbox-connection-info {
		flex-direction: column;
		gap: 12px;
		align-items: flex-start;
	}

	.swftbox-last-sync {
		margin-left: 0;
	}

	.swftbox-instructions {
		padding: 12px;
	}
}
