/**
 * EDD Custom Checkout — customer dashboard.
 *
 * Scoped under .eddcc-dash so it can live inside any theme.
 */

.eddcc-dash {
	--eddcc-bg: #f8fafc;
	--eddcc-card: #ffffff;
	--eddcc-border: #e5e7eb;
	--eddcc-border-strong: #d1d5db;
	--eddcc-text: #111827;
	--eddcc-muted: #6b7280;
	--eddcc-primary: #2563eb;
	--eddcc-primary-hover: #1d4ed8;
	--eddcc-primary-soft: #eff5ff;
	--eddcc-radius: 12px;
	--eddcc-radius-sm: 8px;

	box-sizing: border-box;
	display: grid;
	grid-template-columns: 240px 1fr;
	gap: 32px;
	align-items: start;
	color: var(--eddcc-text);
	font-size: 15px;
	line-height: 1.55;
	max-width: var(--wp--style--global--wide-size);
}

.eddcc-dash *,
.eddcc-dash *::before,
.eddcc-dash *::after {
	box-sizing: border-box;
}

/*
 * Not all themes define .screen-reader-text, and a visible "Site URL" label
 * would break the add-site row — so scope our own copy of it here.
 */
.eddcc-dash .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

.eddcc-dash--guest {
	display: block;
	max-width: 480px;
	margin: 0 auto;
}

/* -------------------------------------------------- Sidebar */

.eddcc-dash__sidebar {
	position: sticky;
	top: 24px;
}

.eddcc-dash__user {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px;
	margin-bottom: 16px;
	background: var(--eddcc-card);
	border: 1px solid var(--eddcc-border);
	border-radius: var(--eddcc-radius);
}

.eddcc-dash__avatar {
	border-radius: 50%;
	flex: 0 0 44px;
}

.eddcc-dash__user-meta {
	display: flex;
	flex-direction: column;
	min-width: 0;
	line-height: 1.35;
}

.eddcc-dash__user-meta strong {
	font-size: 14px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.eddcc-dash__user-meta em {
	font-size: 12px;
	font-style: normal;
	color: var(--eddcc-muted);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.eddcc-dash__nav {
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding: 8px;
	background: var(--eddcc-card);
	border: 1px solid var(--eddcc-border);
	border-radius: var(--eddcc-radius);
}

.eddcc-dash__nav-link {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 12px;
	border-radius: var(--eddcc-radius-sm);
	color: var(--eddcc-muted);
	font-size: 14px;
	font-weight: 500;
	text-decoration: none;
	transition: background-color 0.12s ease, color 0.12s ease;
}

.eddcc-dash__nav-link:hover {
	background: var(--eddcc-bg);
	color: var(--eddcc-text);
}

.eddcc-dash__nav-link.is-active {
	background: var(--eddcc-primary-soft);
	color: var(--eddcc-primary);
	font-weight: 600;
}

.eddcc-dash__nav-link--logout {
	margin-top: 6px;
	border-top: 1px solid var(--eddcc-border);
	border-radius: 0 0 var(--eddcc-radius-sm) var(--eddcc-radius-sm);
	padding-top: 14px;
}

.eddcc-dash__icon {
	width: 18px;
	height: 18px;
	flex: 0 0 18px;
}

/* Mobile section switcher — hidden on desktop, where the nav is always visible. */
.eddcc-dash__nav-toggle {
	display: none;
	width: 100%;
	align-items: center;
	justify-content: space-between;
	padding: 12px 14px;
	background: var(--eddcc-card);
	border: 1px solid var(--eddcc-border-strong);
	border-radius: var(--eddcc-radius-sm);
	color: var(--eddcc-text);
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
}

.eddcc-dash__nav-toggle svg {
	width: 16px;
	height: 16px;
	transition: transform 0.15s ease;
}

.eddcc-dash__nav-toggle[aria-expanded="true"] svg {
	transform: rotate(180deg);
}

/* -------------------------------------------------- Main */

.eddcc-dash__main {
	min-width: 0;
}

.eddcc-dash__header {
	margin-bottom: 24px;
}

.eddcc-dash__title {
	margin: 0;
	font-size: 26px;
	font-weight: 700;
	letter-spacing: -0.015em;
}

.eddcc-dash__subtitle {
	margin: 4px 0 0;
	color: var(--eddcc-muted);
	font-size: 14px;
}

.eddcc-dash__notice {
	margin-bottom: 20px;
	padding: 12px 14px;
	border-radius: var(--eddcc-radius-sm);
	font-size: 14px;
}

.eddcc-dash__notice.is-success {
	background: #ecfdf5;
	border: 1px solid #a7f3d0;
	color: #065f46;
}

.eddcc-dash__notice.is-error {
	background: #fef2f2;
	border: 1px solid #fecaca;
	color: #991b1b;
}

/* -------------------------------------------------- Stats */

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

.eddcc-stat {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 18px;
	background: var(--eddcc-card);
	border: 1px solid var(--eddcc-border);
	border-radius: var(--eddcc-radius);
}

.eddcc-stat__label {
	font-size: 13px;
	color: var(--eddcc-muted);
}

.eddcc-stat__value {
	font-size: 26px;
	font-weight: 700;
	letter-spacing: -0.02em;
	line-height: 1.2;
}

.eddcc-dash__callout {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
	padding: 16px 18px;
	margin-bottom: 24px;
	background: var(--eddcc-primary-soft);
	border: 1px solid #dbeafe;
	border-radius: var(--eddcc-radius);
}

.eddcc-dash__callout p {
	margin: 2px 0 0;
	font-size: 14px;
	color: var(--eddcc-muted);
}

/* -------------------------------------------------- Panels + tables */

.eddcc-panel {
	margin-bottom: 24px;
	padding: 20px;
	background: var(--eddcc-card);
	border: 1px solid var(--eddcc-border);
	border-radius: var(--eddcc-radius);
}

.eddcc-panel__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 16px;
}

.eddcc-panel__head h2 {
	margin: 0;
	font-size: 17px;
	font-weight: 700;
}

.eddcc-panel__head a {
	font-size: 14px;
	color: var(--eddcc-primary);
	text-decoration: none;
}

.eddcc-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 14px;
}

