@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@400;500;600&family=Dancing+Script&family=Pacifico&family=Satisfy&family=Shadows+Into+Light&display=swap');

/* Base Styles */
html .formcraft-css .fc-form .signature-cover.field-cover > span {
	font-weight: 700;
	display: block;
	margin-bottom: 10px;
}

html .formcraft-css .fc-form .signature-cover.field-cover > div {
	width: 100%;
}

/* Alignment options */
html .formcraft-css .fc-form .signature-cover.field-cover.align-left .signature-tabs,
html .formcraft-css .fc-form .signature-cover.field-cover.align-left .signature-footer {
	margin-left: 0;
	margin-right: auto;
	text-align: left;
}

html .formcraft-css .fc-form .signature-cover.field-cover.align-center .signature-tabs,
html .formcraft-css .fc-form .signature-cover.field-cover.align-center .signature-footer {
	margin-left: auto;
	margin-right: auto;
	text-align: center;
}

html .formcraft-css .fc-form .signature-cover.field-cover.align-right .signature-tabs,
html .formcraft-css .fc-form .signature-cover.field-cover.align-right .signature-footer {
	margin-left: auto;
	margin-right: 0;
	text-align: right;
}

/* Ensure the timestamp is properly aligned */
html .formcraft-css .fc-form .signature-cover.field-cover.align-center .signature-timestamp,
html .formcraft-css .fc-form .signature-cover.field-cover.align-right .signature-timestamp {
	justify-content: center;
}

html .formcraft-css .fc-form .signature-cover.field-cover.align-right .signature-timestamp {
	justify-content: flex-end;
}

