/* Velocity Signatures - Custom Styles */

:root {
    --vs-primary: #1a56db;
    --vs-primary-dark: #1447b3;
    --vs-success: #059669;
    --vs-warning: #d97706;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #f8f9fa;
}

main {
    flex: 1;
}

/* Auth pages */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a56db 0%, #7c3aed 100%);
}

.auth-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    padding: 40px;
    width: 100%;
    max-width: 440px;
}

.auth-card .brand {
    text-align: center;
    margin-bottom: 30px;
}

.auth-card .brand h1 {
    color: var(--vs-primary);
    font-weight: 700;
    font-size: 1.8rem;
}

.auth-card .brand p {
    color: #6b7280;
    margin-top: 5px;
}

/* Dashboard cards */
.stat-card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.stat-card .stat-label {
    color: #6b7280;
    font-size: 0.875rem;
}

/* Document cards */
.doc-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    transition: border-color 0.2s;
}

.doc-card:hover {
    border-color: var(--vs-primary);
}

/* Signature pad */
.signature-wrapper {
    position: relative;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

.signature-wrapper.signing {
    border-color: var(--vs-primary);
    border-style: solid;
}

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

.signature-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #9ca3af;
    pointer-events: none;
    text-align: center;
}

.signature-wrapper.signing .signature-placeholder {
    display: none;
}

/* Workflow builder */
.workflow-step {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    background: #fff;
    display: flex;
    align-items: center;
    gap: 12px;
}

.workflow-step .step-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--vs-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
}

.workflow-step .step-info {
    flex: 1;
}

.workflow-step .drag-handle {
    cursor: grab;
    color: #9ca3af;
    padding: 4px;
}

.workflow-step .drag-handle:active {
    cursor: grabbing;
}

/* Progress tracker */
.signing-progress {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 20px 0;
}

.signing-progress .step {
    flex: 1;
    text-align: center;
    position: relative;
}

.signing-progress .step-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e5e7eb;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
}

.signing-progress .step.completed .step-dot {
    background: var(--vs-success);
    color: white;
}

.signing-progress .step.active .step-dot {
    background: var(--vs-primary);
    color: white;
    box-shadow: 0 0 0 4px rgba(26, 86, 219, 0.2);
}

.signing-progress .step.declined .step-dot {
    background: #dc3545;
    color: white;
}

.signing-progress .step-label {
    font-size: 0.7rem;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.signing-progress .step-connector {
    flex: 0 0 20px;
    height: 2px;
    background: #e5e7eb;
    align-self: flex-start;
    margin-top: 15px;
}

.signing-progress .step.completed + .step-connector {
    background: var(--vs-success);
}

/* Table improvements */
.table-action-btns .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

/* Sign page */
.sign-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.sign-page .document-info,
.document-info {
    background: #f0f9ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.pdf-viewer {
    width: 100%;
    height: 600px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 20px;
}

/* Floating sign bar */
.sign-floating-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 2px solid var(--vs-primary);
    padding: 12px 0;
    z-index: 1000;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.1);
}

/* OAuth button */
.btn-google {
    background: #fff;
    border: 1px solid #dadce0;
    color: #3c4043;
    font-weight: 500;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: background-color 0.2s;
}

.btn-google:hover {
    background: #f8f9fa;
    border-color: #c6c9cc;
}

.btn-google img {
    width: 20px;
    height: 20px;
}

/* Empty states */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h5 {
    margin-bottom: 8px;
    color: #374151;
}

/* Audit log details */
.audit-details {
    font-family: monospace;
    font-size: 0.8rem;
    background: #f9fafb;
    padding: 8px;
    border-radius: 4px;
    max-height: 100px;
    overflow-y: auto;
}

/* PDF.js Container */
#pdfContainer {
    background: #525659;
    padding: 10px;
    min-height: 60vh;
    overflow-x: hidden;
    padding-bottom: 80px;
}

.pdf-page-wrapper {
    margin: 0 auto 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    background: white;
    cursor: crosshair;
}

.pdf-page-canvas {
    display: block;
}

.pdf-page-label {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0,0,0,0.6);
    color: white;
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    z-index: 5;
    pointer-events: none;
}

/* Signature Overlay on PDF */
#signatureOverlay {
    position: absolute;
    z-index: 10;
    cursor: grab;
    border: 2px dashed var(--vs-primary);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 2px 8px rgba(26, 86, 219, 0.3);
    touch-action: none;
    user-select: none;
}

#signatureOverlay.dragging {
    cursor: grabbing;
    opacity: 0.75;
    border-style: solid;
}

#signatureOverlay img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    display: block;
}

.sig-overlay-controls {
    position: absolute;
    top: -12px;
    right: -12px;
}

.sig-remove-btn {
    width: 24px;
    height: 24px;
    padding: 0 !important;
    border-radius: 50% !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.sig-resize-handle {
    position: absolute;
    bottom: -4px;
    right: -4px;
    width: 14px;
    height: 14px;
    background: var(--vs-primary);
    border: 2px solid white;
    border-radius: 2px;
    cursor: nwse-resize;
    touch-action: none;
}

/* Step indicators */
.step-indicator {
    display: flex;
    align-items: center;
    opacity: 0.5;
    transition: opacity 0.3s;
}

.step-indicator.active,
.step-indicator:has(.bg-primary) {
    opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .auth-card {
        margin: 20px;
        padding: 24px;
    }

    .stat-card .stat-value {
        font-size: 1.5rem;
    }

    .pdf-viewer {
        height: 400px;
    }
}
