/* ============================================
   Opconnect CSS — Styles globaux
   ============================================ */

/* --- Stat boxes globales (haut de page) --- */
.opconnect-dashboard-stats {
	display: flex !important;
	gap: 15px;
	margin-bottom: 20px;
	flex-wrap: wrap;
}
.opconnect-stat-box {
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 4px;
	padding: 15px 20px;
	min-width: 180px;
	text-align: center;
}
.opconnect-stat-box .stat-number {
	font-size: 2em;
	font-weight: bold;
	display: block;
}
.opconnect-stat-box .stat-label {
	color: #666;
	font-size: 0.9em;
}
.opconnect-stat-box.stat-warning .stat-number { color: #e67e22; }
.opconnect-stat-box.stat-success .stat-number { color: #27ae60; }
.opconnect-stat-box.stat-error .stat-number { color: #e74c3c; }
.opconnect-stat-box.stat-info .stat-number { color: #3498db; }

/* --- Pieces list --- */
.opconnect-pieces-list {
	list-style: none;
	padding: 0;
	margin: 0;
}
.opconnect-pieces-list li {
	padding: 3px 0;
}
.opconnect-pieces-list li .piece-status {
	margin-left: 5px;
}

/* --- Actions bar --- */
.opconnect-actions {
	margin: 15px 0;
}
.opconnect-actions .button {
	margin-right: 5px;
}


/* ============================================
   Dashboard Widgets Grid — Layout principal
   ============================================ */
.opconnect-dashboard-grid {
	display: grid !important;
	grid-template-columns: repeat(3, 1fr) !important;
	gap: 14px !important;
	margin: 16px 0 24px 0;
	padding: 0;
}
@media (max-width: 1200px) {
	.opconnect-dashboard-grid {
		grid-template-columns: repeat(2, 1fr) !important;
	}
}
@media (max-width: 768px) {
	.opconnect-dashboard-grid {
		grid-template-columns: 1fr !important;
	}
}


/* ============================================
   Widget Cards
   ============================================ */
.opconnect-widget {
	background: #ffffff !important;
	border: 1px solid #e0e0e0 !important;
	border-radius: 8px !important;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06) !important;
	display: flex !important;
	flex-direction: column !important;
	overflow: hidden;
	transition: box-shadow 0.2s ease, transform 0.15s ease;
	min-height: 180px;
}
.opconnect-widget:hover {
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12) !important;
	transform: translateY(-2px);
}

/* Colored left border by type */
.opconnect-widget.widget-info    { border-left: 4px solid #3498db !important; }
.opconnect-widget.widget-success { border-left: 4px solid #27ae60 !important; }
.opconnect-widget.widget-warning { border-left: 4px solid #f39c12 !important; }
.opconnect-widget.widget-error   { border-left: 4px solid #e74c3c !important; }

/* Wide widget spans 2 columns */
.opconnect-widget.widget-wide {
	grid-column: span 2;
}
@media (max-width: 768px) {
	.opconnect-widget.widget-wide {
		grid-column: span 1;
	}
}


/* ============================================
   Widget Header
   ============================================ */
.opconnect-widget-header {
	display: flex !important;
	justify-content: space-between !important;
	align-items: center !important;
	padding: 14px 18px !important;
	border-bottom: 1px solid #eee;
	background: linear-gradient(to bottom, #fafbfc, #f5f6f8) !important;
	min-height: 52px;
}
.opconnect-widget-header h3 {
	margin: 0 !important;
	padding: 0 !important;
	font-size: 12px !important;
	font-weight: 700 !important;
	color: #555 !important;
	text-transform: uppercase !important;
	letter-spacing: 0.5px !important;
	line-height: 1.3 !important;
}

/* Badge count in header */
.opconnect-widget-count {
	font-size: 26px !important;
	font-weight: 800 !important;
	line-height: 1;
	min-width: 36px;
	text-align: center;
}
.opconnect-widget-count.count-info    { color: #3498db !important; }
.opconnect-widget-count.count-success { color: #27ae60 !important; }
.opconnect-widget-count.count-warning { color: #f39c12 !important; }
.opconnect-widget-count.count-error   { color: #e74c3c !important; }


/* ============================================
   Widget Body (table rows)
   ============================================ */
.opconnect-widget-body {
	padding: 0 !important;
	flex-grow: 1;
}
.opconnect-widget-body table {
	width: 100% !important;
	border-collapse: collapse !important;
	font-size: 12px !important;
	margin: 0 !important;
}
.opconnect-widget-body table tr {
	border-bottom: 1px solid #f2f3f5 !important;
	transition: background 0.15s ease;
}
.opconnect-widget-body table tr:hover {
	background: #f8f9fb !important;
}
.opconnect-widget-body table tr:last-child {
	border-bottom: none !important;
}
.opconnect-widget-body table td {
	padding: 6px 8px !important;
	vertical-align: middle !important;
	color: #444 !important;
	line-height: 1.4 !important;
	border: none !important;
}
.opconnect-widget-body table td:first-child {
	padding-left: 14px !important;
}
.opconnect-widget-body table td:last-child {
	padding-right: 14px !important;
}
.opconnect-widget-body table td a {
	color: #2980b9 !important;
	text-decoration: none !important;
	font-weight: 600 !important;
}
.opconnect-widget-body table td a:hover {
	text-decoration: underline !important;
	color: #1a5276 !important;
}

/* Truncated text cells */
.opconnect-widget-body .td-truncate {
	max-width: 200px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Empty state message */
.opconnect-widget-empty {
	padding: 30px 20px !important;
	text-align: center;
	color: #aaa !important;
	font-size: 13px !important;
	font-style: italic;
}
.opconnect-widget-empty::before {
	content: "\2714";
	display: block;
	font-size: 28px;
	color: #27ae60;
	margin-bottom: 8px;
	font-style: normal;
}


/* ============================================
   Widget Footer
   ============================================ */
.opconnect-widget-footer {
	padding: 10px 18px !important;
	border-top: 1px solid #eee !important;
	text-align: right;
	background: #fafbfc !important;
}
.opconnect-widget-footer a {
	font-size: 12px !important;
	font-weight: 700 !important;
	text-decoration: none !important;
	color: #3498db !important;
	transition: color 0.15s ease;
}
.opconnect-widget-footer a:hover {
	text-decoration: underline !important;
	color: #1a5276 !important;
}


/* ============================================
   Status badges / pills
   ============================================ */
.opconnect-badge {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 10px;
	font-size: 11px;
	font-weight: 600;
	line-height: 1.5;
	white-space: nowrap;
}
.opconnect-badge-success {
	background: #d4edda;
	color: #155724;
}
.opconnect-badge-warning {
	background: #fff3cd;
	color: #856404;
}
.opconnect-badge-error {
	background: #f8d7da;
	color: #721c24;
}
.opconnect-badge-info {
	background: #d1ecf1;
	color: #0c5460;
}
.opconnect-badge-muted {
	background: #e9ecef;
	color: #6c757d;
}


/* ============================================
   Horizontal bars (stats widget)
   ============================================ */
.opconnect-bar-row {
	display: flex;
	align-items: center;
	padding: 8px 18px;
	border-bottom: 1px solid #f2f3f5;
}
.opconnect-bar-row:last-child {
	border-bottom: none;
}
.opconnect-bar-status {
	min-width: 90px;
	font-size: 12px;
	font-weight: 600;
	color: #555;
}
.opconnect-bar-track {
	flex: 1;
	height: 22px;
	background: #f0f1f3;
	border-radius: 4px;
	overflow: hidden;
	margin: 0 12px;
	position: relative;
}
.opconnect-bar-fill {
	height: 100%;
	border-radius: 4px;
	transition: width 0.6s ease;
	min-width: 2px;
}
.opconnect-bar-fill.bar-success { background: linear-gradient(90deg, #27ae60, #2ecc71); }
.opconnect-bar-fill.bar-warning { background: linear-gradient(90deg, #e67e22, #f39c12); }
.opconnect-bar-fill.bar-error   { background: linear-gradient(90deg, #c0392b, #e74c3c); }
.opconnect-bar-fill.bar-info    { background: linear-gradient(90deg, #2980b9, #3498db); }
.opconnect-bar-fill.bar-muted   { background: linear-gradient(90deg, #7f8c8d, #95a5a6); }
.opconnect-bar-value {
	min-width: 36px;
	text-align: right;
	font-size: 13px;
	font-weight: 700;
	color: #333;
}

/* Legacy bars compat */
.opconnect-bar {
	height: 18px;
	border-radius: 3px;
	display: inline-block;
	min-width: 4px;
	vertical-align: middle;
}
.opconnect-bar-label {
	font-size: 11px;
	margin-left: 6px;
	color: #555;
}


/* ============================================
   Sync widget specific
   ============================================ */
.opconnect-sync-info {
	padding: 16px 18px;
}
.opconnect-sync-info .sync-row {
	display: flex;
	justify-content: space-between;
	padding: 6px 0;
	font-size: 13px;
	color: #555;
	border-bottom: 1px solid #f5f5f5;
}
.opconnect-sync-info .sync-row:last-child {
	border-bottom: none;
}
.opconnect-sync-info .sync-row .sync-label {
	font-weight: 600;
	color: #666;
}
.opconnect-sync-info .sync-row .sync-value {
	font-weight: 700;
	color: #333;
}

/* Sync button */
.opconnect-btn-sync {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 16px;
	background: linear-gradient(to bottom, #27ae60, #229954);
	color: #fff !important;
	border: none;
	border-radius: 5px;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s ease;
	text-decoration: none !important;
}
.opconnect-btn-sync:hover {
	background: linear-gradient(to bottom, #2ecc71, #27ae60);
	box-shadow: 0 2px 6px rgba(39, 174, 96, 0.3);
}
.opconnect-btn-sync.btn-warning {
	background: linear-gradient(to bottom, #e67e22, #d35400);
}
.opconnect-btn-sync.btn-warning:hover {
	background: linear-gradient(to bottom, #f39c12, #e67e22);
	box-shadow: 0 2px 6px rgba(230, 126, 34, 0.3);
}


/* ============================================
   Action buttons in widgets
   ============================================ */
.opconnect-btn-sm {
	display: inline-block;
	padding: 3px 10px;
	font-size: 11px;
	font-weight: 600;
	border-radius: 3px;
	border: 1px solid #3498db;
	background: #fff;
	color: #3498db;
	cursor: pointer;
	text-decoration: none !important;
	transition: all 0.15s ease;
	white-space: nowrap;
}
.opconnect-btn-sm:hover {
	background: #3498db;
	color: #fff !important;
}
.opconnect-btn-sm.btn-success {
	border-color: #27ae60;
	color: #27ae60;
}
.opconnect-btn-sm.btn-success:hover {
	background: #27ae60;
	color: #fff !important;
}


/* ============================================
   Dashboard section title
   ============================================ */
.opconnect-dashboard-title {
	font-size: 15px;
	font-weight: 700;
	color: #2c3e50;
	margin: 0 0 16px 0;
	padding-bottom: 10px;
	border-bottom: 2px solid #3498db;
	display: flex;
	align-items: center;
	gap: 8px;
}
