/**
 * CS39 Certificate Upload - Frontend Styles
 * Version: 1.1.4
 */

/* Certificate Section */
.cs39-certificate-section {
	background: #f8f9fa;
	border-radius: 8px;
	padding: 20px;
	margin-top: 20px;
	margin-bottom: 20px;
	border: 2px solid #e9ecef;
}

.cs39-certificate-section.cs39-needs-certificate {
	background: #fff3cd;
	border-color: #ffc107;
}

.cs39-certificate-section.cs39-has-certificate {
	background: #d4edda;
	border-color: #28a745;
}

.cs39-certificate-section.cs39-status-pending {
	background: #fff3cd;
	border-color: #ffc107;
}

.cs39-certificate-section.cs39-status-rejected {
	background: #f8d7da;
	border-color: #dc3545;
}

/* Header */
.cs39-certificate-header {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 15px;
}

.cs39-certificate-header h4 {
	margin: 0;
	font-size: 16px;
	font-weight: 600;
}

.cs39-status-icon {
	font-size: 24px;
}

/* Notice Text */
.cs39-notice-text {
	margin: 0 0 20px;
	color: #856404;
	font-size: 14px;
	line-height: 1.5;
}

/* Certificate Info */
.cs39-certificate-info {
	margin-bottom: 15px;
}

.cs39-certificate-details p {
	margin: 0 0 8px;
	font-size: 14px;
}

/* Status Badge */
.cs39-status-badge {
	display: inline-block;
	padding: 4px 12px;
	border-radius: 20px;
	font-size: 13px;
	font-weight: 600;
}

.cs39-status-badge--pending {
	background: #fff3cd;
	color: #856404;
}

.cs39-status-badge--approved {
	background: #d4edda;
	color: #155724;
}

.cs39-status-badge--rejected {
	background: #f8d7da;
	color: #721c24;
}

.cs39-preview-link a {
	color: #6f8c46;
	text-decoration: underline;
	font-size: 14px;
}

.cs39-preview-link a:hover {
	color: #4a5f2f;
}

/* Actions */
.cs39-certificate-actions {
	margin-top: 15px;
}

/* Toggle Upload Button - inherits theme .button styles */
.cs39-toggle-upload {
	cursor: pointer;
}

/* Upload Form Wrapper */
.cs39-upload-form-wrapper {
	margin-top: 20px;
	padding-top: 20px;
	border-top: 1px solid rgba(0,0,0,0.1);
}

