:root {
	--aialtg-primary: #2271b1;
	--aialtg-primary-hover: #135e96;
	--aialtg-bg: #f0f2f5;
	--aialtg-card-bg: #ffffff;
	--aialtg-text: #3c434a;
	--aialtg-border: #dcdcde;
	--aialtg-success: #00a32a;
	--aialtg-error: #d63638;
	--aialtg-radius: 8px;
	--aialtg-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

/* --- Wrapper & Layout --- */
.aialtg-wrapper {
	max-width: 960px;
	margin: 20px auto 0;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.aialtg-header {
	margin-bottom: 25px;
	text-align: left;
}

.aialtg-header-brand {
	display: flex;
	align-items: center;
	gap: 16px;
}

.aialtg-header-logo {
	width: 56px;
	height: 56px;
	border-radius: 12px;
	box-shadow: 0 4px 14px rgba(49, 46, 129, 0.25);
	flex-shrink: 0;
}

.aialtg-header-text h1 {
	margin-bottom: 4px;
}

.aialtg-header h1 {
	font-size: 28px;
	font-weight: 700;
	color: #1d2327;
	margin-bottom: 5px;
	padding: 0;
}

.aialtg-subtitle {
	font-size: 16px;
	color: #646970;
	margin: 0;
}

.aialtg-content-wrap {
	display: flex;
	flex-direction: column;
	gap: 20px;
}

/* --- Settings Sections (WordPress Generated) --- */
/* We target the standard WP classes but style them like cards */
.aialtg-wrapper .form-table {
	background: var(--aialtg-card-bg);
	border-radius: var(--aialtg-radius);
	box-shadow: var(--aialtg-shadow);
	padding: 20px 30px;
	margin-top: 0;
	margin-bottom: 30px;
	border: 1px solid var(--aialtg-border);
	display: block; /* Make table behave like block for padding */
}

.aialtg-wrapper h2 {
	font-size: 20px;
	font-weight: 600;
	margin: 0 0 15px 0;
	padding: 0;
	color: var(--aialtg-text);
}

/* Fix WP Table Layout inside our cards */
.aialtg-wrapper .form-table tbody,
.aialtg-wrapper .form-table tr,
.aialtg-wrapper .form-table th,
.aialtg-wrapper .form-table td {
	display: block;
	width: 100%;
	padding: 0;
	text-align: left;
}

.aialtg-wrapper .form-table tr {
	margin-bottom: 20px;
}

.aialtg-wrapper .form-table th {
	font-weight: 600;
	margin-bottom: 8px;
	width: auto;
}

.aialtg-wrapper .form-table td {
	margin-bottom: 5px;
}

.aialtg-section-desc {
	margin: -10px 0 20px 0;
	color: #646970;
	font-size: 14px;
}

/* --- Inputs & Textareas --- */
.aialtg-input-wrap input[type="text"],
.aialtg-input-wrap input[type="password"],
.aialtg-input-wrap textarea,
.aialtg-input-group input[type="number"] {
	width: 100%;
	max-width: 100%;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	padding: 8px 12px;
	box-shadow: none;
	transition: border-color 0.2s;
}

.aialtg-input-wrap input:focus,
.aialtg-input-wrap textarea:focus {
	border-color: var(--aialtg-primary);
	box-shadow: 0 0 0 1px var(--aialtg-primary);
	outline: none;
}

.aialtg-input-group {
	display: flex;
	align-items: center;
	gap: 10px;
}

.aialtg-suffix {
	color: #646970;
}

/* --- Modern Toggle Switch --- */
.aialtg-toggle {
	display: inline-flex;
	align-items: center;
	cursor: pointer;
	gap: 10px;
}

.aialtg-toggle input {
	display: none;
}

.aialtg-toggle-slider {
	position: relative;
	width: 44px;
	height: 24px;
	background-color: #ccc;
	border-radius: 34px;
	transition: .4s;
}

.aialtg-toggle-slider:before {
	position: absolute;
	content: "";
	height: 18px;
	width: 18px;
	left: 3px;
	bottom: 3px;
	background-color: white;
	border-radius: 50%;
	transition: .4s;
}

.aialtg-toggle input:checked + .aialtg-toggle-slider {
	background-color: var(--aialtg-primary);
}

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

.aialtg-toggle-label {
	font-weight: 500;
	font-size: 14px;
}

/* --- Statistics Card (Custom Section) --- */
.aialtg-stats-card {
	background: var(--aialtg-card-bg);
	border: 1px solid var(--aialtg-border);
	border-left: 4px solid var(--aialtg-primary);
	border-radius: var(--aialtg-radius);
	box-shadow: var(--aialtg-shadow);
	padding: 20px;
	margin-bottom: 30px;
}

.aialtg-card-header h3 {
	margin: 0 0 20px 0;
	font-size: 18px;
	color: var(--aialtg-primary);
}

.aialtg-stats-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
	gap: 20px;
	margin-bottom: 25px;
	background: #f8f9fa;
	padding: 15px;
	border-radius: 6px;
}

.aialtg-stat-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
}

.aialtg-stat-label {
	font-size: 12px;
	text-transform: uppercase;
	color: #646970;
	font-weight: 600;
	margin-bottom: 5px;
}

.aialtg-stat-value {
	font-size: 24px;
	font-weight: 700;
	color: var(--aialtg-text);
}

