/**
 * PressPrimer Assignment - My Submissions Dashboard Styles
 *
 * Styles for the [ppa_my_submissions] shortcode dashboard view.
 * Structural layout aligned with PressPrimer Quiz's My Attempts table
 * (table wrapper, header weight, flex actions, 900px card breakpoint).
 * Uses CSS variables for full theme compatibility.
 *
 * Depends on submission.css for base variables, button styles,
 * and status badge styles.
 *
 * @package PressPrimer_Assignment
 * @since 1.0.0
 */

/* ==========================================================================
   Dashboard Container
   ========================================================================== */

.ppa-my-submissions {
	max-width: 1200px;
	margin: 0 auto;
	padding: var(--ppa-space-xl) var(--ppa-space-md);
}

/* ==========================================================================
   Empty State
   ========================================================================== */

.ppa-empty-state {
	background: var(--ppa-background);
	border: 1px solid var(--ppa-border-light);
	border-radius: var(--ppa-radius-lg);
	padding: var(--ppa-space-xl);
	text-align: center;
}

.ppa-empty-state-icon {
	margin-bottom: var(--ppa-space-md);
	color: var(--ppa-text-light);
}

.ppa-empty-state-icon .dashicons {
	font-size: 48px;
	width: 48px;
	height: 48px;
}

.ppa-empty-state-message {
	color: var(--ppa-text-secondary);
	font-size: 1rem;
	margin: 0;
}

/* ==========================================================================
   Table Wrapper
   ========================================================================== */

.ppa-submissions-table-wrapper {
	background: var(--ppa-background);
	border: 1px solid var(--ppa-border-light);
	border-radius: var(--ppa-radius-lg);
	overflow: hidden;
	margin-bottom: var(--ppa-space-xl);
}

/* ==========================================================================
   Submissions Table
   ========================================================================== */

.ppa-submissions-table {
	width: 100%;
	border-collapse: collapse;
}

/* Table Header */
.ppa-submissions-table thead {
	background: var(--ppa-background-gray);
	border-bottom: 2px solid var(--ppa-border-light);
}