/* Upload Form */
.cs39-upload-form {
	background: #fff;
	border-radius: 8px;
	padding: 20px;
	box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* Upload Methods */
.cs39-upload-methods {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
}

.cs39-upload-method {
	text-align: center;
}

/* Upload Button - uses theme .button class, minimal overrides */
.cs39-upload-btn {
	cursor: pointer;
}

/* Phone Upload Link */
.cs39-upload-phone-link {
	margin-top: 5px;
}

.cs39-phone-upload-link {
	color: #6f8c46;
	font-size: 14px;
	text-decoration: underline;
	cursor: pointer;
}

.cs39-phone-upload-link:hover {
	color: #4a5f2f;
}

/* QR Section */
.cs39-qr-section {
	margin-top: 20px;
	text-align: center;
}

.cs39-qr-container {
	background: #f8f9fa;
	border-radius: 12px;
	padding: 30px;
	display: inline-block;
}

#cs39-qr-code {
	width: 200px;
	height: 200px;
	border-radius: 8px;
	box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.cs39-qr-instructions {
	margin: 15px 0 10px;
	color: #666;
	font-size: 14px;
	max-width: 250px;
}

.cs39-qr-status {
	color: #94be57;
	font-size: 14px;
	font-weight: 600;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
}

.cs39-cancel-qr {
	margin-top: 15px;
	background: none;
	border: 1px solid #ddd;
	padding: 8px 20px;
	border-radius: 20px;
	cursor: pointer;
	color: #666;
	font-size: 13px;
}

.cs39-cancel-qr:hover {
	background: #f8f9fa;
}

/* Spinner */
.cs39-spinner {
	display: inline-block;
	width: 16px;
	height: 16px;
	border: 2px solid #e9ecef;
	border-top-color: #94be57;
	border-radius: 50%;
	animation: cs39-spin 1s linear infinite;
}

@keyframes cs39-spin {
	to { transform: rotate(360deg); }
}

/* Progress */
.cs39-upload-progress {
	margin-top: 20px;
	text-align: center;
}

.cs39-progress-bar {
	height: 8px;
	background: #e9ecef;
	border-radius: 4px;
	overflow: hidden;
	margin-bottom: 10px;
}

.cs39-progress-fill {
	height: 100%;
	background: linear-gradient(135deg, #94be57 0%, #6f8c46 100%);
	width: 0%;
	transition: width 0.3s ease;
	animation: cs39-progress-pulse 1.5s ease-in-out infinite;
}

@keyframes cs39-progress-pulse {
	0%, 100% { width: 30%; margin-left: 0; }
	50% { width: 50%; margin-left: 50%; }
}

/* Drag-and-drop rejected flash */
.cs39-upload-form.cs39-dragover-rejected {
	border: 2px solid #dc3545;
	background: #fff5f5;
	transition: border-color 0.2s, background 0.2s;
}

.cs39-progress-text {
	color: #666;
	font-size: 14px;
	margin: 0;
}

/* Preview */
.cs39-upload-preview {
	margin-top: 20px;
	text-align: center;
	padding: 20px;
	background: #f8f9fa;
	border-radius: 8px;
}

#cs39-preview-image {
	max-width: 150px;
	max-height: 150px;
	border-radius: 8px;
	box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

#cs39-preview-filename {
	margin: 10px 0;
	font-size: 14px;
	color: #333;
	word-break: break-all;
}

.cs39-remove-preview {
	background: #dc3545;
	color: #fff;
	border: none;
	padding: 8px 20px;
	border-radius: 20px;
	cursor: pointer;
	font-size: 13px;
	transition: background 0.2s;
}

.cs39-remove-preview:hover {
	background: #c82333;
}

/* File Requirements */
.cs39-file-requirements {
	margin: 15px 0 0;
	font-size: 12px;
	color: #999;
	text-align: center;
}

/* Order Certificate Box */
.cs39-order-certificate {
	animation: cs39-fade-in 0.5s ease;
}

@keyframes cs39-fade-in {
	from { opacity: 0; transform: translateY(-10px); }
	to { opacity: 1; transform: translateY(0); }
}

/* Certificate Modal */
.cs39-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
}

.cs39-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.75);
	cursor: pointer;
}

.cs39-modal-content {
	position: relative;
	z-index: 1;
	max-width: 90vw;
	max-height: 90vh;
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
}

.cs39-modal-content img {
	display: block;
	max-width: 90vw;
	max-height: 85vh;
	width: auto;
	height: auto;
}

.cs39-modal-close {
	position: absolute;
	top: 8px;
	right: 8px;
	z-index: 2;
	background: rgba(0, 0, 0, 0.55);
	border: none;
	border-radius: 50%;
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	padding: 0;
	line-height: 1;
	transition: background 0.2s;
}

.cs39-modal-close:hover {
	background: rgba(0, 0, 0, 0.8);
}

.cs39-modal-close .dashicons {
	color: #fff;
	font-size: 18px;
	width: 18px;
	height: 18px;
}

/* Success Animation */
.cs39-success-animation {
	animation: cs39-success-pop 0.5s ease;
}

@keyframes cs39-success-pop {
	0% { transform: scale(0.8); opacity: 0; }
	50% { transform: scale(1.1); }
	100% { transform: scale(1); opacity: 1; }
}

/* Responsive */
@media (max-width: 480px) {
	.cs39-upload-methods {
		flex-direction: column;
	}

	.cs39-upload-divider {
		display: none;
	}

	.cs39-certificate-info {
		flex-direction: column;
		text-align: center;
	}

	.cs39-certificate-preview {
		margin: 0 auto;
	}
}