/* Confirmation Banner for CSS Update */
.signature-css-confirm-banner {
  width: 100%;
  background: linear-gradient(90deg,#1976d2 0%,#42a5f5 100%);
  color: #fff;
  font-size: 18px;
  font-weight: bold;
  text-align: center;
  padding: 12px 0;
  border-radius: 10px 10px 0 0;
  margin-bottom: 18px;
  letter-spacing: 1px;
  box-shadow: 0 2px 8px rgba(44,62,80,0.10);
  z-index: 9999;
}

/* Modern UI Components */
.signature-tabs {
	width: 100%;
	background: #f9fafd;
	border: 1px solid #e3e8ee;
	border-radius: 10px;
	overflow: hidden;
	margin-bottom: 18px;
	box-shadow: 0 2px 8px rgba(44,62,80,0.06);
}

.tab-header {
	display: flex;
	background: #f5f8fa;
	border-bottom: 1px solid #e3e8ee;
	font-weight: 700;
	font-size: 15px;
}

.tab-item {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 13px 0;
	text-align: center;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.25s;
	border-right: 1px solid #e3e8ee;
	color: #3d4251;
	background: #f5f8fa;
}
.tab-item i {
	font-size: 18px;
	margin-right: 5px;
	color: #3498db;
}

.tab-item:last-child {
	border-right: none;
}

.tab-item.active {
	background: #fff;
	color: #1976d2;
	border-bottom: 3px solid #1976d2;
	box-shadow: 0 2px 8px rgba(44,62,80,0.04);
}

.tab-item:hover:not(.active) {
	background: #fafafa;
}

.tab-content {
	display: none;
	padding: 15px;
	background: #fff;
}

.tab-content.active {
	display: block;
}

/* Draw Tab */
.signature-toolbar {
    display: flex;
    margin-bottom: 16px;
    padding: 12px 18px;
    background: #f8fafc;
    border-radius: 8px;
    gap: 18px;
    box-shadow: 0 1px 4px rgba(44,62,80,0.03);
}

.signature-toolbar > div {
	margin-right: 15px;
	display: flex;
	align-items: center;
}

.signature-toolbar span {
	font-size: 13px;
	margin-right: 8px;
	color: #555;
}

.pen-color, .type-color {
	width: 32px;
	height: 32px;
	padding: 0;
	border: 2px solid #e3e8ee;
	border-radius: 6px;
	cursor: pointer;
	box-shadow: 0 1px 3px rgba(44,62,80,0.04);
	transition: border-color 0.2s;
}
.pen-color:focus, .type-color:focus {
	border-color: #1976d2;
	outline: none;
}

.pen-size {
	width: 120px;
	height: 6px;
	background: #e3e8ee;
	border-radius: 5px;
	outline: none;
	margin-left: 8px;
}

/* Signature pad base containers */
html .formcraft-css .fc-form .signature-pad-placeholder {
	width: 100% !important;
	min-height: 220px;
	background-color: #fff;
	border: 1.5px solid #e3e8ee;
	border-radius: 12px;
	position: relative;
	overflow: hidden;
	transition: border-color 0.3s ease;
	box-sizing: border-box;
	box-shadow: 0 2px 12px rgba(44,62,80,0.06);
}

.signature-type-container, 
.signature-upload-container {
	width: 100% !important;
	min-height: 180px;
	box-sizing: border-box;
}

/* Content alignment based on the field alignment */
html .formcraft-css .fc-form .signature-cover.field-cover.align-center .signature-tabs .tab-content,
html .formcraft-css .fc-form .signature-cover.field-cover.align-center .signature-type-preview,
html .formcraft-css .fc-form .signature-cover.field-cover.align-center .signature-type-input {
	margin-left: auto;
	margin-right: auto;
	text-align: center;
}

html .formcraft-css .fc-form .signature-cover.field-cover.align-right .signature-tabs .tab-content,
html .formcraft-css .fc-form .signature-cover.field-cover.align-right .signature-type-preview,
html .formcraft-css .fc-form .signature-cover.field-cover.align-right .signature-type-input {
	margin-left: auto;
	margin-right: 0;
	text-align: right;
}

html .formcraft-css.form-live .fc-form .signature-pad-placeholder canvas {
	width: 100% !important;
	height: 100% !important;
	box-sizing: border-box;
}

html .formcraft-css .fc-form .form-element-type-signature .pad-placeholder {
	display: none; /* Hide the placeholder text */
}

/* Add a signature line */
html .formcraft-css .fc-form .signature-pad-placeholder::after {
	content: '';
	position: absolute;
	left: 10%;
	right: 10%;
	bottom: 32px;
	height: 1.5px;
	background-color: #bbb;
}
.signature-pad-placeholder .clear-signature {
	position: absolute;
	top: 13px;
	right: 18px;
	z-index: 10;
	display: flex;
	align-items: center;
	gap: 4px;
	font-size: 15px;
	color: #1976d2;
	background: #f6fafd;
	border-radius: 6px;
	padding: 4px 10px;
	box-shadow: 0 1px 4px rgba(44,62,80,0.04);
	cursor: pointer;
	transition: background 0.2s, color 0.2s;
	border: 1px solid #e3e8ee;
}
.signature-pad-placeholder .clear-signature:hover {
	background: #e3e8ee;
	color: #0d47a1;
}

/* Type Tab */
.type-options {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	margin-bottom: 15px;
}

.type-options > div {
	margin-right: 15px;
	margin-bottom: 10px;
	flex: 1 1 auto;
	min-width: 150px;
}

.type-options span {
	display: block;
	margin-bottom: 5px;
	font-size: 14px;
}

.signature-font {
	width: 100%;
	padding: 5px;
	border: 1px solid #ddd;
	border-radius: 4px;
	font-size: 14px;
	background-color: white;
	text-overflow: ellipsis;
	overflow: hidden;
}

.signature-type-container {
	position: relative;
	width: 100%;
	height: 180px;
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 6px;
	overflow: hidden;
}

.signature-type-input {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	padding: 15px;
	border: none;
	outline: none;
	background: transparent;
	z-index: 10;
	font-size: 14px;
}

.signature-type-preview {
	position: absolute;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 36px;
	color: #333;
	padding: 20px;
	text-align: center;
	word-break: break-word;
}

/* Upload Tab */
.signature-upload-container {
	width: 100%;
	height: 180px;
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 6px;
	overflow: hidden;
}

.upload-zone {
	position: relative;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-direction: column;
	transition: all 0.3s ease;
}

.upload-zone.dragover {
	background-color: rgba(52, 152, 219, 0.1);
	border: 2px dashed #3498db;
}

.signature-file-input {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	opacity: 0;
	cursor: pointer;
	z-index: 10;
}

.upload-placeholder {
	text-align: center;
	color: #777;
	font-size: 14px;
	line-height: 1.5;
	padding: 15px;
	display: flex;
	flex-direction: column;
	align-items: center;
	width: 100%;
}

.upload-btn {
	background: #4488ee;
	color: white;
	padding: 8px 15px;
	border-radius: 4px;
	margin-top: 10px;
	font-weight: 500;
	display: inline-block;
	cursor: pointer;
	transition: background-color 0.3s;
	box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.upload-btn:hover {
	background: #3377dd;
}

.upload-preview {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-size: contain;
	background-position: center;
	background-repeat: no-repeat;
	display: none;
}

.clear-upload {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.8);
    color: #e74c3c;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.clear-upload:hover {
    background: #e74c3c;
    color: white;
}

/* Signature Footer */
.signature-footer {
	display: flex;
	gap: 18px;
	margin-top: 20px;
	justify-content: flex-start;
	align-items: stretch;
	flex-wrap: wrap;
}
.signature-footer .footer-card {
	background: #fff;
	border: 1.5px solid #e3e8ee;
	border-radius: 10px;
	padding: 13px 18px;
	box-shadow: 0 2px 8px rgba(44,62,80,0.05);
	min-width: 240px;
	display: flex;
	flex-direction: column;
	gap: 4px;
	font-size: 14px;
}
.signature-footer .footer-card .footer-label {
	font-weight: 700;
	color: #3d4251;
	margin-bottom: 2px;
}
.signature-footer .footer-card .footer-hash {
	font-family: monospace;
	font-size: 15px;
	font-weight: 600;
	color: #1976d2;
}
.signature-footer .footer-card .footer-badge {
	display: inline-block;
	background: #1976d2;
	color: #fff;
	border-radius: 6px;
	padding: 3px 10px;
	font-size: 13px;
	font-weight: 600;
	margin-top: 7px;
	box-shadow: 0 1px 3px rgba(44,62,80,0.10);
}

.signature-timestamp {
	font-size: 12px;
	color: #444;
	flex: 1;
}

/* ICP-Brasil-compliant timestamp */
.icp-timestamp {
	background: #f7fafd;
	border: 1.5px solid #e3e8ee;
	border-radius: 8px;
	padding: 10px 15px;
	margin-top: 8px;
	font-size: 13px;
	color: #444;
	line-height: 1.5;
	box-shadow: 0 1px 4px rgba(44,62,80,0.04);
}

.icp-timestamp .local-time {
	font-weight: bold;
	color: #333;
}

.icp-timestamp .utc-time {
	color: #666;
	font-size: 11px;
}

.icp-timestamp .verification-code {
	margin-top: 5px;
	padding-top: 5px;
	border-top: 1px dotted #ddd;
	color: #2980b9;
	font-family: monospace;
	font-weight: bold;
}

/* Verification Seal */
.signature-verification-seal {
	display: inline-flex;
	align-items: center;
	background: #e8f4fe;
	border: 1px solid #c5e0f5;
	border-radius: 4px;
	padding: 4px 8px;
	margin-left: 10px;
	color: #2980b9;
	font-size: 11px;
	font-weight: bold;
}

.signature-verification-seal i {
	margin-right: 5px;
	color: #3498db;
}

html .formcraft-css .fc-form .signature-cover.field-cover .clear-signature {
	font-weight: normal;
	cursor: pointer;
	opacity: .85;
	display: block;
	text-align: center;
	padding: 5px 10px;
	background: #f1f1f1;
	border-radius: 4px;
	font-size: 13px;
	transition: all 0.3s ease;
}

html .formcraft-css.form-live .fc-form .clear-signature:hover {
	opacity: 1;
	background: #e9e9e9;
}

html .formcraft-css .fc-form .form-element-type-signature.error-field .signature-pad-placeholder,
html .formcraft-css .fc-form .form-element-type-signature.error-field .signature-type-container,
html .formcraft-css .fc-form .form-element-type-signature.error-field .signature-upload-container {
	border: 1px solid rgba(255,0,0,.6);
}

.validation-error {
    position: absolute;
    bottom: 10px;
    left: 0;
    right: 0;
    text-align: center;
    color: #f03;
    font-size: 13px;
    background: rgba(255, 255, 255, 0.9);
    padding: 3px 5px;
    z-index: 999;
    border-radius: 3px;
}

.upload-placeholder.error {
	color: #e74c3c;
	background-color: rgba(231, 76, 60, 0.05);
	border-radius: 4px;
	padding: 10px;
}

.upload-placeholder.error .upload-btn {
	background: #e74c3c;
	margin-top: 10px;
}

.upload-placeholder.error .upload-btn:hover {
	background: #c0392b;
}

/* Handwritten Fonts */
.signature-font-signature-font {
	font-family: 'Pacifico', cursive;
}

.signature-font-handwritten-1 {
	font-family: 'Dancing Script', cursive;
}

.signature-font-handwritten-2 {
	font-family: 'Satisfy', cursive;
}

.signature-font-handwritten-3 {
	font-family: 'Caveat', cursive;
}

.signature-font-handwritten-4 {
	font-family: 'Shadows Into Light', cursive;
}

/* Responsive Styling */
@media (max-width: 768px) {
	.signature-toolbar > div,
	.type-options > div {
		margin-bottom: 10px;
	}
	
	.tab-item {
		padding: 10px 5px;
		font-size: 12px;
	}
	
	.signature-type-preview {
		font-size: 28px;
	}
	
	html .formcraft-css .fc-form .signature-pad-placeholder,
	.signature-type-container,
	.signature-upload-container {
		min-height: 150px;
	}
	
	.type-options > div {
		min-width: 120px;
	}
	
	.signature-font {
		font-size: 13px;
	}
}

@media (max-width: 480px) {
	.signature-toolbar {
		flex-direction: column;
		align-items: flex-start;
	}
	
	.signature-toolbar > div {
		margin-right: 0;
		margin-bottom: 8px;
		width: 100%;
	}
	
	.type-options {
		flex-direction: column;
		align-items: flex-start;
	}
	
	.type-options > div {
		width: 100%;
		margin-right: 0;
	}
	
	.tab-item {
		padding: 8px 5px;
		font-size: 11px;
	}
	
	html .formcraft-css .fc-form .signature-pad-placeholder,
	.signature-type-container,
	.signature-upload-container {
		min-height: 120px;
	}
	
	.signature-type-preview {
		font-size: 22px;
	}
}

/* Focus and accessibility */
.signature-canvas:focus,
.signature-type-input:focus,
.signature-file-input:focus + .upload-placeholder {
	outline: 2px solid #3498db;
}

/* Animation for transitions */
.tab-content {
	transition: opacity 0.3s ease;
	opacity: 0;
}

.tab-content.active {
	opacity: 1;
}

/* Admin panel section headers */
.section-header {
    font-weight: bold;
    margin: 15px 0 5px;
    padding-bottom: 5px;
    border-bottom: 1px solid #eee;
    color: #3498db;
    width: 100%;
    clear: both;
    float: left;
}

/* Textarea for multiline placeholders */
.formcraft-css .fc-form .form-element .field-cover textarea {
    min-height: 60px;
    width: 100%;
}

/* Improve spacing in admin options */
.formcraft-css .fc-form .form-element .field-cover > label {
    margin-bottom: 8px;
}

/* Highlight enabled/disabled methods */
.formcraft-css .fc-form .form-element .field-cover > label input[type="checkbox"]:checked + span {
    font-weight: bold;
    color: #3498db;
}

/* Styling for the customization sections */
.formcraft-css .fc-form .form-element .field-cover .section-header + label {
    margin-top: 8px;
}

/* Improve input fields in customization sections */
.formcraft-css .fc-form .form-element .field-cover .section-header ~ label input[type="text"] {
    border-left: 2px solid #3498db;
}

/* Style for disabled methods */
.signature-tabs[data-enable-draw="false"] .tab-item[data-method="draw"],
.signature-tabs[data-enable-type="false"] .tab-item[data-method="type"],
.signature-tabs[data-enable-upload="false"] .tab-item[data-method="upload"] {
    display: none;
}

/* Adjust tab widths when methods are disabled */
.signature-tabs[data-enable-draw="false"][data-enable-type="true"][data-enable-upload="true"] .tab-item,
.signature-tabs[data-enable-draw="true"][data-enable-type="false"][data-enable-upload="true"] .tab-item,
.signature-tabs[data-enable-draw="true"][data-enable-type="true"][data-enable-upload="false"] .tab-item {
    flex: 1 1 50%;
}

.signature-tabs[data-enable-draw="true"][data-enable-type="false"][data-enable-upload="false"] .tab-item,
.signature-tabs[data-enable-draw="false"][data-enable-type="true"][data-enable-upload="false"] .tab-item,
.signature-tabs[data-enable-draw="false"][data-enable-type="false"][data-enable-upload="true"] .tab-item {
    flex: 1 1 100%;
}

/* Admin panel organization */
.formcraft-css .fc-form .form-element .field-cover .section-header {
    margin-top: 20px;
}

/* First section header doesn't need extra margin */
.formcraft-css .fc-form .form-element .field-cover .section-header:first-of-type {
    margin-top: 10px;
}

/* Better visual hierarchy for customization options */
.formcraft-css .fc-form .form-element .field-cover .section-header ~ label span:first-child {
    font-weight: 500;
    color: #555;
}

/* Improve textarea appearance */
.formcraft-css .fc-form .form-element .field-cover textarea {
    font-family: inherit;
    padding: 8px;
    line-height: 1.4;
    resize: vertical;
}

/* Responsive adjustments for admin panel */
@media (max-width: 768px) {
    .formcraft-css .fc-form .form-element .field-cover .section-header {
        font-size: 14px;
    }
}

/* Ensure tabs are properly displayed on frontend */
html .formcraft-css.form-live .fc-form .signature-tabs {
    width: 100%;
    display: block;
}

html .formcraft-css.form-live .fc-form .signature-tabs .tab-header {
    display: flex;
}

html .formcraft-css.form-live .fc-form .signature-tabs .tab-item {
    display: block;
}

/* If only one tab is available, make the tab header invisible but keep the content visible */
html .formcraft-css.form-live .fc-form .signature-tabs .tab-header:only-child {
    display: none;
}

/* Improve select dropdown display on small screens */
.signature-font option {
	font-size: 14px;
	white-space: normal;
	word-wrap: break-word;
}

@media (max-width: 480px) {
	.signature-font {
		max-width: 100%;
		font-size: 12px;
	}
	
	.signature-font option {
		font-size: 12px;
	}
}

/* Admin interface styles for font options */
.formcraft-css .fc-form .form-element .field-cover .section-header ~ select.signature-font {
	width: 100%;
	max-width: 100%;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.formcraft-css .fc-form .form-element .field-cover .section-header ~ label select option {
	white-space: normal;
}

/* Debug: add red border to signature component */
html .formcraft-css .fc-form .form-element-type-signature {
    border: 3px solid red !important;
}
