/*
 * Woo License Manager – Frontend Stylesheet
 *
 * @package WooCommerceLicenseManager
 * @since   2.1.0
 *
 * Extracted from includes/wlm-woocommerce.php:
 *   Block 1 (lines 232–679)  : My Account > Licenses  – wlm_license_keys_content()
 *   Block 2 (lines 1332–1352): Admin product data tabs – wlm_tab_style()
 *   Block 3 (lines 1721–2040): My Account > Downloads  – wlm_license_downloads_content()
 *
 * Near-duplicate selectors shared between Block 1 and Block 3 are consolidated
 * into a single rule. Where the selector's context differs significantly between
 * the two pages, the rule is scoped with a parent container selector to preserve
 * the original behaviour.
 */

/* ================================================================
 * SECTION 1 – Admin: product data tab (originally Block 2)
 * Loaded on WooCommerce product edit screen via wlm_tab_style().
 * ================================================================ */

#woocommerce-product-data ul.wc-tabs li.wlm_tab_options a::before {
	content: "\f17d";
}

.wlm-variation-activation-limit {
	padding: 5px 0 !important;
	margin-top: 5px !important;
	border-top: 1px dashed #ccc !important;
}

.wlm-variation-activation-limit.hidden {
	display: none !important;
}

.woocommerce_variable_attributes .wlm-variation-activation-limit {
	display: block;
}

/* ================================================================
 * SECTION 2 – My Account > Licenses (originally Block 1)
 * ================================================================ */

/* Main container */
.wlm-dashboard {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	margin-bottom: 40px;
	color: #333;
}

/* Empty state */
.wlm-empty-state {
	text-align: center;
	padding: 60px 20px;
	background-color: #f9fafb;
	border-radius: 8px;
	border: 1px dashed #d1d5db;
	margin: 20px 0;
}

/* Shared empty icon (identical in Blocks 1 and 3 – defined once) */
.wlm-empty-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 80px;
	height: 80px;
	border-radius: 50%;
	background-color: #f3f4f6;
	margin-bottom: 20px;
	color: #6b7280;
}

.wlm-empty-state h3 {
	font-size: 20px;
	margin-bottom: 10px;
	color: #1f2937;
}

.wlm-empty-state p {
	color: #6b7280;
	margin-bottom: 20px;
	font-size: 16px;
}

.wlm-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 10px 20px;
	border-radius: 6px;
	background-color: #2563eb;
	color: white;
	font-weight: 500;
	text-decoration: none;
	transition: background-color 0.2s;
}

.wlm-button:hover {
	background-color: #1d4ed8;
	color: white;
	text-decoration: none;
}

/* License group */
.wlm-license-group {
	background-color: #fff;
	border-radius: 8px;
	border: 1px solid #e5e7eb;
	box-shadow: 0 2px 5px rgba(0,0,0,0.05);
	margin-bottom: 30px;
	overflow: hidden;
}

.wlm-license-header {
	padding: 20px;
	background-color: #f9fafb;
	border-bottom: 1px solid #e5e7eb;
}

.wlm-license-header.with-icon {
	display: flex;
	align-items: center;
}

.wlm-license-header h3 {
	margin: 0;
	font-size: 18px;
	font-weight: 600;
	color: #111827;
}

.wlm-license-info {
	flex: 1;
}

.wlm-license-key {
	display: flex;
	align-items: center;
	margin-top: 8px;
	flex-wrap: wrap;
}

.wlm-license-label {
	font-size: 14px;
	font-weight: 500;
	color: #4b5563;
	margin-right: 10px;
}

.wlm-key-wrapper {
	display: flex;
	align-items: flex-start;
	background-color: #f3f4f6;
	border-radius: 4px;
	padding: 8px 12px;
	margin-top: 4px;
}

.wlm-license-value {
	font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
	font-size: 14px;
	color: #374151;
	background: transparent;
	padding: 0;
	margin: 0;
	border: none;
	overflow: visible;
	text-overflow: initial;
	white-space: normal;
	word-break: break-all;
	max-width: none;
}

.wlm-copy-button {
	border: none;
	background: transparent;
	color: #6b7280;
	cursor: pointer;
	padding: 4px;
	margin-left: 8px;
	border-radius: 4px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s;
	position: relative;
}

.wlm-copy-button:hover {
	color: #2563eb;
	background-color: rgba(37, 99, 235, 0.1);
}

.wlm-copy-button:active {
	transform: scale(0.95);
}

