/**
 * PCML Status Dashboard Styles
 * Admin-only (03_pcadmin) - included in bundle_pcadmin
 */

/* Dashboard Container */
.pcml-status-dashboard {
	max-width: 1200px;
	margin: 0 auto;
	padding: 20px;
}

.pcml-status-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 20px;
}

.pcml-status-header h2 {
	margin: 0;
	font-size: 1.5rem;
	font-weight: 600;
}

.pcml-status-update-time {
	color: #666;
	font-size: 0.85rem;
}

.pcml-status-loading,
.pcml-status-empty {
	padding: 40px;
	text-align: center;
	color: #666;
	background: #f9f9f9;
	border-radius: 8px;
}

/* Instance Cards */
.pcml-status-list {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.pcml-instance-card {
	background: #fff;
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	overflow: hidden;
	transition: box-shadow 0.2s ease;
}

.pcml-instance-card:hover {
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.pcml-instance-card[data-health="dead"] {
	border-left: 4px solid #dc3545;
}

.pcml-instance-card[data-health="warning"] {
	border-left: 4px solid #ffc107;
}

.pcml-instance-card[data-health="healthy"] {
	border-left: 4px solid #28a745;
}

/* Card Header */
.pcml-card-header {
	display: flex;
	align-items: center;
	padding: 16px 20px;
	cursor: pointer;
	gap: 16px;
	background: #fafafa;
	transition: background 0.15s ease;
}

.pcml-card-header:hover {
	background: #f0f0f0;
}

/* Health Indicator Dot */
.pcml-health-indicator {
	width: 12px;
	height: 12px;
	border-radius: 50%;
	flex-shrink: 0;
}

.pcml-health-indicator[data-status="healthy"] {
	background: #28a745;
	box-shadow: 0 0 6px rgba(40, 167, 69, 0.5);
}

.pcml-health-indicator[data-status="warning"] {
	background: #ffc107;
	box-shadow: 0 0 6px rgba(255, 193, 7, 0.5);
	animation: pulse-warning 2s infinite;
}

.pcml-health-indicator[data-status="dead"] {
	background: #dc3545;
	box-shadow: 0 0 6px rgba(220, 53, 69, 0.5);
}

@keyframes pulse-warning {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.6; }
}

/* Card Title */
.pcml-card-title {
	flex: 1;
	min-width: 0;
}

.pcml-profile-name {
	font-weight: 600;
	font-size: 1.1rem;
	color: #333;
}

.pcml-port {
	color: #666;
	font-size: 0.9rem;
	margin-left: 4px;
}

/* Card Meta */
.pcml-card-meta {
	display: flex;
	align-items: center;
	gap: 12px;
	font-size: 0.85rem;
	color: #666;
}

.pcml-uptime,
.pcml-last-ping {
	white-space: nowrap;
}

.pcml-error-badge {
	background: #dc3545;
	color: #fff;
	padding: 2px 8px;
	border-radius: 12px;
	font-size: 0.75rem;
	font-weight: 600;
}

/* Service Indicators */
.pcml-service-indicators {
	display: flex;
	gap: 6px;
}

.pcml-service-indicator {
	padding: 2px 6px;
	border-radius: 4px;
	font-size: 0.7rem;
	font-weight: 600;
	background: #e0e0e0;
	color: #666;
}

.pcml-service-indicator[data-available="true"] {
	background: #d4edda;
	color: #155724;
}

.pcml-service-indicator[data-available="false"] {
	background: #f8d7da;
	color: #721c24;
}

/* Expand Icon */
.pcml-expand-icon {
	font-size: 0.8rem;
	color: #999;
	transition: transform 0.2s ease;
}

.pcml-instance-card[data-expanded="true"] .pcml-expand-icon {
	transform: rotate(0deg);
}

/* Card Details (Expanded) */
.pcml-card-details {
	border-top: 1px solid #e0e0e0;
	background: #fff;
}

/* Tabs */
.pcml-tabs {
	display: flex;
	border-bottom: 1px solid #e0e0e0;
	padding: 0 20px;
	background: #fafafa;
}

.pcml-tab {
	padding: 12px 20px;
	border: none;
	background: none;
	cursor: pointer;
	font-size: 0.9rem;
	color: #666;
	border-bottom: 2px solid transparent;
	margin-bottom: -1px;
	transition: all 0.15s ease;
}

.pcml-tab:hover {
	color: #333;
	background: #f0f0f0;
}

.pcml-tab.active {
	color: #007bff;
	border-bottom-color: #007bff;
	font-weight: 500;
}

.pcml-tab-content {
	padding: 20px;
	max-height: 400px;
	overflow-y: auto;
}

/* Logs Tab */
.pcml-logs {
	font-family: 'Consolas', 'Monaco', monospace;
	font-size: 0.8rem;
}

.pcml-logs-empty,
.pcml-scheduler-empty {
	color: #999;
	font-style: italic;
}

.pcml-log-entry {
	display: flex;
	gap: 12px;
	padding: 4px 0;
	border-bottom: 1px solid #f0f0f0;
}

.pcml-log-entry:last-child {
	border-bottom: none;
}

.pcml-log-time {
	color: #999;
	white-space: nowrap;
}

.pcml-log-level {
	font-weight: 600;
	width: 50px;
	flex-shrink: 0;
}

.pcml-log-entry[data-level="error"] .pcml-log-level {
	color: #dc3545;
}

.pcml-log-entry[data-level="warn"] .pcml-log-level {
	color: #ffc107;
}

.pcml-log-entry[data-level="info"] .pcml-log-level {
	color: #17a2b8;
}

.pcml-log-message {
	color: #333;
	word-break: break-word;
}

/* Scheduler Tab */
.pcml-scheduler-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.85rem;
}

