/**
 * Product Documents Editor Styles.
 *
 * Styles for the Site Editor and block editor to match frontend appearance.
 *
 * @package TGP\ProductDocuments
 * @since 0.4.0
 */

/* ==========================================================================
   WooCommerce Blocks Tabs (Site Editor)
   ========================================================================== */

/* Tab panel container - WooCommerce Blocks */
.wc-block-components-tab-panel__tabs,
.wp-block-woocommerce-product-details .wc-block-components-tab-panel__tabs {
	display: flex;
	gap: 32px;
	margin: 0;
	padding: 0;
	list-style: none;
	border-bottom: 1px solid var(--wp--preset--color--border-light, #e5e7eb);
	overflow: visible;
}

/* Tab buttons - WooCommerce Blocks */
.wc-block-components-tab-panel__tabs button,
.wp-block-woocommerce-product-details .wc-block-components-tab-panel__tabs button {
	padding: 16px 4px;
	font-size: inherit;
	font-weight: 500;
	color: #6b7280;
	background: none;
	border: none;
	border-bottom-width: 3px;
	border-bottom-style: solid;
	border-bottom-color: transparent;
	margin-bottom: -1px;
	cursor: pointer;
	transition: color 0.15s ease, border-color 0.15s ease, font-weight 0.15s ease;
}

/* Tab hover state - WooCommerce Blocks */
.wc-block-components-tab-panel__tabs button:hover,
.wp-block-woocommerce-product-details .wc-block-components-tab-panel__tabs button:hover {
	color: #374151;
	border-bottom-color: var(--wp--preset--color--contrast-3, #d1d5db);
}

/* Active tab state - WooCommerce Blocks */
.wc-block-components-tab-panel__tabs button[aria-selected="true"],
.wc-block-components-tab-panel__tabs button.is-active,
.wp-block-woocommerce-product-details .wc-block-components-tab-panel__tabs button[aria-selected="true"] {
	color: #2563eb;
	font-weight: 700;
	border-bottom-color: #2563eb;
}

/* Tab content panel - WooCommerce Blocks */
.wc-block-components-tab-panel__content,
.wp-block-woocommerce-product-details .wc-block-components-tab-panel__content {
	padding-top: 32px;
	padding-bottom: 32px;
}

/* Hide panel headings in WooCommerce Blocks tabs */
.wc-block-components-tab-panel__content > h2:first-child,
.wp-block-woocommerce-product-details .wc-block-components-tab-panel__content > h2:first-child {
	display: none;
}

/* ==========================================================================
   Classic WooCommerce Tabs (Fallback)
   ========================================================================== */

/* Tab list container */
.woocommerce-tabs ul.tabs.wc-tabs,
ul.tabs.wc-tabs {
	display: flex;
	gap: 32px;
	margin: 0;
	padding: 0;
	list-style: none;
	border-bottom: 1px solid var(--wp--preset--color--border-light, #e5e7eb);
	overflow: visible;
}

/* Remove ::before pseudo-element from tabs container */
.woocommerce-tabs ul.tabs.wc-tabs::before,
ul.tabs.wc-tabs::before {
	display: none;
}

/* Tab list items */
.woocommerce-tabs ul.tabs.wc-tabs li,
ul.tabs.wc-tabs li {
	margin: 0;
	padding: 0;
	background: none;
	border: none;
	border-radius: 0;
	display: block;
}

/* Remove ::before and ::after pseudo-elements from tab items */
.woocommerce-tabs ul.tabs.wc-tabs li::before,
.woocommerce-tabs ul.tabs.wc-tabs li::after,
ul.tabs.wc-tabs li::before,
ul.tabs.wc-tabs li::after {
	display: none;
}

/* Tab links */
.woocommerce-tabs ul.tabs.wc-tabs li a,
ul.tabs.wc-tabs li a {
	display: block;
	padding: 16px 4px;
	font-size: inherit;
	font-weight: 500;
	color: #6b7280;
	text-decoration: none;
	border: none;
	border-bottom-width: 3px;
	border-bottom-style: solid;
	border-bottom-color: transparent;
	margin-bottom: -1px;
	transition: color 0.15s ease, border-color 0.15s ease, font-weight 0.15s ease;
	background: none;
}

/* Tab hover state */
.woocommerce-tabs ul.tabs.wc-tabs li a:hover,
ul.tabs.wc-tabs li a:hover {
	color: #374151;
	border-bottom-color: var(--wp--preset--color--contrast-3, #d1d5db);
}

/* Active tab state */
.woocommerce-tabs ul.tabs.wc-tabs li.active a,
ul.tabs.wc-tabs li.active a {
	color: #2563eb;
	font-weight: 700;
	border-bottom-color: #2563eb;
	border-bottom-style: solid;
}

/* Remove WooCommerce default active styling */
.woocommerce-tabs ul.tabs.wc-tabs li.active,
ul.tabs.wc-tabs li.active {
	background: none;
	border: none;
}

/* Tab panels */
.woocommerce-tabs .woocommerce-Tabs-panel,
.woocommerce-tabs .panel[id^="tab-"],
.woocommerce-Tabs-panel,
.panel[id^="tab-"] {
	padding-top: 32px;
	padding-bottom: 32px;
}

/* Hide panel headings (tab title is sufficient) */
.woocommerce-tabs .woocommerce-Tabs-panel h2:first-child,
.woocommerce-tabs .panel[id^="tab-"] h2:first-child,
.woocommerce-Tabs-panel h2:first-child,
.panel[id^="tab-"] h2:first-child {
	display: none;
}

/* ==========================================================================
   Additional Information Table (Tailwind UI style with vertical lines)
   ========================================================================== */

.woocommerce-product-attributes,
.woocommerce-product-attributes.shop_attributes {
	width: 100%;
	border-collapse: collapse;
	border-spacing: 0;
	font-size: 1rem;
	line-height: 2;
}

.woocommerce-product-attributes,
.woocommerce-product-attributes tbody,
.woocommerce table.shop_attributes {
	border: none !important;
	border-top: none !important;
}

/* Horizontal dividers between rows */
.woocommerce-product-attributes tr {
	border-bottom: 1px solid var(--wp--preset--color--border-light, #e5e7eb);
	background: transparent !important;
}

.woocommerce-product-attributes tr:last-child,
.woocommerce table.shop_attributes tr:last-child {
	border-bottom: none !important;
}

/* Remove zebra striping */
.woocommerce-product-attributes tr:nth-child(even),
.woocommerce-product-attributes tr:nth-child(odd) {
	background: transparent !important;
}

.woocommerce-product-attributes th,
.woocommerce-product-attributes td,
.woocommerce-product-attributes.shop_attributes th,
.woocommerce-product-attributes.shop_attributes td {
	padding: 12px 16px;
	text-align: left;
	vertical-align: top;
	background: transparent !important;
	font-style: normal;
}

/* Vertical divider between columns */
.woocommerce-product-attributes th,
.woocommerce-product-attributes.shop_attributes th,
.woocommerce table.shop_attributes th {
	font-weight: 500 !important;
	color: #111827;
	white-space: nowrap;
	width: 20% !important;
	padding-left: 0;
	padding-right: 16px;
	border-right: 1px solid var(--wp--preset--color--border-light, #e5e7eb);
	border-bottom: none !important;
	border-top: none !important;
}

.woocommerce-product-attributes td,
.woocommerce-product-attributes.shop_attributes td,
.woocommerce table.shop_attributes td {
	color: #6b7280;
	padding-left: 2.5rem !important;
	border: none !important;
	border-bottom: none !important;
	font-style: normal !important;
	line-height: 2 !important;
}

.woocommerce-product-attributes td p,
.woocommerce-product-attributes.shop_attributes td p {
	margin: 0;
	font-style: normal;
}

/* ==========================================================================
   Key Features List (Tailwind UI "Highlights" style)
   ========================================================================== */

.product-key-features-heading {
	margin: 0 0 16px;
	font-size: 1rem;
	font-weight: 500;
	color: #111827;
}

.product-key-features-list {
	list-style: disc;
	margin: 0;
	padding: 0 0 0 1.25rem;
	font-size: 1rem;
	line-height: 1.75;
	color: #6b7280;
	columns: 2;
	column-gap: 2rem;
}

.product-key-features-list li {
	padding-left: 0.5rem;
	margin-bottom: 0.5rem;
	break-inside: avoid;
}

.product-key-features-list li:last-child {
	margin-bottom: 0;
}

.product-key-features-list li::marker {
	color: #d1d5db;
}

/* ==========================================================================
   Documents List
   ========================================================================== */

.product-documents-list {
	margin-bottom: 32px;
}

.product-documents-items {
	list-style: none;
	margin: 0;
	padding: 0;
}

.product-document-item {
	margin: 0;
	padding: 0;
	border-bottom: 1px solid #e0e0e0;
}

.product-document-item:last-child {
	border-bottom: none;
}

.product-document-item a {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 12px 0;
	text-decoration: none;
	color: inherit;
}

/* ==========================================================================
   Document Thumbnail Placeholders
   ========================================================================== */

.product-document-item--has-thumbnail a {
	align-items: flex-start;
}

.product-document-thumbnail {
	flex-shrink: 0;
	width: 60px;
	height: 78px;
	border-radius: 4px;
	overflow: hidden;
	background: #f6f7f7;
	border: 1px solid #e0e0e0;
	display: flex;
	align-items: center;
	justify-content: center;
}

.product-document-thumbnail img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: top center;
}

.product-document-item--has-thumbnail .product-document-info {
	padding-top: 4px;
}

/* PDF Placeholder (when no thumbnail available) */
.product-document-thumbnail--placeholder {
	background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
	flex-direction: column;
	gap: 4px;
}

.product-document-thumbnail__icon {
	display: flex;
	align-items: center;
	justify-content: center;
}

.product-document-thumbnail__icon svg {
	width: 28px;
	height: 28px;
	fill: #fff;
}

.product-document-thumbnail__label {
	font-size: 10px;
	font-weight: 700;
	color: #fff;
	letter-spacing: 0.5px;
	text-transform: uppercase;
}

/* Document Type Placeholders - Color variants */

/* Video - Purple */
.product-document-thumbnail--video {
	background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
}

/* Audio - Orange */
.product-document-thumbnail--audio {
	background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%);
}

/* Spreadsheet/Data - Green */
.product-document-thumbnail--spreadsheet {
	background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

/* Document/Text - Blue */
.product-document-thumbnail--document {
	background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

/* Presentation - Amber */
.product-document-thumbnail--presentation {
	background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

/* Image - Teal */
.product-document-thumbnail--image {
	background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%);
}

/* Archive/Zip - Gray */
.product-document-thumbnail--archive {
	background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
}

/* Generic fallback - Slate */
.product-document-thumbnail--generic {
	background: linear-gradient(135deg, #64748b 0%, #475569 100%);
}

/* ==========================================================================
   Documents Card Grid Layout
   ========================================================================== */

.product-documents-cards {
	margin-bottom: 32px;
}

.product-documents-cards-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 16px;
	list-style: none;
	margin: 0;
	padding: 0;
}

/* Mobile: single column */
@media (max-width: 767px) {
	.product-documents-cards-grid {
		grid-template-columns: 1fr;
	}
}

.product-document-card {
	margin: 0;
	padding: 0;
	background: #fff;
	border: 1px solid var(--wp--preset--color--border-light, #e5e7eb);
	border-radius: 8px;
	overflow: hidden;
	transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.product-document-card:hover {
	border-color: var(--wp--preset--color--contrast-3, #d1d5db);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.product-document-card a {
	display: flex;
	align-items: stretch;
	gap: 0;
	padding: 0;
	text-decoration: none;
	color: inherit;
	height: 100%;
	max-height: 100px;
}

/* Card thumbnail - left side */
.product-document-card .product-document-thumbnail {
	width: 80px;
	height: 100%;
	border-radius: 0;
	border: none;
	flex-shrink: 0;
}

.product-document-card .product-document-thumbnail--placeholder {
	border-radius: 0;
}

/* Card content - right side */
.product-document-card .product-document-info {
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 4px;
	padding: 16px;
	flex: 1;
	min-width: 0;
}

.product-document-card .product-document-product-name {
	font-size: 0.9rem;
	font-weight: 600;
	color: #111827;
	line-height: 1.3;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.product-document-card .product-document-type {
	font-size: 0.85rem;
	color: #6b7280;
	line-height: 1.4;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.product-document-card .product-document-desc {
	font-size: 0.85rem;
	color: #6b7280;
	line-height: 1.4;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.product-document-card .product-document-meta {
	font-size: 0.75rem;
	color: #9ca3af;
	background: none;
	padding: 0;
	margin-top: 4px;
}
