/**
 * Gravity AcroForm PDF - Frontend Download Elements & Dashboard Shortcode Styling
 */

/* ==========================================================================
   1. Confirmation & Single Download Elements
   ========================================================================== */

.gf-acroform-btn-wrapper,
.gf-acroform-download-wrap {
	margin: 20px 0;
	display: inline-block;
}

.gf-acroform-download-button,
.gf-acroform-download-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	background: linear-gradient(135deg, #1e73be 0%, #0d47a1 100%);
	color: #ffffff !important;
	font-family: inherit;
	font-size: 15px;
	font-weight: 600;
	text-decoration: none !important;
	padding: 12px 24px;
	border-radius: 6px;
	box-shadow: 0 4px 12px rgba(13, 71, 161, 0.25);
	transition: all 0.25s ease-in-out;
	cursor: pointer;
	border: none;
	line-height: 1.4;
}

.gf-acroform-download-button svg,
.gf-acroform-download-btn svg {
	width: 18px;
	height: 18px;
	fill: currentColor;
}

.gf-acroform-download-button:hover,
.gf-acroform-download-btn:hover {
	background: linear-gradient(135deg, #1565c0 0%, #0a3880 100%);
	box-shadow: 0 6px 16px rgba(13, 71, 161, 0.35);
	transform: translateY(-1px);
	color: #ffffff !important;
}

.gf-acroform-download-button:active,
.gf-acroform-download-btn:active {
	transform: translateY(1px);
	box-shadow: 0 2px 6px rgba(13, 71, 161, 0.2);
}

.gf-acroform-download-link {
	color: #1e73be;
	font-weight: 600;
	text-decoration: underline;
	transition: color 0.15s ease;
}

.gf-acroform-download-link:hover {
	color: #0d47a1;
}

/* ==========================================================================
   2. User Dashboard Shortcode Container [gf_acroform_user_downloads]
   ========================================================================== */

.gf-acroform-dashboard-wrapper {
	box-sizing: border-box;
	width: 100%;
	margin: 24px 0;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	color: #1e293b;
}

.gf-acroform-dashboard-wrapper *,
.gf-acroform-dashboard-wrapper *::before,
.gf-acroform-dashboard-wrapper *::after {
	box-sizing: inherit;
}

.gf-acroform-dashboard-title {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 1.25rem;
	font-weight: 700;
	color: #0f172a;
	margin: 0 0 16px 0;
	padding-bottom: 8px;
	border-bottom: 2px solid #e2e8f0;
}

.gf-acroform-dashboard-title .gf-icon {
	color: #2563eb;
}

/* Badges */
.gf-pdf-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 5px;
	background: #fee2e2;
	color: #dc2626;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.5px;
	padding: 3px 7px 3px 5px;
	border-radius: 4px;
	border: 1px solid #fecaca;
	flex-shrink: 0;
	line-height: 1;
}

.gf-pdf-badge svg,
.gf-pdf-badge img {
	margin-right: 5px;
}

.gf-pdf-badge .gf-pdf-icon,
.gf-pdf-badge-large .gf-pdf-icon {
	display: inline-block;
	flex-shrink: 0;
	vertical-align: middle;
	object-fit: contain;
}

.gf-pdf-badge-large {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	background: #fee2e2;
	color: #dc2626;
	font-size: 13px;
	font-weight: 800;
	letter-spacing: 0.5px;
	padding: 6px 10px;
	border-radius: 6px;
	border: 1px solid #fecaca;
	line-height: 1;
}

.gf-fullname-text {
	display: inline-block;
	color: #1e293b;
	font-size: 14px;
	font-weight: 600;
	word-break: break-word;
}

