/* ============================================
Base Table Styles
============================================ */

tr.sticky {
	background-color: white;
	position: sticky;
	top: 0;
	z-index: 10;
}

table {
	width: 100%;
	border-collapse: collapse;
	background-color: white;
}

th,
td {
	padding: 0.75rem;
	text-align: left;
	border-bottom: 1px solid #e0e0e0;
}

th {
	background-color: #f5f5f5;
	font-weight: 600;
	color: #333;
	white-space: nowrap;
}

tbody tr {
	transition: background-color 0.2s ease;
}

tbody tr:hover {
	background-color: #fafafa;
}

/* Action button styles */
.action-btn {
	padding: 0.4rem 0.6rem;
	font-size: 0.875rem;
	white-space: nowrap;
}

/* ============================================
Mobile: Stacked Table Layout
============================================ */

@media only screen and (max-width: 768px) {

	/* Ensure card body doesn't create horizontal scroll */
	.card-body {
		overflow-x: hidden !important;
	}

	/* Convert table to block layout for mobile */
	table.table-stacked {
		display: block !important;
		width: 100% !important;
		max-width: 100% !important;
		margin: 0 !important;
		padding: 0 !important;
		overflow-x: hidden !important;
		overflow-y: visible !important;
		background-color: transparent !important;
	}

	table.table-stacked thead,
	table.table-stacked tbody,
	table.table-stacked tfoot,
	table.table-stacked tr {
		display: block !important;
		width: 100% !important;
	}

	table.table-stacked th {
		display: none !important;
	}

	/* Style each row as a card */
	table.table-stacked tbody tr {
		margin-bottom: 0.5rem;
		border: 1px solid #e0e0e0;
		border-radius: 0.375rem;
		overflow: hidden;
		background-color: white;
		box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
	}

	table.table-stacked tbody tr:hover {
		box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
	}

	/* Style cells with labels */
	table.table-stacked td {
		display: block !important;
		width: 100% !important;
		border: none !important;
		border-bottom: 1px solid #f0f0f0;
		position: relative;
		padding-left: 50% !important;
		padding-right: 0.75rem !important;
		padding-top: 0.75rem !important;
		padding-bottom: 0.75rem !important;
		text-align: left;
		word-break: break-word;
	}

	table.table-stacked td:last-child {
		border-bottom: none;
	}

	/* No-data cells should be centered, not stacked */
	table.table-stacked td.no-data {
		padding-left: 1rem !important;
		padding-right: 1rem !important;
		text-align: center !important;
	}

	table.table-stacked td.no-data::before {
		display: none !important;
	}

	/* Add labels before each cell value */
	table.table-stacked td::before {
		content: attr(data-label);
		position: absolute;
		left: 0.75rem;
		top: 0.75rem;
		font-weight: 700;
		color: #555;
		width: calc(50% - 1.5rem);
		text-align: left;
		font-size: 0.9rem;
	}

	.action-btn {
		padding: 0.3rem 0.4rem !important;
		font-size: 0.7rem !important;
		margin: 0.05rem !important;
		display: inline-block;
	}
}

/* ============================================
Tablet - Enhanced Layout
============================================ */

@media only screen and (min-width: 769px) and (max-width: 1024px) {

	th,
	td {
		padding: 0.6rem 0.5rem;
		font-size: 0.9rem;
	}

	.action-btn {
		padding: 0.35rem 0.5rem !important;
		font-size: 0.8rem;
	}
}

/* ============================================
Desktop - Full Table Layout
============================================ */

@media only screen and (min-width: 1025px) {

	th,
	td {
		padding: 0.875rem;
	}

	.action-btn {
		padding: 0.5rem 0.75rem;
	}
}