.pcml-scheduler-table th,
.pcml-scheduler-table td {
	padding: 10px 12px;
	text-align: left;
	border-bottom: 1px solid #e0e0e0;
}

.pcml-scheduler-table th {
	background: #f5f5f5;
	font-weight: 600;
	color: #555;
}

.pcml-scheduler-table tbody tr:hover {
	background: #f9f9f9;
}

/* Metrics Tab */
.pcml-metrics {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
	gap: 20px;
}

.pcml-metrics-section {
	background: #f9f9f9;
	border-radius: 6px;
	padding: 16px;
}

.pcml-metrics-section h4 {
	margin: 0 0 12px 0;
	font-size: 0.9rem;
	color: #555;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.pcml-metric-row {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 8px;
	font-size: 0.85rem;
}

.pcml-metric-row:last-child {
	margin-bottom: 0;
}

.pcml-metric-label {
	color: #666;
	min-width: 100px;
}

.pcml-metric-value {
	color: #333;
	flex: 1;
}

.pcml-metric-path {
	font-family: monospace;
	font-size: 0.75rem;
	word-break: break-all;
}

.pcml-metric-na {
	color: #999;
	font-style: italic;
}

/* Memory Bar */
.pcml-metric-bar {
	width: 100px;
	height: 8px;
	background: #e0e0e0;
	border-radius: 4px;
	overflow: hidden;
	flex-shrink: 0;
}

.pcml-metric-bar-fill {
	height: 100%;
	background: linear-gradient(90deg, #28a745, #ffc107, #dc3545);
	background-size: 300% 100%;
	border-radius: 4px;
	transition: width 0.3s ease;
}

/* Status Badges */
.pcml-status-badge {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 4px;
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: lowercase;
}

.pcml-status-green,
.pcml-status-available {
	background: #d4edda;
	color: #155724;
}

.pcml-status-yellow {
	background: #fff3cd;
	color: #856404;
}

.pcml-status-red,
.pcml-status-unavailable {
	background: #f8d7da;
	color: #721c24;
}

/* Indexers Tab */
.pcml-indexers {
	overflow-x: auto;
}

.pcml-indexers-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.85rem;
}

.pcml-indexers-table th,
.pcml-indexers-table td {
	padding: 10px 12px;
	text-align: left;
	border-bottom: 1px solid #e0e0e0;
}

.pcml-indexers-table th {
	background: #f5f5f5;
	font-weight: 600;
	color: #555;
	white-space: nowrap;
}

.pcml-indexers-table tbody tr:hover {
	background: #f9f9f9;
}

