/**
 * Woo Templates List Page Styles
 *
 * @package Shortcodeglut
 */

/* Page Container */
.shortcodeglut-woo-templates-page {
	margin: 20px;
}

.shortcodeglut-woo-templates-page .description {
	color: #646970;
	font-size: 14px;
	margin: 0 0 20px 0;
}

/* Template Table Styles */
.wp-list-table .column-template_name {
	width: 30%;
}

.wp-list-table .column-template_id {
	width: 40%;
}

.wp-list-table .column-actions {
	width: 30%;
	text-align: right;
}

/* Table row spacing */
.shortcodeglut-woo-templates-page .wp-list-table {
	border-collapse: separate;
	border-spacing: 0 8px !important;
	margin-top: 8px;
}

.shortcodeglut-woo-templates-page .wp-list-table thead th {
	padding: 8px 10px !important;
	vertical-align: middle;
}

.shortcodeglut-woo-templates-page .wp-list-table tbody td {
	padding: 12px 10px !important;
	vertical-align: middle;
}

.shortcodeglut-woo-templates-page .wp-list-table tbody tr {
	min-height: 50px;
	background-color: #fff;
	border: 1px solid #e0e0e0;
	border-radius: 6px;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* Override WordPress striped rows */
.shortcodeglut-woo-templates-page .wp-list-table.striped tbody tr:nth-child(odd) {
	background-color: #fff !important;
}

.shortcodeglut-woo-templates-page .wp-list-table.striped tbody tr:nth-child(even) {
	background-color: #fff !important;
}

/* Table row hover effect */
.shortcodeglut-woo-templates-page .wp-list-table tbody tr:hover {
	background-color: #f6f7f7 !important;
}

/* Better spacing for table cells */
.shortcodeglut-woo-templates-page .wp-list-table td {
	line-height: 1.6;
}

/* Fix first and last cell border radius */
.shortcodeglut-woo-templates-page .wp-list-table tbody tr td:first-child {
	border-radius: 8px 0 0 8px;
}

.shortcodeglut-woo-templates-page .wp-list-table tbody tr td:last-child {
	border-radius: 0 8px 8px 0;
}

/* Badge for Prebuilt Templates */
.scg-badge {
	display: inline-block;
	padding: 3px 8px;
	font-size: 11px;
	font-weight: 500;
	line-height: 1.4;
	border-radius: 3px;
	margin-left: 8px;
	vertical-align: middle;
}

/* Template name wrapper */
.shortcodeglut-woo-templates-page .column-template_name strong {
	display: inline-block;
	margin-right: 4px;
	vertical-align: middle;
}

.scg-badge--default {
	background: #edfaef;
	color: #006600;
}

/* Template ID Wrapper */
.shortcodeglut-template-id-wrapper {
	display: flex;
	align-items: center;
	gap: 8px;
}

.shortcodeglut-template-id-code {
	background: #f0f0f1;
	padding: 4px 8px;
	border-radius: 4px;
	font-family: Monaco, Consolas, monospace;
	font-size: 12px;
	color: #50575e;
}

/* Copy Button */
.shortcodeglut-copy-btn {
	background: none;
	border: none;
	cursor: pointer;
	padding: 4px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: #50575e;
	transition: color 0.2s;
}

.shortcodeglut-copy-btn:hover {
	color: #2271b1;
}

.shortcodeglut-copy-btn.copied {
	color: #00a32a;
}

/* Action Buttons */
.shortcodeglut-template-actions {
	display: flex;
	gap: 8px;
	justify-content: flex-end;
	align-items: center;
}

.shortcodeglut-action-btn {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 6px 10px;
	font-size: 12px;
	line-height: 1.4;
	border: 1px solid #c3c4c7;
	background: #f6f7f7;
	color: #50575e;
	cursor: pointer;
	border-radius: 3px;
	transition: all 0.2s;
	white-space: nowrap;
}

.shortcodeglut-action-btn:hover {
	background: #f0f0f1;
	border-color: #8c8f94;
	color: #1d2327;
}

.shortcodeglut-action-btn .dashicons {
	font-size: 16px;
	width: 16px;
	height: 16px;
}

/* Preview Modal */
/* Preview Modal */
#shortcodeglut-preview-modal {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 99998;
}

#shortcodeglut-preview-modal-container, .shortcodeglut-modal-container {
	position: fixed;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 25px 50px rgba(0,0,0,0.25);
	max-width: 1100px;
	width: 92%;
	max-height: 90vh;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	z-index: 100000;
	animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
	from {
		opacity: 0;
		transform: translate(-50%, -48%);
	}
	to {
		opacity: 1;
		transform: translate(-50%, -50%);
	}
}

#shortcodeglut-preview-modal-overlay, .shortcodeglut-modal-overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0,0,0,0.75);
	backdrop-filter: blur(2px);
	z-index: 99999;
}
.shortcodeglut-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 20px 24px;
	border-bottom: 1px solid #e0e0e0;
	background: #f8f9fa;
	border-radius: 12px 12px 0 0;
}

.shortcodeglut-modal-header h3 {
	margin: 0;
	font-size: 20px;
	font-weight: 600;
	color: #1d2327;
}