.gf-form-badge {
	display: inline-block;
	background: #f1f5f9;
	color: #475569;
	font-size: 12px;
	font-weight: 600;
	padding: 4px 8px;
	border-radius: 4px;
	max-width: 220px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.gf-card-badges {
	display: flex;
	align-items: center;
	gap: 6px;
	flex-wrap: wrap;
	margin-top: 4px;
}

/* Action Buttons */
.gf-action-buttons {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.gf-btn-action {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	font-weight: 600;
	padding: 6px 14px;
	border-radius: 5px;
	text-decoration: none !important;
	transition: all 0.2s ease;
	line-height: 1.3;
	border: 1px solid transparent;
	cursor: pointer;
}

.gf-btn-download {
	background: #2563eb;
	color: #ffffff !important;
	box-shadow: 0 1px 3px rgba(37, 99, 235, 0.2);
}

.gf-btn-download:hover {
	background: #1d4ed8;
	transform: translateY(-1px);
	box-shadow: 0 4px 6px rgba(37, 99, 235, 0.3);
	color: #ffffff !important;
}

.gf-btn-preview {
	background: #ffffff;
	color: #475569 !important;
	border-color: #cbd5e1;
}

.gf-btn-preview:hover {
	background: #f8fafc;
	color: #0f172a !important;
	border-color: #94a3b8;
}

/* Table View (Desktop & Tablet) */
.gf-acroform-table-container {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	background: #ffffff;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.gf-acroform-downloads-table {
	width: 100%;
	border-collapse: collapse;
	text-align: left;
	font-size: 14px;
	margin: 0 !important;
}

.gf-acroform-downloads-table thead {
	background: #f8fafc;
	border-bottom: 1px solid #e2e8f0;
}

.gf-acroform-downloads-table th {
	padding: 12px 16px;
	font-weight: 600;
	color: #475569;
	text-transform: uppercase;
	font-size: 12px;
	letter-spacing: 0.5px;
	white-space: nowrap;
}

.gf-acroform-downloads-table td {
	padding: 14px 16px;
	border-bottom: 1px solid #f1f5f9;
	vertical-align: middle;
	color: #334155;
}

.gf-acroform-downloads-table tbody tr:last-child td {
	border-bottom: none;
}

.gf-acroform-downloads-table tbody tr:hover {
	background-color: #f8fafc;
}

.gf-doc-name-wrap {
	display: flex;
	align-items: center;
	gap: 10px;
}

.gf-doc-filename {
	font-weight: 600;
	color: #0f172a;
	word-break: break-word;
}

.gf-date-text,
.gf-size-text {
	color: #64748b;
	font-size: 13px;
	white-space: nowrap;
}

/* Cards View */
.gf-acroform-cards-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: 16px;
}

.gf-acroform-card {
	background: #ffffff;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	padding: 16px;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gf-acroform-card:hover {
	transform: translateY(-2px);
	box-shadow: 0 6px 12px rgba(0, 0, 0, 0.08);
	border-color: #cbd5e1;
}

.gf-card-header {
	display: flex;
	gap: 12px;
	align-items: flex-start;
	margin-bottom: 12px;
}

.gf-card-meta {
	flex: 1;
	min-width: 0;
}

.gf-card-filename {
	margin: 0 0 4px 0;
	font-size: 15px;
	font-weight: 700;
	color: #0f172a;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.gf-card-fullname {
	display: inline-block;
	background: #f1f5f9;
	color: #334155;
	font-size: 12px;
	padding: 2px 6px;
	border-radius: 4px;
	font-weight: 600;
}

.gf-card-body {
	border-top: 1px solid #f1f5f9;
	border-bottom: 1px solid #f1f5f9;
	padding: 10px 0;
	margin-bottom: 14px;
}

.gf-card-info-row {
	display: flex;
	justify-content: space-between;
	font-size: 13px;
	margin-bottom: 6px;
}

.gf-card-info-row:last-child {
	margin-bottom: 0;
}

.gf-info-label {
	color: #64748b;
}

.gf-info-val {
	font-weight: 600;
	color: #334155;
}

.gf-card-footer {
	display: flex;
	gap: 8px;
}

.gf-card-footer .gf-btn-action {
	flex: 1;
	justify-content: center;
}

/* List View */
.gf-acroform-list-view {
	list-style: none !important;
	padding: 0 !important;
	margin: 0 !important;
	background: #ffffff;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	overflow: hidden;
}

.gf-list-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 16px;
	border-bottom: 1px solid #f1f5f9;
	transition: background-color 0.15s ease;
	gap: 16px;
}

.gf-list-item:last-child {
	border-bottom: none;
}

.gf-list-item:hover {
	background-color: #f8fafc;
}

.gf-list-left {
	display: flex;
	align-items: center;
	gap: 12px;
	min-width: 0;
}

