/**
 * CategoriX Admin Styles
 *
 * Modern, clean admin interface for the CategoriX WooCommerce plugin.
 *
 * @since 1.0.0
 */

/* ==========================================================================
   Layout & Wrap
   ========================================================================== */

.categorix-wrap {
	max-width: 1200px;
	margin: 0;
}

/* ==========================================================================
   Header
   ========================================================================== */

.categorix-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 24px;
	padding: 20px 24px;
	background: #fff;
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.categorix-header-left {
	flex: 1;
}

.categorix-title {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 24px;
	font-weight: 600;
	color: #1d2327;
	margin: 0 0 4px 0;
	padding: 0;
}

.categorix-title .dashicons {
	font-size: 28px;
	width: 28px;
	height: 28px;
	color: #1e3a5f;
}

.categorix-logo {
	height: 24px;
	max-height: 24px;
	max-width: 140px;
	width: auto;
	object-fit: contain;
	vertical-align: middle;
	display: inline-block;
	margin-right: 8px;
}

.categorix-title-separator {
	color: #d1d5db;
	margin: 0 8px;
	font-weight: 300;
}

.categorix-tagline {
	color: #6b7280;
	margin: 0;
	font-size: 14px;
}

.categorix-status {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 14px;
	border-radius: 20px;
	font-size: 13px;
	font-weight: 500;
}

.categorix-status-connected {
	background: #ecfdf5;
	color: #059669;
}

.categorix-status-disconnected {
	background: #fef3c7;
	color: #d97706;
}

.categorix-status .dashicons {
	font-size: 16px;
	width: 16px;
	height: 16px;
}

/* ==========================================================================
   Stats Grid
   ========================================================================== */

.categorix-stats-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: 16px;
	margin-bottom: 24px;
}

.categorix-stat-card {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 20px;
	background: #fff;
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
	transition: box-shadow 0.2s ease;
}

.categorix-stat-card:hover {
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.categorix-stat-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	border-radius: 12px;
	flex-shrink: 0;
}

.categorix-stat-icon .dashicons {
	font-size: 24px;
	width: 24px;
	height: 24px;
	color: #fff;
}

.categorix-icon-total {
	background: #1e3a5f;
}

.categorix-icon-uncategorized {
	background: #f59e0b;
}

.categorix-icon-categorized {
	background: #10b981;
}

.categorix-icon-review {
	background: #3b82f6;
}

.categorix-stat-content {
	display: flex;
	flex-direction: column;
}

.categorix-stat-number {
	font-size: 28px;
	font-weight: 700;
	line-height: 1.1;
	color: #1d2327;
}

.categorix-stat-label {
	font-size: 13px;
	color: #6b7280;
	margin-top: 2px;
}

/* ==========================================================================
   Cards
   ========================================================================== */

.categorix-main-grid {
	display: grid;
	grid-template-columns: 2fr 1fr;
	gap: 24px;
}

.categorix-card-full {
	grid-column: 1 / -1;
}

.categorix-card {
	background: #fff;
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
	overflow: hidden;
}

.categorix-card-primary {
	border-top: 3px solid #1e3a5f;
}

.categorix-card-header {
	padding: 16px 20px;
	border-bottom: 1px solid #f0f0f0;
}

.categorix-card-header h2 {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	font-size: 16px;
	font-weight: 600;
	color: #1d2327;
}

.categorix-card-header h2 .dashicons {
	color: #1e3a5f;
}

.categorix-card-body {
	padding: 20px;
}

.categorix-card-body-flush {
	padding: 0;
}

/* ==========================================================================
   Empty States
   ========================================================================== */

.categorix-empty-state {
	text-align: center;
	padding: 40px 20px;
	color: #6b7280;
}

.categorix-empty-state .dashicons {
	font-size: 48px;
	width: 48px;
	height: 48px;
	color: #d1d5db;
	margin-bottom: 12px;
}

.categorix-empty-state-success .dashicons {
	color: #10b981;
}

.categorix-empty-state p {
	font-size: 15px;
	margin-bottom: 16px;
}

/* ==========================================================================
   Bulk Wizard
   ========================================================================== */

.categorix-wizard-start {
	text-align: center;
}

.categorix-wizard-summary {
	font-size: 16px;
	color: #374151;
	margin-bottom: 24px;
}

.categorix-wizard-options {
	display: flex;
	gap: 16px;
	margin-bottom: 24px;
	justify-content: center;
}

