/* Input validation override */
.toolInput:invalid,
.toolInput:valid {
    border-color: #ced4da !important;
    box-shadow: none !important;
}

.toolInput:focus {
    border-color: #80bdff !important;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25) !important;
}

/* Signature Pad */
.signature-pad-container {
    border: 2px dashed var(--bs-border-color);
    border-radius: 0.375rem;
    background-color: var(--bs-body-bg);
    overflow: hidden;
}

.signature-pad {
    width: 100%;
    height: 200px;
    cursor: crosshair;
    touch-action: none;
}

[data-bs-theme="dark"] .signature-pad-container {
    background-color: #1a1a1a;
}

[data-bs-theme="dark"] .signature-pad {
    background-color: #1a1a1a;
}

/* Upload Signature Zone */
.upload-signature-zone {
    border: 2px dashed var(--bs-border-color);
    border-radius: 0.375rem;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: var(--bs-body-bg);
}

.upload-signature-zone:hover {
    border-color: var(--bs-primary);
    background-color: rgba(var(--bs-primary-rgb), 0.05);
}

.uploaded-signature-preview {
    position: relative;
    display: inline-block;
    border: 2px solid var(--bs-border-color);
    border-radius: 0.375rem;
    padding: 1rem;
    background-color: var(--bs-body-bg);
}

.uploaded-signature-preview img {
    max-width: 300px;
    max-height: 150px;
    object-fit: contain;
}

.uploaded-signature-preview button {
    position: absolute;
    top: -10px;
    right: -10px;
}

/* Type Signature Preview */
.type-signature-preview {
    border: 2px solid var(--bs-border-color);
    border-radius: 0.375rem;
    padding: 1.5rem;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bs-body-bg);
}

.type-signature-preview span {
    font-size: 2.5rem;
    color: #1a1a1a;
}

[data-bs-theme="dark"] .type-signature-preview span {
    color: #f0f0f0;
}

/* Saved Signatures */
.saved-signatures-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.375rem;
    min-height: 60px;
    background-color: var(--bs-body-bg);
}

.saved-signature-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.375rem;
    background-color: var(--bs-body-bg);
    transition: all 0.2s ease;
}

.saved-signature-item:hover {
    border-color: var(--bs-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.saved-signature-item img {
    max-width: 100px;
    max-height: 50px;
    object-fit: contain;
    margin-bottom: 0.5rem;
}

.saved-signature-item .btn-group {
    display: flex;
    gap: 0.25rem;
}

/* PDF Canvas Wrapper */
.pdf-canvas-wrapper {
    position: relative;
    border: 2px solid var(--bs-border-color);
    border-radius: 0.375rem;
    overflow: hidden;
    background-color: #525659;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 500px;
    max-height: 700px;
    overflow-y: auto;
}

.pdf-canvas-wrapper canvas {
    display: block;
    max-width: 100%;
}

/* Signature Overlay */
.signature-overlay {
    position: absolute;
    cursor: move;
    border: 2px dashed #28a745;
    border-radius: 4px;
    padding: 4px;
    background-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 10;
    user-select: none;
}

.signature-overlay img {
    max-width: 200px;
    max-height: 100px;
    display: block;
    pointer-events: none;
}

.signature-overlay.size-small img {
    max-width: 120px;
    max-height: 60px;
}

.signature-overlay.size-medium img {
    max-width: 200px;
    max-height: 100px;
}

.signature-overlay.size-large img {
    max-width: 280px;
    max-height: 140px;
}

/* PDF Preview */
.pdf-preview-wrapper {
    width: 100%;
    height: 600px;
    border: 2px solid var(--bs-border-color);
    border-radius: 0.375rem;
    overflow: hidden;
    background-color: #525659;
}

.pdf-preview-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

[data-bs-theme="dark"] .pdf-preview-wrapper,
[data-bs-theme="dark"] .pdf-canvas-wrapper {
    border-color: rgba(255, 255, 255, 0.1);
    background-color: #2c2c2c;
}

/* Nav Tabs Custom */
#signatureMethodTabs .nav-link {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
}

#signatureMethodTabs .nav-link.active {
    font-weight: 500;
}

/* Card Header */
.card-header {
    display: flex;
    align-items: center;
    font-weight: 500;
}

/* Fullscreen Mode */
.viewer-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    z-index: 9999;
    background-color: var(--bs-body-bg);
    padding: 1rem;
    overflow-y: auto;
    border: none !important;
    border-radius: 0 !important;
}

.viewer-fullscreen canvas {
    max-width: none;
    max-height: none;
}

/* Button hover effects */
#downloadBtn:hover,
#previewResultBtn:hover {
    transform: translateY(-1px);
    box-shadow: 0 0.5rem 1rem rgba(25, 135, 84, 0.25);
}

/* Responsive */
@media (max-width: 768px) {
    .pdf-canvas-wrapper {
        min-height: 400px;
        max-height: 500px;
    }

    .pdf-preview-wrapper {
        height: 450px;
    }

    .signature-pad {
        height: 150px;
    }

    .type-signature-preview span {
        font-size: 1.8rem;
    }

    #signatureMethodTabs .nav-link {
        padding: 0.4rem 0.6rem;
        font-size: 0.9rem;
    }

    .signature-overlay.size-small img {
        max-width: 80px;
        max-height: 40px;
    }

    .signature-overlay.size-medium img {
        max-width: 120px;
        max-height: 60px;
    }

    .signature-overlay.size-large img {
        max-width: 180px;
        max-height: 90px;
    }
}

@media (max-width: 576px) {
    .saved-signature-item img {
        max-width: 70px;
        max-height: 35px;
    }
}