.gf-list-details {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.gf-list-filename {
	font-weight: 600;
	font-size: 14px;
	color: #0f172a;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.gf-list-submeta {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 12px;
}

.gf-list-fullname {
	color: #334155;
	font-weight: 600;
}

.gf-list-date {
	font-size: 12px;
	color: #64748b;
}

.gf-list-right {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-shrink: 0;
}

/* Empty State */
.gf-acroform-empty-state {
	text-align: center;
	padding: 40px 20px;
	background: #ffffff;
	border: 1px dashed #cbd5e1;
	border-radius: 8px;
}

.gf-acroform-empty-icon {
	margin-bottom: 12px;
	color: #94a3b8;
}

.gf-acroform-empty-text {
	margin: 0;
	font-size: 15px;
	color: #64748b;
	font-weight: 500;
}

/* Logged Out Notice */
.gf-acroform-notice {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 18px 20px;
	border-radius: 8px;
	background: #eff6ff;
	border: 1px solid #bfdbfe;
	color: #1e40af;
}

.gf-notice-icon {
	flex-shrink: 0;
	color: #3b82f6;
}

.gf-notice-content {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 12px;
	width: 100%;
}

.gf-notice-message {
	margin: 0;
	font-size: 15px;
	font-weight: 500;
	color: #1e3a8a;
}

.gf-acroform-login-btn {
	display: inline-flex;
	align-items: center;
	background: #2563eb;
	color: #ffffff !important;
	font-size: 14px;
	font-weight: 600;
	text-decoration: none !important;
	padding: 8px 16px;
	border-radius: 6px;
	transition: background-color 0.2s ease;
	white-space: nowrap;
}

.gf-acroform-login-btn:hover {
	background: #1d4ed8;
	color: #ffffff !important;
}

/* ==========================================================================
   3. Mobile Responsive Transformation (Screens <= 768px)
   ========================================================================== */

@media (max-width: 768px) {
	.gf-acroform-dashboard-wrapper {
		margin: 16px 0;
	}

	.gf-acroform-table-container {
		background: transparent;
		border: none;
		box-shadow: none;
		overflow-x: visible;
	}

	.gf-acroform-downloads-table {
		display: block;
		width: 100%;
		border: none;
	}

	.gf-acroform-downloads-table thead {
		display: none;
	}

	.gf-acroform-downloads-table tbody {
		display: flex;
		flex-direction: column;
		gap: 14px;
		width: 100%;
	}

	.gf-acroform-downloads-table tbody tr {
		display: block;
		background: #ffffff;
		border: 1px solid #e2e8f0;
		border-radius: 10px;
		padding: 14px 16px;
		box-shadow: 0 2px 5px rgba(0, 0, 0, 0.04);
		transition: transform 0.2s ease, box-shadow 0.2s ease;
	}

	.gf-acroform-downloads-table tbody tr:hover {
		background-color: #ffffff;
		box-shadow: 0 4px 10px rgba(0, 0, 0, 0.07);
		border-color: #cbd5e1;
	}

	.gf-acroform-downloads-table td {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 8px 0;
		border-bottom: 1px solid #f1f5f9;
		font-size: 13px;
		text-align: right;
		width: 100%;
	}

	.gf-acroform-downloads-table td:last-child {
		border-bottom: none;
	}

	.gf-acroform-downloads-table td::before {
		content: attr(data-label);
		font-weight: 600;
		color: #64748b;
		font-size: 12px;
		text-transform: uppercase;
		letter-spacing: 0.5px;
		padding-right: 12px;
		text-align: left;
		flex-shrink: 0;
	}

	/* Top row of the card: Document Name */
	.gf-acroform-downloads-table td.col-filename {
		display: flex;
		flex-direction: column;
		align-items: flex-start;
		border-bottom: 1px solid #e2e8f0;
		padding-top: 0;
		padding-bottom: 10px;
		margin-bottom: 4px;
	}

	.gf-acroform-downloads-table td.col-filename::before {
		display: none;
	}

	.gf-acroform-downloads-table td.col-filename .gf-doc-name-wrap {
		width: 100%;
		display: flex;
		align-items: center;
		gap: 8px;
	}

	.gf-acroform-downloads-table td.col-filename .gf-doc-filename {
		font-size: 15px;
		font-weight: 700;
		color: #0f172a;
		word-break: break-word;
	}

	/* Value elements in mobile rows */
	.gf-acroform-downloads-table td.col-fullname .gf-fullname-text {
		font-size: 13px;
		font-weight: 600;
		text-align: right;
	}

	.gf-acroform-downloads-table td.col-form .gf-form-badge {
		max-width: 180px;
		font-size: 11px;
	}

	.gf-acroform-downloads-table td.col-date .gf-date-text,
	.gf-acroform-downloads-table td.col-size .gf-size-text {
		font-size: 13px;
	}

	/* Bottom row of the card: Action Buttons */
	.gf-acroform-downloads-table td.col-actions {
		display: block;
		padding-top: 12px;
		padding-bottom: 0;
		border-bottom: none;
	}

	.gf-acroform-downloads-table td.col-actions::before {
		display: none;
	}

	.gf-acroform-downloads-table td.col-actions .gf-action-buttons {
		display: flex;
		gap: 8px;
		width: 100%;
	}

	.gf-acroform-downloads-table td.col-actions .gf-btn-action {
		flex: 1;
		justify-content: center;
		padding: 10px 14px;
		font-size: 13px;
	}

	/* List View Mobile */
	.gf-list-item {
		flex-direction: column;
		align-items: flex-start;
		gap: 12px;
	}

	.gf-list-right {
		width: 100%;
		justify-content: stretch;
	}

	.gf-list-right .gf-btn-action {
		flex: 1;
		justify-content: center;
		padding: 8px 12px;
	}

	/* Logged-out state */
	.gf-notice-content {
		flex-direction: column;
		align-items: flex-start;
	}
}

/* ==========================================================================
   Dynamic AJAX Hydration & Transition Animations
   ========================================================================== */

.gf-acroform-fade-in {
	animation: gfAcroformFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes gfAcroformFadeIn {
	from {
		opacity: 0;
		transform: translateY(4px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.gf-acroform-checking {
	position: relative;
	pointer-events: none;
	opacity: 0.85;
	transition: opacity 0.2s ease;
}