.categorix-radio-card {
	display: block;
	cursor: pointer;
	flex: 1;
	max-width: 280px;
}

.categorix-radio-card input[type="radio"] {
	display: none;
}

.categorix-radio-card-content {
	display: flex;
	flex-direction: column;
	padding: 16px;
	border: 2px solid #e5e7eb;
	border-radius: 8px;
	transition: border-color 0.2s, background 0.2s;
}

.categorix-radio-card input:checked + .categorix-radio-card-content {
	border-color: #1e3a5f;
	background: #eef2f7;
}

.categorix-radio-card-content strong {
	font-size: 14px;
	color: #1d2327;
	margin-bottom: 4px;
}

.categorix-radio-card-content span {
	font-size: 12px;
	color: #6b7280;
}

.categorix-wizard-info {
	display: inline-flex;
	align-items: flex-start;
	gap: 8px;
	padding: 12px 16px;
	background: #eff6ff;
	border-radius: 8px;
	margin-bottom: 24px;
	text-align: left;
	font-size: 13px;
	color: #1d4ed8;
}

.categorix-wizard-info .dashicons {
	flex-shrink: 0;
	margin-top: 1px;
}

#categorix-start-bulk {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: #1e3a5f;
	border-color: #162d4a;
	font-size: 16px;
	padding: 10px 32px;
	height: auto;
}

#categorix-start-bulk:hover {
	background: #162d4a;
	border-color: #0f2035;
}

#categorix-start-bulk .dashicons {
	font-size: 20px;
	width: 20px;
	height: 20px;
}

/* ==========================================================================
   Progress Bar
   ========================================================================== */

.categorix-batch-progress {
	padding: 8px 0;
}

.categorix-progress-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 8px;
}

.categorix-progress-status {
	font-size: 14px;
	font-weight: 600;
	color: #1e3a5f;
}

.categorix-progress-percent {
	font-size: 14px;
	font-weight: 700;
	color: #1d2327;
}

.categorix-progress-bar-wrap {
	height: 12px;
	background: #f3f4f6;
	border-radius: 6px;
	overflow: hidden;
	margin-bottom: 12px;
}

