/**
 * CF7 Custom Signature Field - Styles
 * Base styling for signature canvas, typed input, and mode tabs
 */

/* Signature field wrapper */
.signature-field-wrapper {
    margin: 15px 0;
}

/* Mode tabs */
.signature-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
    max-width: 600px;
    width: 100%;
}

.signature-tab {
    flex: 1;
    padding: 10px 20px;
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    border-bottom: 3px solid transparent !important;
    border-radius: 0 !important;
    cursor: pointer;
    font-size: 14px;
    color: #666 !important;
    text-transform: lowercase;
    transition: all 0.2s ease;
    position: relative;
    bottom: -2px;
    box-shadow: none !important;
    outline: none !important;
}

.signature-tab:hover {
    color: #333 !important;
    background-color: #f5f5f5 !important;
    border-bottom-color: transparent !important;
    box-shadow: none !important;
}

.signature-tab:focus {
    background-color: transparent !important;
    border-bottom-color: transparent !important;
    box-shadow: none !important;
    outline: none !important;
}

.signature-tab--active {
    color: #7b3fa8 !important;
    border-bottom-color: #7b3fa8 !important;
    font-weight: 500;
    background-color: transparent !important;
    box-shadow: none !important;
}

.signature-tab--active:hover {
    color: #7b3fa8 !important;
    background-color: #f9f4fc !important;
    border-bottom-color: #7b3fa8 !important;
    box-shadow: none !important;
}

.signature-tab--active:focus {
    color: #7b3fa8 !important;
    background-color: transparent !important;
    border-bottom-color: #7b3fa8 !important;
    box-shadow: none !important;
    outline: none !important;
}

/* Mode containers */
.signature-mode {
    display: none;
}

.signature-mode--active {
    display: block;
}

/* Signature canvas */
.signature-canvas {
    display: block;
    width: auto !important; /* Force natural width */
    height: auto !important; /* Force natural height */
    max-width: 100%;
    border: 2px solid #ccc;
    border-radius: 4px;
    cursor: crosshair;
    background-color: #f9f9f9 !important;
    touch-action: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    box-sizing: content-box; /* Don't include border in size calculation */
}

.signature-canvas:hover {
    border-color: #999;
    background-color: #ffffff !important;
}

.signature-canvas:focus {
    outline: none;
    border-color: #7b3fa8;
    box-shadow: 0 0 0 0.2rem rgba(123, 63, 168, 0.25);
}

/* Typed signature input */
.signature-text-input {
    display: block;
    max-width: 600px;
    width: 100%;
    padding: 20px 15px;
    border: 2px solid #ccc;
    border-radius: 4px;
    font-family: 'Brush Script MT', cursive, 'Dancing Script', 'Pacifico', sans-serif;
    font-size: 32px;
    background-color: #f9f9f9;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.signature-text-input:hover {
    border-color: #999;
    background-color: #ffffff;
}

.signature-text-input:focus {
    outline: none;
    border-color: #7b3fa8;
    box-shadow: 0 0 0 0.2rem rgba(123, 63, 168, 0.25);
    background-color: #ffffff;
}

.signature-text-input::placeholder {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    color: #999;
}

/* Clear buttons - FULL WIDTH */
.signature-clear-btn {
    display: block;
    max-width: 600px;
    width: 100%;
    margin-top: 10px;
    padding: 10px 16px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    color: #495057;
    transition: all 0.2s ease;
    text-align: center;
}

.signature-clear-btn:hover {
    background-color: #e2e6ea;
    border-color: #dae0e5;
}

.signature-clear-btn:active {
    background-color: #dae0e5;
    border-color: #d3d9df;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.signature-clear-btn:focus {
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(123, 63, 168, 0.25);
}

/* Validation error styling */
.wpcf7-not-valid .signature-canvas,
.wpcf7-not-valid .signature-text-input {
    border-color: #dc3545;
}

.wpcf7-not-valid-tip {
    display: block;
    margin-top: 5px;
    color: #dc3545;
    font-size: 13px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .signature-canvas {
        width: 100%;
    }
    
    .signature-text-input {
        font-size: 24px;
    }
}