.eddcc-table th {
	padding: 0 0 10px;
	border-bottom: 1px solid var(--eddcc-border);
	color: var(--eddcc-muted);
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	text-align: left;
}

.eddcc-table td {
	padding: 14px 0;
	border-bottom: 1px solid var(--eddcc-border);
	vertical-align: middle;
}

.eddcc-table tr:last-child td {
	border-bottom: 0;
}

.eddcc-table__right {
	text-align: right;
}

/* -------------------------------------------------- Badges */

.eddcc-badge {
	display: inline-flex;
	align-items: center;
	padding: 3px 10px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 600;
	white-space: nowrap;
}

.eddcc-badge.is-success {
	background: #ecfdf5;
	color: #047857;
}

.eddcc-badge.is-info {
	background: #eff6ff;
	color: #1d4ed8;
}

.eddcc-badge.is-warning {
	background: #fffbeb;
	color: #b45309;
}

.eddcc-badge.is-danger {
	background: #fef2f2;
	color: #b91c1c;
}

.eddcc-badge.is-muted {
	background: #f3f4f6;
	color: #4b5563;
}

/* -------------------------------------------------- Buttons */

.eddcc-dash__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 10px 16px;
	border: 1px solid transparent;
	border-radius: var(--eddcc-radius-sm);
	font-size: 14px;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.12s ease;
}

.eddcc-dash__btn--primary {
	background: var(--eddcc-primary);
	color: #fff;
}

.eddcc-dash__btn--primary:hover {
	background: var(--eddcc-primary-hover);
	color: #fff;
}

.eddcc-dash__btn--secondary {
	background: var(--eddcc-card);
	border-color: var(--eddcc-border-strong);
	color: var(--eddcc-text);
}

.eddcc-dash__btn--secondary:hover {
	border-color: var(--eddcc-primary);
	color: var(--eddcc-primary);
}

.eddcc-dash__link {
	color: var(--eddcc-primary);
	font-size: 14px;
	font-weight: 500;
	text-decoration: none;
}

.eddcc-dash__link:hover {
	text-decoration: underline;
}

.eddcc-dash__link--danger {
	color: #b91c1c;
}

/* -------------------------------------------------- Orders */

.eddcc-order,
.eddcc-license,
.eddcc-sub {
	padding: 20px;
	margin-bottom: 16px;
	background: var(--eddcc-card);
	border: 1px solid var(--eddcc-border);
	border-radius: var(--eddcc-radius);
}

.eddcc-order__head,
.eddcc-license__head,
.eddcc-sub__head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
	padding-bottom: 14px;
	border-bottom: 1px solid var(--eddcc-border);
}

.eddcc-order__number,
.eddcc-license__title,
.eddcc-sub__title {
	margin: 0;
	font-size: 16px;
	font-weight: 700;
}

/* Software Licensing appends the price option inside the product name. */
.eddcc-license__title .edd_sl_license_price_option {
	color: var(--eddcc-muted);
	font-weight: 500;
}