.pcml-indexer-name {
	display: block;
	font-size: 0.75rem;
	color: #888;
	margin-top: 2px;
}

.pcml-indexer-count {
	font-weight: 600;
	color: #007bff;
}

.pcml-indexers-empty {
	color: #999;
	font-style: italic;
}

/* ===========================================
   System Overview Section
   =========================================== */

.pcml-system-overview {
	margin-bottom: 32px;
}

.pcml-system-overview--loading {
	padding: 20px;
	text-align: center;
	color: #666;
	background: #f9f9f9;
	border-radius: 8px;
}

/* Section Headers */
.pcml-section-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin: 24px 0 16px;
	padding-bottom: 8px;
	border-bottom: 2px solid #e0e0e0;
}

.pcml-section-header h3 {
	margin: 0;
	font-size: 1.1rem;
	font-weight: 600;
	color: #333;
}

.pcml-section-summary {
	font-size: 0.85rem;
	color: #666;
}

/* Status Strip */
.pcml-status-strip {
	display: flex;
	gap: 2px;
	background: #e0e0e0;
	border-radius: 8px;
	overflow: hidden;
	margin-bottom: 24px;
}

.pcml-status-strip-item {
	flex: 1;
	padding: 16px 20px;
	background: #fff;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	transition: background 0.2s ease;
}

.pcml-status-strip-item:first-child {
	border-radius: 8px 0 0 8px;
}

.pcml-status-strip-item:last-child {
	border-radius: 0 8px 8px 0;
}

.pcml-status-strip-item[data-status="healthy"] {
	border-top: 3px solid #28a745;
}

.pcml-status-strip-item[data-status="warning"] {
	border-top: 3px solid #ffc107;
}

.pcml-status-strip-item[data-status="dead"] {
	border-top: 3px solid #dc3545;
}

.pcml-status-strip-label {
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: #666;
}

.pcml-status-strip-value {
	font-size: 1.1rem;
	font-weight: 600;
	color: #333;
}

/* Indexer Progress Grid */
.pcml-indexer-progress-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: 16px;
	margin-bottom: 24px;
}

.pcml-indexer-card {
	background: #fff;
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	padding: 16px;
	transition: box-shadow 0.2s ease;
}

.pcml-indexer-card:hover {
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.pcml-indexer-card[data-health="healthy"] {
	border-left: 4px solid #28a745;
}

.pcml-indexer-card[data-health="warning"] {
	border-left: 4px solid #ffc107;
}

.pcml-indexer-card[data-health="dead"] {
	border-left: 4px solid #dc3545;
}

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

.pcml-indexer-card-title {
	font-weight: 600;
	font-size: 1rem;
	color: #333;
}

.pcml-indexer-card-percentage {
	font-size: 1.2rem;
	font-weight: 700;
	color: #007bff;
}

.pcml-indexer-card-counts {
	font-size: 0.85rem;
	color: #666;
	margin-bottom: 10px;
}

/* Stacked Progress Bar */
.pcml-indexer-bar {
	display: flex;
	height: 10px;
	background: #f0f0f0;
	border-radius: 5px;
	overflow: hidden;
	margin-bottom: 10px;
}

.pcml-indexer-bar-segment {
	height: 100%;
	transition: width 0.3s ease;
}

.pcml-indexer-bar-fresh {
	background: #28a745;
}

.pcml-indexer-bar-aging {
	background: #ffc107;
}

.pcml-indexer-bar-stale {
	background: #dc3545;
}

.pcml-indexer-bar-never {
	background: #6c757d;
}

/* Time Tier Pills */
.pcml-indexer-card-tiers {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
	font-size: 0.75rem;
}

.pcml-tier {
	display: flex;
	align-items: center;
	gap: 2px;
	color: #666;
}

.pcml-tier-fresh {
	color: #28a745;
}

.pcml-tier-aging {
	color: #ffc107;
}

.pcml-tier-stale {
	color: #dc3545;
}

.pcml-tier-never {
	color: #6c757d;
}

.pcml-indexer-card-last {
	margin-top: 10px;
	font-size: 0.75rem;
	color: #999;
}

/* Elasticsearch Stats */
.pcml-es-stats {
	background: #fff;
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	overflow: hidden;
}

.pcml-es-cluster {
	padding: 16px 20px;
	background: #f9f9f9;
	border-bottom: 1px solid #e0e0e0;
}

.pcml-es-cluster-info {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
}

.pcml-es-cluster-name {
	font-weight: 600;
	font-size: 1rem;
	color: #333;
}

.pcml-es-cluster-health {
	padding: 3px 10px;
	border-radius: 12px;
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: uppercase;
}

.pcml-es-health-green {
	background: #d4edda;
	color: #155724;
}

.pcml-es-health-yellow {
	background: #fff3cd;
	color: #856404;
}

.pcml-es-health-red {
	background: #f8d7da;
	color: #721c24;
}

.pcml-es-health-unknown {
	background: #e0e0e0;
	color: #555;
}

.pcml-es-cluster-version,
.pcml-es-cluster-nodes {
	font-size: 0.85rem;
	color: #666;
}

/* ES Index Table */
.pcml-es-indices {
	overflow-x: auto;
}

.pcml-es-indices-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.85rem;
}