.ppa-submissions-table th {
	padding: var(--ppa-space-md);
	text-align: left;
	font-weight: 600;
	color: var(--ppa-text-secondary);
	font-size: 0.875rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

/* Table Body Rows */
.ppa-submissions-table tbody tr {
	transition: var(--ppa-transition-fast);
}

.ppa-submissions-table tbody tr:hover {
	background: var(--ppa-background-gray);
}

.ppa-submissions-table td {
	padding: var(--ppa-space-md);
	border-top: 1px solid var(--ppa-border-light);
	color: var(--ppa-text);
	font-size: 0.9375rem;
}

/* ==========================================================================
   Column-Specific Styles
   ========================================================================== */

/* Assignment column */
.ppa-col-assignment {
	font-weight: 600;
	color: var(--ppa-text);
}

.ppa-attempt-number {
	font-weight: 400;
	color: var(--ppa-text-light);
	font-size: 0.8125rem;
	margin-left: var(--ppa-space-xs);
}

/* Date column */
.ppa-col-date {
	color: var(--ppa-text-light);
	font-size: 0.875rem;
	white-space: nowrap;
}

/* Status column */
.ppa-col-status {
	white-space: nowrap;
}

/* Score column */
.ppa-col-score {
	white-space: nowrap;
}

.ppa-score-display {
	font-weight: 600;
	font-size: 0.875rem;
}

.ppa-score-passed {
	color: var(--ppa-success);
}

.ppa-score-failed {
	color: var(--ppa-error);
}

.ppa-score-pending {
	color: var(--ppa-text-light);
}

/* Actions column */
.ppa-col-actions {
	white-space: nowrap;
}

.ppa-submission-actions {
	display: flex;
	gap: var(--ppa-space-sm);
	flex-wrap: wrap;
}

/* ==========================================================================
   Dashboard-Specific Button Overrides

   The base .ppa-button / .ppa-button-small in submission.css is designed
   for full-width form contexts. Inside the dashboard table we need a
   more compact, inline style matching Quiz's table button pattern.
   ========================================================================== */

.ppa-my-submissions .ppa-button-small {
	padding: 0.375rem 0.75rem;
	font-size: 0.875rem;
	border-radius: 4px;
	font-weight: 500;
	border: 1px solid transparent;
	min-height: auto;
}

.ppa-my-submissions .ppa-button-primary:hover:not(:disabled) {
	transform: none;
	box-shadow: none;
}

/* ==========================================================================
   Responsive: Card Layout on Mobile
   ========================================================================== */

@media (max-width: 900px) {
	.ppa-my-submissions {
		padding: var(--ppa-space-md) 0.75rem;
	}

	/* Card-based layout */
	.ppa-submissions-table-wrapper {
		background: transparent;
		border: none;
		overflow: visible;
	}

	.ppa-submissions-table {
		display: block;
	}

	.ppa-submissions-table thead {
		display: none;
	}

	.ppa-submissions-table tbody {
		display: flex;
		flex-direction: column;
		gap: var(--ppa-space-md);
	}

	.ppa-submissions-table tbody tr {
		display: flex;
		flex-direction: column;
		background: var(--ppa-background);
		border: 1px solid var(--ppa-border-light);
		border-radius: var(--ppa-radius-lg);
		padding: var(--ppa-space-md);
		gap: var(--ppa-space-sm);
	}

	.ppa-submissions-table tbody tr:hover {
		background: var(--ppa-background);
	}

	.ppa-submissions-table td {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 0.375rem 0;
		border: none;
		font-size: 0.875rem;
	}

	.ppa-submissions-table td::before {
		content: attr(data-label);
		font-weight: 600;
		color: var(--ppa-text-light);
		font-size: 0.75rem;
		text-transform: uppercase;
		letter-spacing: 0.05em;
		flex-shrink: 0;
		margin-right: var(--ppa-space-md);
	}

	.ppa-col-assignment {
		font-weight: 600;
		color: var(--ppa-text);
		border-bottom: 1px solid var(--ppa-border-light);
		padding-bottom: 0.75rem;
		margin-bottom: var(--ppa-space-xs);
	}

	.ppa-col-assignment::before {
		display: none;
	}

	.ppa-col-actions {
		border-top: 1px solid var(--ppa-border-light);
		padding-top: 0.75rem;
		margin-top: var(--ppa-space-xs);
		justify-content: flex-start;
	}

	.ppa-col-actions::before {
		display: none;
	}

	.ppa-submission-actions {
		flex-direction: row;
		flex-wrap: wrap;
	}
}

/* ==========================================================================
   RTL Support
   ========================================================================== */

[dir="rtl"] .ppa-submissions-table th {
	text-align: right;
}

[dir="rtl"] .ppa-attempt-number {
	margin-left: 0;
	margin-right: var(--ppa-space-xs);
}

@media (max-width: 900px) {
	[dir="rtl"] .ppa-submissions-table td::before {
		margin-right: 0;
		margin-left: var(--ppa-space-md);
	}

	[dir="rtl"] .ppa-col-actions {
		justify-content: flex-end;
	}
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
	.ppa-my-submissions {
		max-width: none;
		padding: 0;
	}

	.ppa-submissions-table-wrapper {
		border-radius: 0;
		box-shadow: none;
	}

	.ppa-submissions-table-wrapper,
	.ppa-submissions-table th,
	.ppa-submissions-table td {
		border-color: #000;
	}

	.ppa-submissions-table tbody tr:hover {
		background: none;
	}

	.ppa-col-actions {
		display: none;
	}

	.ppa-empty-state {
		border-radius: 0;
		box-shadow: none;
		border-color: #000;
	}
}