.eddcc-order__meta,
.eddcc-license__meta {
	margin: 2px 0 0;
	font-size: 13px;
	color: var(--eddcc-muted);
}

.eddcc-order__right {
	display: flex;
	align-items: center;
	gap: 12px;
}

.eddcc-order__total {
	font-size: 17px;
	font-weight: 700;
}

.eddcc-order__items {
	margin: 14px 0 0;
	padding: 0;
	list-style: none;
}

.eddcc-order__items li {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 6px 0;
	font-size: 14px;
}

.eddcc-order__item-total {
	color: var(--eddcc-muted);
	white-space: nowrap;
}

.eddcc-order__foot,
.eddcc-license__foot,
.eddcc-sub__foot {
	display: flex;
	align-items: center;
	gap: 16px;
	flex-wrap: wrap;
	margin-top: 16px;
	padding-top: 16px;
	border-top: 1px solid var(--eddcc-border);
}

/* -------------------------------------------------- Downloads */

.eddcc-products {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: 16px;
}

.eddcc-product-card {
	display: flex;
	flex-direction: column;
	background: var(--eddcc-card);
	border: 1px solid var(--eddcc-border);
	border-radius: var(--eddcc-radius);
	overflow: hidden;
}

.eddcc-product-card__media {
	display: flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: 16 / 9;
	background: var(--eddcc-bg);
	overflow: hidden;
}

.eddcc-product-card__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.eddcc-product-card__placeholder svg {
	width: 36px;
	height: 36px;
	color: var(--eddcc-primary);
}

.eddcc-product-card__body {
	padding: 16px;
}

.eddcc-product-card__title {
	margin: 0;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.35;
}

.eddcc-product-card__meta {
	margin: 2px 0 12px;
	font-size: 12px;
	color: var(--eddcc-muted);
}

.eddcc-product-card__note {
	margin: 0;
	font-size: 13px;
	color: var(--eddcc-muted);
}

.eddcc-files {
	margin: 0;
	padding: 0;
	list-style: none;
}

.eddcc-file {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 10px;
	margin-bottom: 6px;
	background: var(--eddcc-bg);
	border-radius: var(--eddcc-radius-sm);
	color: var(--eddcc-text);
	font-size: 13px;
	font-weight: 500;
	text-decoration: none;
	word-break: break-word;
}

.eddcc-file:hover {
	background: var(--eddcc-primary-soft);
	color: var(--eddcc-primary);
}

.eddcc-file svg {
	width: 15px;
	height: 15px;
	flex: 0 0 15px;
}

/* -------------------------------------------------- Licenses */

.eddcc-license__key {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 16px 0;
	padding: 10px 12px;
	background: var(--eddcc-bg);
	border: 1px dashed var(--eddcc-border-strong);
	border-radius: var(--eddcc-radius-sm);
}

.eddcc-license__key code {
	flex: 1 1 auto;
	min-width: 0;
	background: none;
	padding: 0;
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 13px;
	word-break: break-all;
}

.eddcc-copy {
	flex: 0 0 auto;
	padding: 6px 12px;
	background: var(--eddcc-card);
	border: 1px solid var(--eddcc-border-strong);
	border-radius: 6px;
	font-size: 12px;
	font-weight: 600;
	color: var(--eddcc-text);
	cursor: pointer;
}

.eddcc-copy:hover {
	border-color: var(--eddcc-primary);
	color: var(--eddcc-primary);
}

.eddcc-copy.is-copied {
	background: #ecfdf5;
	border-color: #a7f3d0;
	color: #047857;
}

.eddcc-license__sites h3 {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	margin: 0 0 10px;
	font-size: 14px;
	font-weight: 700;
}

.eddcc-license__count {
	font-size: 12px;
	font-weight: 500;
	color: var(--eddcc-muted);
}

.eddcc-license__note {
	margin: 0 0 12px;
	font-size: 13px;
	color: var(--eddcc-muted);
}

.eddcc-sites {
	margin: 0 0 12px;
	padding: 0;
	list-style: none;
}

.eddcc-site {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 10px 12px;
	margin-bottom: 6px;
	background: var(--eddcc-bg);
	border-radius: var(--eddcc-radius-sm);
	font-size: 14px;
}

.eddcc-site__url {
	min-width: 0;
	word-break: break-all;
}

.eddcc-site__remove {
	flex: 0 0 auto;
	color: #b91c1c;
	font-size: 13px;
	font-weight: 500;
	text-decoration: none;
}

.eddcc-site__remove:hover {
	text-decoration: underline;
}

.eddcc-site-add {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}