.pcml-es-indices-table th,
.pcml-es-indices-table td {
	padding: 12px 16px;
	text-align: left;
	border-bottom: 1px solid #e0e0e0;
}

.pcml-es-indices-table th {
	background: #f5f5f5;
	font-weight: 600;
	color: #555;
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.pcml-es-indices-table tbody tr:hover {
	background: #f9f9f9;
}

.pcml-es-indices-table tbody tr:last-child td {
	border-bottom: none;
}

.pcml-es-index-name {
	font-family: 'Consolas', 'Monaco', monospace;
	font-size: 0.8rem;
	color: #333;
}

.pcml-es-health-badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 0.85rem;
}

.pcml-es-health-badge::before {
	content: "";
	display: inline-block;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	flex-shrink: 0;
}

.pcml-es-health-badge.pcml-es-health-green::before {
	background: #28a745;
	box-shadow: 0 0 4px rgba(40, 167, 69, 0.5);
}

.pcml-es-health-badge.pcml-es-health-yellow::before {
	background: #ffc107;
}

.pcml-es-health-badge.pcml-es-health-red::before {
	background: #dc3545;
}

.pcml-es-index-docs,
.pcml-es-index-size {
	font-variant-numeric: tabular-nums;
	color: #555;
}

/* Responsive */
@media (max-width: 768px) {
	.pcml-status-dashboard {
		padding: 12px;
	}

	.pcml-card-header {
		flex-wrap: wrap;
		gap: 10px;
	}

	.pcml-card-meta {
		width: 100%;
		order: 3;
	}

	.pcml-metrics {
		grid-template-columns: 1fr;
	}

	.pcml-indexers-table {
		font-size: 0.75rem;
	}

	.pcml-indexers-table th,
	.pcml-indexers-table td {
		padding: 6px 8px;
	}
	
	/* System Overview Responsive */
	.pcml-status-strip {
		flex-direction: column;
		gap: 1px;
	}
	
	.pcml-status-strip-item {
		flex-direction: row;
		justify-content: space-between;
		padding: 12px 16px;
	}
	
	.pcml-status-strip-item:first-child,
	.pcml-status-strip-item:last-child {
		border-radius: 0;
	}
	
	.pcml-status-strip-item[data-status] {
		border-top: none;
		border-left: 3px solid;
	}
	
	.pcml-status-strip-item[data-status="healthy"] {
		border-left-color: #28a745;
	}
	
	.pcml-status-strip-item[data-status="warning"] {
		border-left-color: #ffc107;
	}
	
	.pcml-status-strip-item[data-status="dead"] {
		border-left-color: #dc3545;
	}
	
	.pcml-indexer-progress-grid {
		grid-template-columns: 1fr;
	}
	
	.pcml-section-header {
		flex-direction: column;
		align-items: flex-start;
		gap: 4px;
	}
	
	.pcml-es-cluster-info {
		flex-direction: column;
		align-items: flex-start;
		gap: 8px;
	}
	
	.pcml-es-indices-table th,
	.pcml-es-indices-table td {
		padding: 8px 12px;
	}
}