.wlm-copied-icon {
	display: none;
	color: #10b981;
}

.wlm-copy-button.copied .wlm-copy-icon {
	display: none;
}

.wlm-copy-button.copied .wlm-copied-icon {
	display: block;
}

/* License content */
.wlm-license-content {
	padding: 20px;
	background-color: #fff;
}

.wlm-license-meta {
	background-color: #f9fafb;
	border-radius: 6px;
	padding: 12px;
	margin-bottom: 20px;
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.wlm-meta-row {
	display: flex;
	flex-direction: row;
	align-items: center;
	margin-right: 20px;
}

.wlm-meta-label {
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: #6b7280;
	margin-right: 8px;
	font-weight: 500;
}

.wlm-meta-value {
	font-size: 14px;
	font-weight: 500;
	color: #111827;
}

/* Status indicator */
.wlm-license-status {
	display: flex;
	align-items: center;
	margin-bottom: 15px;
}

.wlm-status-indicator {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 12px;
	padding: 3px 8px;
	border-radius: 9999px;
	font-weight: 500;
}

.wlm-status-indicator.active {
	background-color: #d1fae5;
	color: #047857;
}

.wlm-status-indicator.warning {
	background-color: #fef3c7;
	color: #b45309;
}

.wlm-status-indicator.inactive {
	background-color: #e5e7eb;
	color: #4b5563;
}

.wlm-status-indicator.disabled {
	background-color: #fee2e2;
	color: #b91c1c;
}

.wlm-status-indicator.expired {
	background-color: #e5e7eb;
	color: #6b7280;
}

/* Expired license card — greyed out */
.wlm-license-group.expired {
	opacity: 0.7;
	border-color: #d1d5db;
}

.wlm-license-group.expired .wlm-license-header {
	background-color: #f3f4f6;
}

/* Expiry badge */
.wlm-expiry-badge {
	display: inline-flex;
	align-items: center;
	padding: 2px 8px;
	border-radius: 9999px;
	font-size: 13px;
	font-weight: 500;
}

.wlm-expiry-badge--green {
	background-color: #d1fae5;
	color: #047857;
}

.wlm-expiry-badge--orange {
	background-color: #fef3c7;
	color: #b45309;
}

.wlm-expiry-badge--red {
	background-color: #fee2e2;
	color: #b91c1c;
}

/* Domains container */
.wlm-domains-container {
	margin-top: 20px;
}

.wlm-domains-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 12px;
}

.wlm-domains-header h4 {
	margin: 0;
	font-size: 16px;
	font-weight: 500;
	color: #111827;
}

/* Downloads container within license card */
.wlm-downloads-container {
	margin-top: 30px;
	border-top: 1px solid #e5e7eb;
	padding-top: 20px;
}

/*
 * Scoped: downloads header inside license card (.wlm-downloads-container).
 * The downloads-dashboard uses a richer header style – see scoped rule in Section 3.
 */
.wlm-license-content .wlm-downloads-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 15px;
}

.wlm-license-content .wlm-downloads-header h4 {
	margin: 0;
	font-size: 16px;
	font-weight: 500;
	color: #111827;
}

.wlm-downloads-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
	grid-gap: 20px;
}

/*
 * Download item – consolidated from Blocks 1 & 3.
 * Block 3 values used (border-radius: 8px, padding: 20px) as base.
 * Hover and transition from Block 3 included.
 */
.wlm-download-item {
	background-color: #f9fafb;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	padding: 20px;
	margin-bottom: 15px;
	transition: transform 0.2s, box-shadow 0.2s;
}