.eddcc-site-add input[type="url"] {
	flex: 1 1 200px;
	min-width: 0;
	padding: 10px 12px;
	border: 1px solid var(--eddcc-border-strong);
	border-radius: var(--eddcc-radius-sm);
	font-size: 14px;
}

.eddcc-site-add input[type="url"]:focus {
	outline: none;
	border-color: var(--eddcc-primary);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* -------------------------------------------------- Subscriptions */

.eddcc-sub__price {
	margin: 2px 0 0;
	font-size: 15px;
	font-weight: 600;
}

.eddcc-sub__price span {
	color: var(--eddcc-muted);
	font-weight: 400;
}

.eddcc-sub__facts {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
	gap: 16px;
	margin: 16px 0 0;
}

.eddcc-sub__facts dt {
	font-size: 12px;
	color: var(--eddcc-muted);
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.eddcc-sub__facts dd {
	margin: 2px 0 0;
	font-size: 14px;
	font-weight: 600;
}

/* -------------------------------------------------- Profile */

.eddcc-grid2 {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 16px;
}

.eddcc-dash__field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
}

.eddcc-dash__field--wide {
	grid-column: 1 / -1;
}

.eddcc-dash__field span {
	font-size: 13px;
	font-weight: 600;
}

.eddcc-dash__field input,
.eddcc-dash__field select {
	width: 100%;
	padding: 11px 12px;
	background: #fff;
	border: 1px solid var(--eddcc-border-strong);
	border-radius: var(--eddcc-radius-sm);
	font-size: 14px;
	color: var(--eddcc-text);
}

.eddcc-dash__field input:focus,
.eddcc-dash__field select:focus {
	outline: none;
	border-color: var(--eddcc-primary);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.eddcc-dash__hint {
	margin: 12px 0 0;
	font-size: 13px;
	color: var(--eddcc-muted);
}

.eddcc-profile__actions {
	display: flex;
	justify-content: flex-end;
}

/* -------------------------------------------------- Empty state */

.eddcc-empty-state {
	padding: 40px 20px;
	text-align: center;
}

.eddcc-empty-state__icon svg {
	width: 40px;
	height: 40px;
	color: var(--eddcc-border-strong);
}

.eddcc-empty-state h3 {
	margin: 12px 0 4px;
	font-size: 16px;
	font-weight: 700;
}

.eddcc-empty-state p {
	margin: 0 0 16px;
	color: var(--eddcc-muted);
	font-size: 14px;
}

/* -------------------------------------------------- Pagination */

.eddcc-pagination {
	display: flex;
	justify-content: center;
	gap: 6px;
	flex-wrap: wrap;
	margin-top: 8px;
}

.eddcc-pagination a,
.eddcc-pagination span {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 36px;
	height: 36px;
	padding: 0 10px;
	background: var(--eddcc-card);
	border: 1px solid var(--eddcc-border);
	border-radius: var(--eddcc-radius-sm);
	color: var(--eddcc-text);
	font-size: 14px;
	text-decoration: none;
}

.eddcc-pagination .current {
	background: var(--eddcc-primary);
	border-color: var(--eddcc-primary);
	color: #fff;
	font-weight: 600;
}

/* -------------------------------------------------- Responsive */

@media (max-width: 900px) {
	.eddcc-dash {
		grid-template-columns: 1fr;
		gap: 20px;
	}

	.eddcc-dash__sidebar {
		position: static;
	}

	.eddcc-dash__nav-toggle {
		display: flex;
	}

	/* Collapsed by default on mobile; the toggle reveals it. */
	.eddcc-dash__nav {
		display: none;
		margin-top: 8px;
	}

	.eddcc-dash__nav.is-open {
		display: flex;
	}
}

@media (max-width: 600px) {
	.eddcc-grid2 {
		grid-template-columns: 1fr;
	}

	.eddcc-dash__title {
		font-size: 22px;
	}

	/* Stack table rows into labelled cards rather than scrolling sideways. */
	.eddcc-table thead {
		display: none;
	}

	.eddcc-table,
	.eddcc-table tbody,
	.eddcc-table tr,
	.eddcc-table td {
		display: block;
		width: 100%;
	}

	.eddcc-table tr {
		padding: 12px 0;
		border-bottom: 1px solid var(--eddcc-border);
	}

	.eddcc-table td {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 12px;
		padding: 4px 0;
		border: 0;
		text-align: right;
	}

	.eddcc-table td::before {
		content: attr(data-label);
		color: var(--eddcc-muted);
		font-size: 12px;
		font-weight: 600;
		text-transform: uppercase;
		letter-spacing: 0.04em;
	}
}
