/* ==========================================================================
   Woo Product Docs — Frontend Styles
   ========================================================================== */

/* ------------------------------------------------------------------
 *  Document list
 * ------------------------------------------------------------------ */

.ccdm-doc-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.ccdm-doc-list li {
	padding: 8px 0;
	border-bottom: 1px solid #eee;
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.ccdm-doc-list li:last-child {
	border-bottom: none;
}

/* ------------------------------------------------------------------
 *  Document category card grid (grouped view)
 * ------------------------------------------------------------------ */

.ccdm-doc-card-grid {
	display: grid;
	grid-template-columns: repeat( auto-fill, minmax( 160px, 1fr ) );
	gap: 16px;
	margin: 0;
	padding: 0;
}

.ccdm-doc-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	padding: 20px 12px 16px;
	background: #f7f7f7;
	border-radius: 8px;
	text-align: center;
	text-decoration: none;
	color: inherit;
	cursor: pointer;
	transition: background 0.18s, box-shadow 0.18s;
}

.ccdm-doc-card:hover,
.ccdm-doc-card:focus {
	background: #f4f4f4;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
	outline: none;
}

.ccdm-doc-card__icon {
	width: 72px;
	height: 72px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #999;
	flex-shrink: 0;
}

.ccdm-doc-card__icon svg {
	width: 100%;
	height: 100%;
}

.ccdm-doc-card__icon img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
}

.ccdm-doc-card__label {
	font-size: 0.82em;
	font-weight: 600;
	color: #555;
	line-height: 1.3;
	letter-spacing: 0.02em;
	text-transform: uppercase;
}

.ccdm-doc-card__doc-name {
	font-size: 0.78em;
	color: #888;
	line-height: 1.4;
	margin-top: -2px;
}

/* ------------------------------------------------------------------
 *  Legacy grouped view (kept for backwards compat if ever used)
 * ------------------------------------------------------------------ */

.ccdm-doc-group {
	margin-bottom: 24px;
}

.ccdm-doc-group-title {
	font-size: 1.1em;
	margin: 0 0 8px;
	padding-bottom: 4px;
	border-bottom: 2px solid #333;
}

/* ------------------------------------------------------------------
 *  Document list (ungrouped)
 * ------------------------------------------------------------------ */

.ccdm-doc-item {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.ccdm-view-btn {
	background: none;
	border: 1px solid #333;
	color: #333;
	padding: 6px 14px;
	cursor: pointer;
	font-size: 0.9em;
	border-radius: 3px;
	transition: background 0.2s, color 0.2s;
}

.ccdm-view-btn:hover,
.ccdm-view-btn:focus {
	background: #333;
	color: #fff;
}

.ccdm-download-link {
	color: #666;
	text-decoration: none;
	display: inline-flex;
	align-items: center;
}

.ccdm-download-link:hover {
	color: #333;
}

.ccdm-download-link .dashicons {
	font-size: 18px;
	width: 18px;
	height: 18px;
}

.ccdm-doc-link {
	color: #333;
	text-decoration: underline;
}

.ccdm-doc-link:hover {
	color: #000;
}

/* ------------------------------------------------------------------
 *  Modal (dialog)
 * ------------------------------------------------------------------ */

dialog.ccdm-modal {
	border: none;
	border-radius: 8px;
	padding: 0;
	max-width: 90vw;
	max-height: 90vh;
	width: 900px;
	box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3);
	overflow: hidden;
}

dialog.ccdm-modal::backdrop {
	background: rgba(0, 0, 0, 0.6);
}

/* Fallback for browsers without ::backdrop support */
dialog.ccdm-modal.ccdm-modal--fallback-open {
	position: fixed;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	z-index: 999999;
}

.ccdm-modal-inner {
	display: flex;
	flex-direction: column;
	max-height: 90vh;
}

.ccdm-modal-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 16px 20px;
	border-bottom: 1px solid #eee;
	flex-shrink: 0;
}

.ccdm-modal-title {
	margin: 0;
	font-size: 1.2em;
	font-weight: 600;
}

.ccdm-modal-close {
	background: none;
	border: none;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	color: #999;
	padding: 0 4px;
}

.ccdm-modal-close:hover {
	color: #333;
}

.ccdm-modal-body {
	padding: 20px;
	overflow: auto;
	flex: 1;
}

/* ------------------------------------------------------------------
 *  Viewer content (inside modal or embedded)
 * ------------------------------------------------------------------ */

.ccdm-viewer-iframe {
	width: 100%;
	height: 75vh;
	min-height: 400px;
	border: none;
}

.ccdm-viewer-image {
	max-width: 100%;
	height: auto;
	display: block;
	margin: 0 auto;
}

/* ------------------------------------------------------------------
 *  Embedded viewer
 * ------------------------------------------------------------------ */

.ccdm-embed-wrap {
	margin: 16px 0;
}

.ccdm-embed-title {
	margin: 0 0 8px;
	font-size: 1em;
	font-weight: 600;
}

/* ------------------------------------------------------------------
 *  Scroll lock
 * ------------------------------------------------------------------ */

body.ccdm-modal-open {
	overflow: hidden;
}

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

@media (max-width: 768px) {
	dialog.ccdm-modal {
		max-width: 98vw;
		width: 98vw;
	}

	.ccdm-viewer-iframe {
		height: 60vh;
		min-height: 300px;
	}

	.ccdm-modal-header {
		padding: 12px 16px;
	}

	.ccdm-modal-body {
		padding: 12px;
	}

	.ccdm-doc-card-grid {
		grid-template-columns: repeat( auto-fill, minmax( 130px, 1fr ) );
		gap: 12px;
	}

	.ccdm-doc-card {
		padding: 14px 8px 12px;
	}

	.ccdm-doc-card__icon {
		width: 52px;
		height: 52px;
	}
}