.wlm-download-item:hover {
	transform: translateY(-2px);
	box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.wlm-download-title h5 {
	margin: 0 0 10px 0;
	font-size: 15px;
	font-weight: 500;
	color: #111827;
}

/* Download description – consolidated; line-height added from Block 3 */
.wlm-download-description {
	margin-bottom: 15px;
	font-size: 14px;
	color: #4b5563;
	line-height: 1.5;
}

.wlm-download-files h6 {
	margin: 0 0 8px 0;
	font-size: 14px;
	font-weight: 500;
	color: #374151;
}

/* Download files list – consolidated; Block 3 values used (border, radius, overflow) */
.wlm-download-files ul {
	list-style: none;
	margin: 0;
	padding: 0;
	border: 1px solid #e5e7eb;
	border-radius: 6px;
	overflow: hidden;
}

/* Download files list item – consolidated; Block 3 values used (padding, bg, solid border) */
.wlm-download-files li {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 12px 15px;
	background-color: #fff;
	border-bottom: 1px solid #e5e7eb;
}

.wlm-download-files li:last-child {
	border-bottom: none;
}

/* File info – consolidated; flex:1 from Block 3, flex-wrap from Block 1 */
.wlm-file-info {
	display: flex;
	align-items: center;
	flex: 1;
	flex-wrap: wrap;
}

/* File name – consolidated; Block 3 size (14px) and weight; Block 1 margin-right kept */
.wlm-file-name {
	font-size: 14px;
	font-weight: 500;
	color: #1f2937;
	margin-right: 5px;
}

/* File version – consolidated; margin-right from Block 3 */
.wlm-file-version {
	font-size: 12px;
	background-color: #e0e7ff;
	color: #4f46e5;
	padding: 2px 6px;
	border-radius: 4px;
	margin-right: 8px;
}

/*
 * Download button – shared base properties (identical between blocks).
 * Context-specific padding/sizing scoped below.
 */
.wlm-download-button {
	display: inline-flex;
	align-items: center;
	font-weight: 500;
	color: #4f46e5;
	background-color: #e0e7ff;
	text-decoration: none;
	transition: all 0.2s ease;
}

/* Download button inside license-card download grid (Block 1 sizing) */
.wlm-downloads-grid .wlm-download-button {
	padding: 6px 10px;
	font-size: 12px;
	border-radius: 4px;
}

/* Download button inside downloads-dashboard content area (Block 3 sizing) */
.wlm-downloads-content .wlm-download-button {
	padding: 8px 12px;
	font-size: 13px;
	border-radius: 6px;
	white-space: nowrap;
	margin-left: 12px;
}

.wlm-download-button svg {
	margin-right: 6px;
}

.wlm-download-button:hover {
	background-color: #4f46e5;
	color: #fff;
	text-decoration: none;
}

.wlm-no-downloads,
.wlm-no-files {
	padding: 20px;
	text-align: center;
	color: #6b7280;
	background-color: #f9fafb;
	border-radius: 6px;
	border: 1px dashed #d1d5db;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
}

.wlm-no-downloads svg,
.wlm-no-files svg {
	margin-bottom: 10px;
	color: #9ca3af;
}

.wlm-no-files {
	padding: 12px;
	font-size: 13px;
}

/* Domains table */
.wlm-domains-table {
	width: 100%;
	border-collapse: separate;
	border-spacing: 0;
	border: 1px solid #e5e7eb;
	border-radius: 6px;
	overflow: hidden;
}

.wlm-domains-table th,
.wlm-domains-table td {
	padding: 12px;
	text-align: left;
	border-bottom: 1px solid #e5e7eb;
}

.wlm-domains-table th {
	background-color: #f3f4f6;
	font-weight: 500;
	font-size: 14px;
	color: #4b5563;
}

.wlm-domains-table tr:last-child td {
	border-bottom: none;
}

.wlm-domains-table tr:hover td {
	background-color: #f9fafb;
}

.wlm-domain-cell {
	display: flex;
	align-items: center;
	word-break: break-all;
	color: #1f2937;
}

.wlm-domain-cell svg {
	margin-right: 8px;
	color: #6b7280;
	flex-shrink: 0;
}

.wlm-date-cell {
	color: #6b7280;
	font-size: 13px;
}

/* Deactivate button */
.wlm-deactivate-domain {
	display: inline-flex;
	align-items: center;
	padding: 6px 12px;
	font-size: 13px;
	font-weight: 500;
	border-radius: 4px;
	cursor: pointer;
	border: 1px solid #ef4444;
	background-color: #fff;
	color: #ef4444;
	transition: all 0.2s ease;
	text-align: center;
	text-decoration: none;
}

.wlm-deactivate-domain svg {
	margin-right: 4px;
}

.wlm-deactivate-domain:hover {
	background-color: #ef4444;
	color: #fff;
}

.wlm-no-domains {
	padding: 30px;
	text-align: center;
	color: #6b7280;
	background-color: #f9fafb;
	border-radius: 6px;
	border: 1px dashed #d1d5db;
}

/* Responsive – licenses page */
@media (max-width: 768px) {
	.wlm-license-header.with-icon {
		flex-direction: column;
		align-items: flex-start;
	}

	.wlm-license-key {
		flex-direction: column;
		align-items: flex-start;
	}

	.wlm-key-wrapper {
		margin-top: 8px;
		width: 100%;
	}

	.wlm-domains-table {
		display: block;
		overflow-x: auto;
	}
}

/* ================================================================
 * SECTION 3 – My Account > Downloads (originally Block 3)
 * Rules unique to the downloads dashboard; near-duplicates with
 * Section 2 are consolidated above.
 * ================================================================ */

.wlm-downloads-dashboard {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	margin-bottom: 40px;
	color: #333;
}

.wlm-downloads-title {
	margin-bottom: 20px;
	font-size: 20px;
	font-weight: 600;
	color: #1f2937;
}

.wlm-downloads-group {
	background-color: #fff;
	border-radius: 8px;
	border: 1px solid #e5e7eb;
	box-shadow: 0 2px 5px rgba(0,0,0,0.05);
	margin-bottom: 30px;
	overflow: hidden;
}

/*
 * Scoped: downloads-group card header (full header with padding + background).
 * The license-card version uses a simpler header – see scoped rule in Section 2.
 */
.wlm-downloads-group .wlm-downloads-header {
	padding: 20px;
	background-color: #f9fafb;
	border-bottom: 1px solid #e5e7eb;
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.wlm-downloads-group .wlm-downloads-header h3 {
	margin: 0;
	font-size: 18px;
	font-weight: 600;
	color: #111827;
}

.wlm-downloads-product-info {
	display: flex;
	flex-direction: column;
}

.wlm-downloads-variation {
	font-size: 14px;
	color: #6b7280;
	margin-top: 5px;
}

.wlm-downloads-content {
	padding: 20px;
}

/* Download title flex container (Block 3 unique – Block 1 only has h5 inside) */
.wlm-download-title {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 10px;
}

.wlm-download-title h4 {
	margin: 0;
	font-size: 16px;
	font-weight: 500;
	color: #111827;
}

.wlm-download-files h5 {
	margin: 0 0 10px 0;
	font-size: 14px;
	font-weight: 500;
	color: #374151;
	display: flex;
	align-items: center;
}

.wlm-download-files h5 svg {
	margin-right: 8px;
	color: #6b7280;
}

.wlm-download-files li:hover {
	background-color: #f9fafb;
}

.wlm-file-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border-radius: 6px;
	background-color: #e0e7ff;
	margin-right: 12px;
	color: #4f46e5;
}

.wlm-file-details {
	display: flex;
	flex-direction: column;
}

.wlm-file-meta {
	display: flex;
	align-items: center;
	margin-top: 4px;
}

.wlm-file-size {
	font-size: 12px;
	color: #6b7280;
}

/* Empty downloads state */
.wlm-empty-downloads {
	text-align: center;
	padding: 60px 20px;
	background-color: #f9fafb;
	border-radius: 8px;
	border: 1px dashed #d1d5db;
	margin: 20px 0;
}

.wlm-empty-downloads h3 {
	font-size: 20px;
	margin-bottom: 10px;
	color: #1f2937;
}

.wlm-empty-downloads p {
	color: #6b7280;
	margin-bottom: 20px;
	font-size: 16px;
}

.wlm-shop-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 10px 20px;
	border-radius: 6px;
	background-color: #4f46e5;
	color: white;
	font-weight: 500;
	text-decoration: none;
	transition: background-color 0.2s;
}

.wlm-shop-button:hover {
	background-color: #4338ca;
	color: white;
	text-decoration: none;
}

/* Badge group */
.wlm-downloads-badge-group {
	display: flex;
	align-items: center;
	gap: 8px;
}

.wlm-downloads-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 4px 10px;
	border-radius: 9999px;
	font-size: 12px;
	font-weight: 500;
}

.wlm-downloads-badge-order {
	background-color: #e0e7ff;
	color: #4f46e5;
}

.wlm-downloads-badge-license {
	background-color: #fef3c7;
	color: #d97706;
}

/* Responsive – downloads page */
@media (max-width: 768px) {
	.wlm-downloads-group .wlm-downloads-header {
		flex-direction: column;
		align-items: flex-start;
	}

	.wlm-downloads-badge-group {
		margin-top: 10px;
		flex-wrap: wrap;
	}

	.wlm-downloads-badge {
		margin-top: 5px;
	}

	.wlm-download-files li {
		flex-direction: column;
		align-items: flex-start;
	}

	.wlm-downloads-content .wlm-download-button {
		margin-left: 0;
		margin-top: 10px;
		width: 100%;
		justify-content: center;
	}
}