.aialtg-stat-value.success { color: var(--aialtg-success); }
.aialtg-stat-value.error { color: var(--aialtg-error); }
.aialtg-stat-value.neutral { color: var(--aialtg-primary); }

/* Progress Bar */
.aialtg-progress-bar-wrap {
	margin-bottom: 25px;
}

.aialtg-progress-bar {
	height: 12px;
	background: #e0e0e0;
	border-radius: 6px;
	overflow: hidden;
	margin-bottom: 5px;
}

.aialtg-progress-fill {
	height: 100%;
	background: var(--aialtg-primary);
	border-radius: 6px;
	transition: width 0.5s ease;
}

.aialtg-progress-text {
	font-size: 12px;
	color: #646970;
	font-weight: 500;
	float: right;
}

/* Controls & Buttons Wrapper */
.aialtg-controls-wrapper {
	padding-top: 20px;
	border-top: 1px solid #f0f0f1;
	margin-top: 15px;
}

.aialtg-buttons-row {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin-bottom: 15px;
}

.aialtg-buttons-row .button {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	height: 36px;
	padding: 0 16px;
	font-weight: 500;
	border-radius: 6px;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
	transition: all 0.2s ease;
}

.aialtg-buttons-row .button:hover:not(:disabled) {
	background: #f6f7f7;
	border-color: #2271b1;
	color: #2271b1;
	transform: translateY(-1px);
	box-shadow: 0 3px 6px rgba(0, 0, 0, 0.08);
}

.aialtg-buttons-row .button:active:not(:disabled) {
	transform: translateY(0);
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.aialtg-buttons-row .button .dashicons {
	font-size: 16px;
	width: 16px;
	height: 16px;
	line-height: 16px;
	transition: transform 0.3s ease;
}

.aialtg-buttons-row .button:hover:not(:disabled) .dashicons {
	transform: rotate(15deg);
}

/* Premium Status Area */
.aialtg-status-area {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 16px;
	border-radius: 6px;
	margin-top: 15px;
	font-size: 13px;
	font-weight: 500;
	line-height: 1.5;
	border-left: 4px solid var(--aialtg-primary);
	background: #f0f6fc;
	color: #1d2327;
	animation: aialtgFadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.aialtg-status-area.processing {
	border-left-color: var(--aialtg-primary);
	background: #f0f6fc;
	color: #1d2327;
}

.aialtg-status-area.success {
	border-left-color: var(--aialtg-success);
	background: #edfaf0;
	color: #006013;
}

.aialtg-status-area.error {
	border-left-color: var(--aialtg-error);
	background: #fcf0f1;
	color: #8c0d12;
}

.aialtg-status-spinner {
	margin: 0 !important;
	float: none !important;
}

.aialtg-status-message {
	flex: 1;
}

@keyframes aialtgFadeIn {
	from {
		opacity: 0;
		transform: translateY(-8px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.aialtg-card-footer {
	margin-top: 15px;
	font-size: 13px;
	color: #8c8f94;
	font-style: italic;
}

/* --- Submit Button Wrapper --- */
.aialtg-submit-wrap {
	margin-top: 20px;
	padding-left: 0;
}

.aialtg-submit-wrap .button-primary {
	background: var(--aialtg-primary);
	border-color: var(--aialtg-primary);
	font-size: 16px;
	padding: 5px 20px;
	min-height: 40px;
	transition: background 0.2s;
}

.aialtg-submit-wrap .button-primary:hover {
	background: var(--aialtg-primary-hover);
	border-color: var(--aialtg-primary-hover);
}

/* --- Media Library Column Styles (Kept existing, refined) --- */
.aialtg-descriptor-wrap {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 5px;
}

.aialtg-message {
	width: 100%;
	font-size: 11px;
	margin-top: 4px;
}

.aialtg-message.success { color: var(--aialtg-success); }
.aialtg-message.error { color: var(--aialtg-error); }

/* --- Model Selector Skeleton Loader --- */
.aialtg-skeleton-loader {
	width: 100%;
	max-width: 25em;
	height: 30px;
	background: #f3f3f3;
	border-radius: 4px;
	position: relative;
	overflow: hidden;
}

.aialtg-skeleton-input {
	width: 100%;
	height: 100%;
	background: linear-gradient(90deg, #f3f3f3 25%, #e6e6e6 50%, #f3f3f3 75%);
	background-size: 200% 100%;
	animation: aialtg-skeleton-animation 1.5s infinite;
}

@keyframes aialtg-skeleton-animation {
	0% {
		background-position: 200% 0;
	}
	100% {
		background-position: -200% 0;
	}
}

.aialtg-custom-model-input-wrap {
	margin-top: 8px;
}

/* --- Brand footer --- */
.aialtg-brand-footer {
	margin-top: 32px;
	padding: 20px 16px;
	text-align: center;
	border-top: 1px solid var(--aialtg-border);
	background: var(--aialtg-card-bg);
	border-radius: var(--aialtg-radius);
	box-shadow: var(--aialtg-shadow);
}

.aialtg-brand-tagline {
	margin: 0 0 8px;
	color: #646970;
	font-size: 13px;
}

.aialtg-brand-links {
	margin: 0;
	font-size: 13px;
	color: #646970;
}

.aialtg-brand-links a {
	font-weight: 600;
	text-decoration: none;
}

.aialtg-brand-links a:hover {
	text-decoration: underline;
}

.aialtg-brand-sep {
	margin: 0 6px;
	color: #a7aaad;
}