.shortcodeglut-modal-close {
	background: none;
	border: none;
	cursor: pointer;
	padding: 8px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: #50575e;
	transition: all 0.15s ease;
	border-radius: 6px;
	min-width: 36px;
	min-height: 36px;
}

.shortcodeglut-modal-close:hover {
	background: #e0e0e0;
	color: #1d2327;
}

.shortcodeglut-modal-close .dashicons {
	font-size: 24px;
	width: 24px;
	height: 24px;
}

.shortcodeglut-modal-body {
	padding: 0;
	overflow-y: auto;
	overflow-x: hidden;
	max-height: calc(90vh - 100px);
	background: linear-gradient(180deg, #f8f9fa 0%, #e9ecef 100%);
}

/* Preview Content Styles */
.shortcodeglut-preview-content {
	padding: 40px;
	background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
	border-radius: 0;
	min-height: 450px;
	max-height: calc(90vh - 80px);
	overflow: auto;
}

/* Preview content div - scoped to avoid admin CSS conflicts */
#shortcodeglut-preview-content {
	width: 100%;
	position: relative;
}

/* Loading and error states */
#shortcodeglut-preview-content .loading,
#shortcodeglut-preview-content .error {
	text-align: center;
	padding: 60px 20px;
	font-size: 16px;
	color: #6c757d;
}

#shortcodeglut-preview-content .error {
	color: #dc3545;
}

/* Font Awesome icon fixes - override incorrect font-family and ensure visibility */
#shortcodeglut-preview-content .fa,
#shortcodeglut-preview-content .fas,
#shortcodeglut-preview-content .far,
#shortcodeglut-preview-content .fab,
#shortcodeglut-preview-content .fa-solid,
#shortcodeglut-preview-content .fa-regular,
#shortcodeglut-preview-content .fa-brands {
	font-family: "Font Awesome 6 Free", "Font Awesome 6 Brands", "Font Awesome 6 Pro" !important;
	display: inline-block !important;
	width: auto !important;
	height: auto !important;
	line-height: 1em !important;
}

#shortcodeglut-preview-content .fa-solid,
#shortcodeglut-preview-content .fas {
	font-weight: 900 !important;
}

#shortcodeglut-preview-content .fa-regular,
#shortcodeglut-preview-content .far {
	font-weight: 400 !important;
}

#shortcodeglut-preview-content .fab,
#shortcodeglut-preview-content .fa-brands {
	font-family: "Font Awesome 6 Brands" !important;
	font-weight: 400 !important;
}

/* Ensure button-group icons are visible */
#shortcodeglut-preview-content .button-group a i,
#shortcodeglut-preview-content .shopg-wishlist-section i,
#shortcodeglut-preview-content .shopg-compare-section i,
#shortcodeglut-preview-content .quickview-section i {
	font-family: "Font Awesome 6 Free", "Font Awesome 6 Brands" !important;
	font-weight: 900 !important;
	display: inline-block !important;
	visibility: visible !important;
	opacity: 1 !important;
	color: #333 !important;
}

#shortcodeglut-preview-content .button-group a .fa-regular,
#shortcodeglut-preview-content .shopg-wishlist-section .fa-regular {
	font-weight: 400 !important;
}

/* Force all Font Awesome icons to use ::before pseudo-element */
#shortcodeglut-preview-content .fa-solid::before,
#shortcodeglut-preview-content .fa-regular::before,
#shortcodeglut-preview-content .fa-brands::before {
	display: inline-block !important;
	font-family: "Font Awesome 6 Free", "Font Awesome 6 Brands" !important;
	visibility: visible !important;
}

/* Preview content grid wrapper */
.shortcodeglut-preview-content .product-grid-wrapper {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
	gap: 32px;
	align-items: start;
}

/* Preview content card wrapper */
.shortcodeglut-preview-content > div {
	max-width: 100%;
}

/* Loading state in preview */
.shortcodeglut-preview-content .loading,
.shortcodeglut-preview-content .error {
	grid-column: 1 / -1;
	text-align: center;
	padding: 60px 20px;
	font-size: 16px;
	color: #6c757d;
}

.shortcodeglut-preview-content .error {
	color: #dc3545;
}

/* Pagination Container - Fix overflow issue */
.shortcodeglut-woo-templates-page .tablenav {
	clear: both;
	margin: 10px 0 20px 0;
	position: relative;
	z-index: 1;
}

.shortcodeglut-woo-templates-page .tablenav.top {
	margin-bottom: 10px;
}

.shortcodeglut-woo-templates-page .tablenav.bottom {
	margin-top: 20px;
}

.shortcodeglut-woo-templates-page .tablenav-pages {
	margin: 0;
}

.shortcodeglut-woo-templates-page .displaying-num {
	margin: 0 10px 0 0;
}

/* Responsive */
@media (max-width: 782px) {
	.shortcodeglut-woo-templates-page {
		margin: 10px;
	}

	.wp-list-table .column-template_id,
	.wp-list-table .column-actions {
		width: auto;
	}

	#shortcodeglut-preview-modal-container, .shortcodeglut-modal-container {
		max-width: 95%;
		max-height: 95%;
	}
}
