/* Sign PDF Tool */
.tool-breadcrumb { background: var(--gray-100); padding: 12px 0; }
.tool-breadcrumb .breadcrumb { margin: 0; font-size: 0.85rem; }
.tool-breadcrumb .breadcrumb-item a { color: var(--primary); }
.tool-header { padding: 50px 0 40px; background: linear-gradient(135deg, #d6eaf8, #aed6f1); }
.tool-icon-large { width: 80px; height: 80px; border-radius: 20px; background: linear-gradient(135deg, #3498db, #2980b9); display: inline-flex; align-items: center; justify-content: center; color: white; font-size: 2rem; margin-bottom: 20px; box-shadow: 0 8px 25px rgba(52,152,219,0.3); }
.tool-header h1 { font-size: 2rem; font-weight: 800; margin-bottom: 12px; }
.tool-desc { font-size: 1.05rem; color: var(--gray-600); max-width: 700px; margin: 0 auto; line-height: 1.7; }
.tool-workspace { padding: 40px 0 60px; }
.workspace-card { background: white; border-radius: 16px; box-shadow: 0 4px 20px rgba(0,0,0,0.08); padding: 40px; max-width: 900px; margin: 0 auto; }

.upload-zone { border: 3px dashed var(--gray-300); border-radius: 16px; padding: 60px 30px; text-align: center; cursor: pointer; background: var(--gray-100); transition: all 0.3s; }
.upload-zone:hover, .upload-zone.dragover { border-color: #3498db; background: rgba(52,152,219,0.03); }
.upload-icon { font-size: 3.5rem; color: var(--gray-400); margin-bottom: 16px; }
.upload-zone:hover .upload-icon { color: #3498db; }
.upload-zone h3 { font-size: 1.2rem; font-weight: 700; margin-bottom: 8px; }
.upload-zone p { color: var(--gray-500); margin-bottom: 16px; }
.btn-upload { background: #3498db; color: white; padding: 12px 28px; border-radius: 30px; font-weight: 600; cursor: pointer; }
.btn-upload:hover { background: #2980b9; color: white; }

.opt-file-bar { display: flex; align-items: center; gap: 14px; padding: 14px 18px; background: var(--gray-100); border-radius: 12px; margin-bottom: 20px; }
.opt-file-bar > i { font-size: 1.5rem; color: #e74c3c; }
.opt-file-bar strong { display: block; font-size: 0.9rem; }
.opt-file-bar span { font-size: 0.78rem; color: var(--gray-500); }
.opt-file-bar div { flex: 1; }

.section-title { font-size: 1.05rem; font-weight: 700; margin-bottom: 14px; }

/* Mode cards */
.mode-cards { display: flex; gap: 14px; flex-wrap: wrap; }
.mode-card { flex: 1; min-width: 220px; display: flex; gap: 14px; padding: 18px; border: 2px solid var(--gray-200); border-radius: 14px; cursor: pointer; transition: all 0.2s; background: white; align-items: flex-start; }
.mode-card:hover { border-color: var(--gray-400); }
.mode-card.active { border-color: #3498db; background: rgba(52,152,219,0.03); box-shadow: 0 0 0 1px #3498db; }
.mc-icon { width: 44px; height: 44px; border-radius: 10px; background: var(--gray-100); display: flex; align-items: center; justify-content: center; font-size: 1.1rem; color: var(--gray-500); flex-shrink: 0; }
.mode-card.active .mc-icon { background: #3498db; color: white; }
.mc-body { flex: 1; }
.mc-body strong { display: block; font-size: 0.95rem; margin-bottom: 4px; }
.mc-body p { font-size: 0.8rem; color: var(--gray-600); margin: 0; }

/* Signer list */
.signer-list { display: flex; flex-direction: column; gap: 8px; }
.signer-row { display: flex; gap: 8px; align-items: center; }
.signer-row .form-control { border-radius: 8px; }
.signer-row .signer-name { flex: 1; }
.signer-row .signer-email { flex: 1.5; }

/* Signature tabs */
.sig-tabs { display: flex; gap: 0; margin-bottom: 16px; border: 2px solid var(--gray-200); border-radius: 12px; overflow: hidden; }
.sig-tab { flex: 1; padding: 12px; text-align: center; background: white; border: none; font-weight: 600; font-size: 0.85rem; color: var(--gray-600); cursor: pointer; transition: all 0.2s; }
.sig-tab:not(:last-child) { border-right: 2px solid var(--gray-200); }
.sig-tab.active { background: #3498db; color: white; }
.sig-panel { display: none; } .sig-panel.active { display: block; }

/* Canvas - vẽ chữ ký */
#sigCanvas { width: 350px; max-width: 100%; height: 150px; border: 2px solid var(--gray-300); border-radius: 10px; cursor: crosshair; background: white; touch-action: none; display: block; margin: 0 auto; }
.canvas-actions { margin-top: 8px; }

/* Stamp upload */
.stamp-upload { text-align: center; padding: 16px; border: 2px dashed var(--gray-200); border-radius: 10px; }
.stamp-upload img { max-height: 60px; border-radius: 6px; margin-bottom: 8px; }

/* Type signature */
.sig-type-input { font-size: 1.2rem; font-style: italic; padding: 12px 14px; border-radius: 10px; }
.type-preview { margin-top: 8px; padding: 12px 14px; background: var(--gray-100); border-radius: 8px; font-size: 1.2rem; font-style: italic; color: #2c3e50; min-height: 40px; }

/* Placement */
.sig-placement { margin-top: 20px; padding-top: 16px; border-top: 2px solid var(--gray-200); }
.placement-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.sig-name-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Place signature on document */
.place-hint { font-size: 0.85rem; color: #3498db; font-weight: 600; background: rgba(52,152,219,0.06); padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; }
.place-nav { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 14px; font-size: 0.9rem; }
.place-nav strong { color: #3498db; }

.place-canvas-wrapper { display: flex; justify-content: center; margin-bottom: 16px; overflow: auto; }
.place-canvas {
    position: relative; display: inline-block; border: 2px solid var(--gray-300); border-radius: 8px;
    overflow: hidden; background: #e8e8e8; user-select: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    width: 100%;
}
.place-canvas img {
    display: block; width: 100%; height: auto; pointer-events: none;
    /* Force minimum height so page is large enough */
    min-height: 500px;
    object-fit: contain;
    background: white;
}

.sig-draggable {
    position: absolute; cursor: grab; z-index: 10;
    border: 1px dashed #3498db; border-radius: 2px;
    background: rgba(255,255,255,0.8);
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    left: 10%; bottom: 10%;
    overflow: hidden;
}
.sig-draggable:hover { box-shadow: 0 2px 8px rgba(52,152,219,0.3); border-color: #2980b9; }
.sig-content { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; cursor: grab; }
.sig-content:active { cursor: grabbing; }
.sig-content img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; display: block; }

/* Resize handles */
.sig-handle { position: absolute; z-index: 20; }
.sig-handle-se { bottom: 0; right: 0; width: 12px; height: 12px; cursor: se-resize; background: #3498db; border-radius: 2px 0; opacity: 0.7; }
.sig-handle-se:hover { opacity: 1; }
.sig-handle-e { top: 0; right: 0; width: 6px; height: 100%; cursor: e-resize; }
.sig-handle-s { bottom: 0; left: 0; width: 100%; height: 6px; cursor: s-resize; }

/* Invite result */
.invite-result { padding: 20px; }
.invite-icon { font-size: 3.5rem; color: #3498db; margin-bottom: 16px; }
.invite-links { margin: 20px 0; text-align: left; }
.invite-link-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--gray-100); border-radius: 10px; margin-bottom: 8px; }
.invite-link-item .il-info { flex: 1; }
.invite-link-item .il-name { font-weight: 700; font-size: 0.9rem; }
.invite-link-item .il-email { font-size: 0.78rem; color: var(--gray-500); }
.invite-link-item .il-link { font-size: 0.72rem; color: #3498db; word-break: break-all; }
.invite-link-item .btn-copy { font-size: 0.75rem; white-space: nowrap; }
.invite-info { margin-top: 16px; font-size: 0.88rem; color: var(--gray-600); }
.invite-info strong { color: #3498db; }

.btn-convert { background: linear-gradient(135deg, #3498db, #2980b9); color: white; padding: 16px 48px; border-radius: 30px; font-weight: 700; font-size: 1.05rem; border: none; box-shadow: 0 4px 20px rgba(52,152,219,0.35); transition: all 0.3s; }
.btn-convert:hover { transform: translateY(-2px); color: white; }

.download-area { padding: 40px 20px; }
.download-icon { font-size: 4rem; color: #2ecc71; margin-bottom: 20px; }
.download-area h3 { font-size: 1.4rem; font-weight: 700; margin-bottom: 8px; }
.download-area > p { color: var(--gray-600); margin-bottom: 24px; }
.btn-download { background: linear-gradient(135deg, #2ecc71, #27ae60); color: white; padding: 16px 40px; border-radius: 30px; font-weight: 700; display: inline-flex; align-items: center; box-shadow: 0 4px 20px rgba(46,204,113,0.35); }
.btn-download:hover { color: white; transform: translateY(-2px); }
.download-info { margin-top: 24px; }
.countdown-wrapper { font-size: 0.95rem; margin-bottom: 8px; }
.countdown-wrapper strong { color: var(--primary); font-size: 1.1rem; font-family: monospace; }
.error-area { padding: 40px 20px; }
.error-icon { font-size: 4rem; color: var(--primary); margin-bottom: 20px; }

@media (max-width: 767.98px) { .workspace-card { padding: 24px 16px; } .upload-zone { padding: 40px 20px; } .btn-convert { width: 100%; } .tool-header h1 { font-size: 1.5rem; } .mode-cards { flex-direction: column; } }