.categorix-progress-bar {
	height: 100%;
	background: linear-gradient(90deg, #1e3a5f, #3b6fa0);
	border-radius: 6px;
	transition: width 0.5s ease;
	min-width: 0;
}

.categorix-progress-details {
	text-align: center;
	font-size: 13px;
	color: #6b7280;
	margin-bottom: 16px;
}

.categorix-progress-stats {
	display: flex;
	justify-content: center;
	gap: 32px;
	margin-bottom: 16px;
}

.categorix-mini-stat {
	display: flex;
	flex-direction: column;
	align-items: center;
}

.categorix-mini-stat-value {
	font-size: 20px;
	font-weight: 700;
	color: #1d2327;
}

.categorix-mini-stat-label {
	font-size: 11px;
	color: #9ca3af;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.categorix-progress-actions {
	text-align: center;
}

/* ==========================================================================
   Quick Actions
   ========================================================================== */

.categorix-quick-actions {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.categorix-action-link {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 16px;
	border-radius: 6px;
	text-decoration: none;
	color: #1d2327;
	transition: background 0.15s;
}

.categorix-action-link:hover {
	background: #f9fafb;
	color: #1d2327;
}

.categorix-action-link .dashicons {
	color: #1e3a5f;
	font-size: 20px;
	width: 20px;
	height: 20px;
}

.categorix-action-link strong {
	display: block;
	font-size: 14px;
	margin-bottom: 2px;
}

.categorix-action-link span {
	font-size: 12px;
	color: #6b7280;
}

/* ==========================================================================
   Activity Table
   ========================================================================== */

.categorix-activity-table {
	width: 100%;
	border-collapse: collapse;
}

.categorix-activity-table th {
	text-align: left;
	padding: 10px 12px;
	font-size: 12px;
	font-weight: 600;
	color: #6b7280;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	border-bottom: 1px solid #f0f0f0;
}

.categorix-activity-table td {
	padding: 10px 12px;
	font-size: 13px;
	border-bottom: 1px solid #f9fafb;
	vertical-align: middle;
}

.categorix-activity-table td code {
	background: #f3f4f6;
	padding: 2px 6px;
	border-radius: 3px;
	font-size: 12px;
}

.categorix-table-footer {
	padding: 12px 0 0;
	text-align: center;
}

/* ==========================================================================
   Confidence Badges
   ========================================================================== */

.categorix-confidence {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 12px;
	font-size: 12px;
	font-weight: 600;
}

.categorix-confidence-high {
	background: #ecfdf5;
	color: #059669;
}

.categorix-confidence-medium {
	background: #fef3c7;
	color: #d97706;
}

.categorix-confidence-low {
	background: #fef2f2;
	color: #dc2626;
}

/* ==========================================================================
   Status Badges
   ========================================================================== */

.categorix-badge {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 12px;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.3px;
}

.categorix-badge-pending,
.categorix-badge-low_confidence {
	background: #dbeafe;
	color: #2563eb;
}

.categorix-badge-auto_applied {
	background: #ecfdf5;
	color: #059669;
}

.categorix-badge-approved {
	background: #d1fae5;
	color: #047857;
}

.categorix-badge-rejected {
	background: #fef2f2;
	color: #dc2626;
}

.categorix-badge-reverted {
	background: #f3f4f6;
	color: #6b7280;
}

.categorix-badge-failed {
	background: #fef2f2;
	color: #dc2626;
}

/* ==========================================================================
   Review Queue
   ========================================================================== */

.categorix-status-tabs {
	display: flex;
	list-style: none;
	padding: 0;
	margin: 0 0 20px 0;
	gap: 0;
	border-bottom: 2px solid #e5e7eb;
}

.categorix-status-tabs li {
	margin: 0;
}

.categorix-status-tabs li a {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 10px 18px;
	text-decoration: none;
	font-size: 14px;
	font-weight: 500;
	color: #6b7280;
	border-bottom: 2px solid transparent;
	margin-bottom: -2px;
	transition: color 0.15s, border-color 0.15s;
}

.categorix-status-tabs li a:hover {
	color: #1d2327;
}

.categorix-status-tabs li.categorix-tab-active a {
	color: #1e3a5f;
	border-bottom-color: #1e3a5f;
}

.categorix-tab-count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 20px;
	height: 20px;
	padding: 0 6px;
	background: #f3f4f6;
	border-radius: 10px;
	font-size: 11px;
	font-weight: 700;
	color: #6b7280;
}

.categorix-tab-active .categorix-tab-count {
	background: #eef2f7;
	color: #1e3a5f;
}

.categorix-bulk-actions {
	display: flex;
	gap: 8px;
	margin-bottom: 16px;
}

.categorix-bulk-actions .button {
	display: inline-flex;
	align-items: center;
	gap: 4px;
}

.categorix-bulk-actions .dashicons {
	font-size: 16px;
	width: 16px;
	height: 16px;
}

/* Review Table */
.categorix-review-table {
	border: none;
}

.categorix-review-table th {
	padding: 12px 16px;
	font-size: 12px;
	font-weight: 600;
	color: #6b7280;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	border-bottom: 1px solid #e5e7eb;
	background: #f9fafb;
}

.categorix-review-table td {
	padding: 12px 16px;
	vertical-align: middle;
	border-bottom: 1px solid #f3f4f6;
}

.categorix-review-row.categorix-row-processing {
	opacity: 0.5;
	pointer-events: none;
}

.categorix-review-row.categorix-row-done {
	background: #f0fdf4;
}

.categorix-review-row.categorix-row-rejected {
	background: #fefce8;
}

.categorix-col-thumb img {
	width: 40px;
	height: 40px;
	border-radius: 4px;
	object-fit: cover;
}

.categorix-col-product a {
	font-weight: 500;
	text-decoration: none;
}

.categorix-col-arrow .dashicons {
	color: #d1d5db;
}

.categorix-cat-old {
	color: #9ca3af;
	text-decoration: line-through;
	font-size: 13px;
}

.categorix-cat-new {
	color: #059669;
	font-weight: 600;
	font-size: 13px;
}

.categorix-path-detail {
	color: #9ca3af;
	font-size: 11px;
}

.categorix-col-actions {
	white-space: nowrap;
}

.categorix-col-actions .button {
	padding: 0 6px;
	min-height: 28px;
}

.categorix-col-actions .dashicons {
	font-size: 16px;
	width: 16px;
	height: 16px;
}

.categorix-approve-btn .dashicons {
	color: #059669;
}

.categorix-reject-btn .dashicons {
	color: #dc2626;
}

.categorix-revert-btn .dashicons {
	color: #d97706;
}

.categorix-action-done {
	color: #d1d5db;
}

/* Pagination */
.categorix-pagination {
	margin-top: 20px;
	text-align: center;
}

.categorix-pagination .page-numbers {
	display: inline-block;
	padding: 6px 12px;
	margin: 0 2px;
	text-decoration: none;
	border: 1px solid #e5e7eb;
	border-radius: 4px;
	font-size: 13px;
	color: #6b7280;
}

.categorix-pagination .page-numbers.current {
	background: #1e3a5f;
	border-color: #1e3a5f;
	color: #fff;
}

/* ==========================================================================
   Settings Page
   ========================================================================== */

.categorix-settings-grid {
	display: grid;
	grid-template-columns: 2fr 1fr;
	gap: 24px;
	align-items: start;
}

.categorix-card-settings .form-table th {
	padding: 16px 12px 16px 0;
	font-weight: 600;
}

.categorix-card-settings .form-table td {
	padding: 12px 0;
}

.categorix-settings-sidebar {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.categorix-api-key-wrap {
	display: flex;
	align-items: center;
	gap: 8px;
}

.categorix-key-status {
	font-size: 13px;
	font-weight: 500;
}

.categorix-key-status.success {
	color: #059669;
}

.categorix-key-status.error {
	color: #dc2626;
}

.categorix-key-status.loading {
	color: #6b7280;
}

/* Steps list */
.categorix-steps {
	padding-left: 20px;
	margin: 0;
}

.categorix-steps li {
	margin-bottom: 16px;
	font-size: 13px;
	color: #374151;
}

.categorix-steps li:last-child {
	margin-bottom: 0;
}

.categorix-steps li strong {
	display: block;
	font-size: 14px;
	color: #1d2327;
	margin-bottom: 4px;
}

.categorix-steps li p {
	margin: 0;
	color: #6b7280;
}

/* Confidence guide */
.categorix-confidence-guide {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.categorix-guide-item {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 13px;
	color: #6b7280;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media screen and (max-width: 960px) {
	.categorix-main-grid,
	.categorix-settings-grid {
		grid-template-columns: 1fr;
	}

	.categorix-stats-grid {
		grid-template-columns: repeat(2, 1fr);
	}

	.categorix-wizard-options {
		flex-direction: column;
		align-items: center;
	}

	.categorix-radio-card {
		max-width: 100%;
	}
}

@media screen and (max-width: 600px) {
	.categorix-header {
		flex-direction: column;
		align-items: flex-start;
		gap: 12px;
	}

	.categorix-stats-grid {
		grid-template-columns: 1fr;
	}

	.categorix-status-tabs {
		overflow-x: auto;
	}
}

/* ==========================================================================
   Loading Spinner
   ========================================================================== */

.categorix-spinner {
	display: inline-block;
	width: 16px;
	height: 16px;
	border: 2px solid #e5e7eb;
	border-top-color: #1e3a5f;
	border-radius: 50%;
	animation: categorix-spin 0.6s linear infinite;
	vertical-align: middle;
}

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

/* Toast notifications */
.categorix-toast {
	position: fixed;
	bottom: 24px;
	right: 24px;
	padding: 12px 20px;
	border-radius: 8px;
	font-size: 14px;
	font-weight: 500;
	color: #fff;
	z-index: 99999;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
	animation: categorix-slide-in 0.3s ease;
}

.categorix-toast-success {
	background: #059669;
}

.categorix-toast-error {
	background: #dc2626;
}

.categorix-toast-info {
	background: #2563eb;
}

@keyframes categorix-slide-in {
	from {
		transform: translateY(20px);
		opacity: 0;
	}
	to {
		transform: translateY(0);
		opacity: 1;
	}
}

/* ==========================================================================
   Category Sync
   ========================================================================== */

.categorix-sync-status-wrap {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
}

.categorix-sync-info {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	color: #374151;
}

.categorix-sync-info .dashicons {
	font-size: 18px;
	width: 18px;
	height: 18px;
}

#categorix-sync-now {
	display: inline-flex;
	align-items: center;
	gap: 4px;
}

#categorix-sync-now .dashicons {
	font-size: 14px;
	width: 14px;
	height: 14px;
}

.categorix-sync-badge {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 4px 10px;
	background: #f0fdf4;
	border-radius: 12px;
	font-size: 12px;
	color: #059669;
	margin-left: 8px;
}

.categorix-sync-badge .dashicons {
	font-size: 14px;
	width: 14px;
	height: 14px;
}

/* ==========================================================================
   Connection Card (Settings)
   ========================================================================== */

.categorix-connect-card {
	border-top: 3px solid #1e3a5f;
	margin-bottom: 24px;
}

.categorix-connect-card .categorix-card-body {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.categorix-connect-input-row {
	display: flex;
	align-items: center;
	gap: 10px;
}

.categorix-connect-input-row input {
	flex: 1;
	max-width: 400px;
}

.categorix-btn-connect {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: #1e3a5f !important;
	border-color: #162d4a !important;
	color: #fff !important;
}

.categorix-btn-connect:hover {
	background: #162d4a !important;
	border-color: #0f2035 !important;
}

.categorix-connect-status {
	font-size: 13px;
	font-weight: 500;
	min-height: 20px;
}

.categorix-connect-status.success {
	color: #059669;
}

.categorix-connect-status.error {
	color: #dc2626;
}

.categorix-connect-status.loading {
	color: #6b7280;
}

/* ==========================================================================
   Callout Box
   ========================================================================== */

.categorix-callout {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 14px 18px;
	border-radius: 8px;
	font-size: 13px;
	line-height: 1.5;
	margin-bottom: 20px;
}

.categorix-callout .dashicons {
	flex-shrink: 0;
	margin-top: 1px;
	font-size: 18px;
	width: 18px;
	height: 18px;
}

.categorix-callout-warning {
	background: #fffbeb;
	border: 1px solid #fde68a;
	color: #92400e;
}

.categorix-callout-info {
	background: #eff6ff;
	border: 1px solid #bfdbfe;
	color: #1e40af;
}

.categorix-callout-success {
	background: #ecfdf5;
	border: 1px solid #a7f3d0;
	color: #065f46;
}

.categorix-callout a {
	font-weight: 600;
	text-decoration: underline;
}

/* ==========================================================================
   Catalog Health Bar
   ========================================================================== */

.categorix-health-bar-wrap {
	width: 100%;
	margin-top: 6px;
}

.categorix-health-bar {
	height: 6px;
	background: #f3f4f6;
	border-radius: 3px;
	overflow: hidden;
}

.categorix-health-bar-fill {
	height: 100%;
	background: #10b981;
	border-radius: 3px;
	transition: width 0.5s ease;
}

.categorix-health-percent {
	font-size: 11px;
	color: #6b7280;
	margin-top: 2px;
}

/* ==========================================================================
   How It Works (Dashboard)
   ========================================================================== */

.categorix-how-it-works {
	display: flex;
	flex-direction: column;
	gap: 0;
}

.categorix-how-step {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 12px 0;
	border-bottom: 1px solid #f3f4f6;
}

.categorix-how-step:last-child {
	border-bottom: none;
}

.categorix-how-step-num {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: #eef2f7;
	color: #1e3a5f;
	font-size: 12px;
	font-weight: 700;
	flex-shrink: 0;
}

.categorix-how-step-text {
	font-size: 13px;
	color: #374151;
	line-height: 1.5;
}

.categorix-how-step-text strong {
	color: #1d2327;
}

/* ==========================================================================
   Results Count (Review Queue)
   ========================================================================== */

.categorix-results-count {
	font-size: 13px;
	color: #6b7280;
	margin-bottom: 12px;
}

.categorix-results-count strong {
	color: #1d2327;
}

/* ==========================================================================
   Completion Summary
   ========================================================================== */

.categorix-completion-summary {
	text-align: center;
	padding: 16px 0;
}

.categorix-completion-summary h3 {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	font-size: 18px;
	color: #059669;
	margin: 0 0 12px 0;
}

.categorix-completion-summary .dashicons {
	color: #059669;
}

.categorix-completion-actions {
	display: flex;
	gap: 8px;
	justify-content: center;
	margin-top: 16px;
}

/* ==========================================================================
   Settings Main Column
   ========================================================================== */

.categorix-settings-main {
	display: flex;
	flex-direction: column;
	gap: 24px;
}

/* ==========================================================================
   Usage Box
   ========================================================================== */

.categorix-usage-box {
	padding: 12px 16px;
	background: #f8fafc;
	border: 1px solid #e5e7eb;
	border-radius: 6px;
	font-size: 13px;
}

.categorix-usage-plan {
	margin-bottom: 4px;
	color: #1d2327;
}

.categorix-usage-credits {
	color: #374151;
	margin-bottom: 6px;
}

.categorix-usage-detail {
	color: #9ca3af;
	margin-left: 4px;
}
