/* Sign PDF Tool Specific Styles */

/* Sign PDF Page Specific Styles */

.sign-pdf-section {
    padding: 40px 0;
    min-height: 350px;
    background: white;
}

.main-body .sign-pdf-section {
    padding-top: 16px;
}


/* Upload State */
.upload-state {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100px;
}

.upload-box {
    background: linear-gradient(135deg, #667eea 0%, #2563eb 100%);
    border-radius: 20px;
    padding: 20px 20px;
    text-align: center;
    color: white;
    width: 800px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-box:hover {
    transform: translateY(-5px);
    border-color: #e0e7ff;
}

.upload-box.drag-over {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    border-color: #fbbf24;
    transform: scale(1.02);
}

.upload-icon {
    margin-bottom: 30px;
    opacity: 0.9;
}

.upload-icon svg {
    width: 80px;
    height: 80px;
    stroke: white;
}

.upload-box h2 {
    font-size: 32px;
    margin-bottom: 15px;
    font-weight: 600;
}

.upload-box p {
    font-size: 18px;
    margin-bottom: 30px;
    opacity: 0.9;
}

.upload-btn {
    background: white;
    color: #667eea;
    padding: 15px 40px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 20px;
}

.upload-btn:hover {
    background: #f1f5f9;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(255, 255, 255, 0.2);
}

.upload-subtext {
    font-size: 16px;
    opacity: 0.8;
    margin: 0;
}

/* Editor State */
.editor-state {
    background: #f8fafc;
    border-radius: 12px;
    overflow: hidden;
}

/* Toolbar */
.pdf-toolbar {
    background: white;
    border-bottom: 1px solid #e2e8f0;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.toolbar-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #475569;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toolbar-btn:hover {
    background: #e2e8f0;
    color: #1e293b;
    transform: translateY(-1px);
}

.toolbar-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.toolbar-btn.btn-primary {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

.toolbar-btn.btn-primary:hover:not(:disabled) {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

.toolbar-btn svg {
    width: 20px;
    height: 20px;
}

.toolbar-spacer {
    flex: 1;
}

/* PDF Editor */
.pdf-editor {
    background: #f1f5f9;
    padding: 20px;
    min-height: 600px;
    overflow: auto;
}

.pdf-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.pdf-page {
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    margin-bottom: 20px;
}

.pdf-page canvas {
    display: block;
    width: 100%;
    height: auto;
}

/* PDF Elements (Text, Signatures, Dates) */
.pdf-element {
    position: absolute;
    cursor: move;
    user-select: none;
    border: 2px solid transparent;
    transition: border-color 0.2s ease;
}

.pdf-element:hover {
    border-color: #2563eb;
}

.pdf-element.selected {
    border-color: #2563eb;
    box-shadow: 0 0 0 1px #2563eb;
}

.pdf-element.text {
    padding: 5px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 4px;
}

.pdf-element.signature {
    background: transparent;
}

.pdf-element.date {
    padding: 5px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 4px;
    font-weight: 500;
}

/* Resize Handles */
.resize-handle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #2563eb;
    border: 1px solid white;
    border-radius: 50%;
    cursor: se-resize;
    bottom: -4px;
    right: -4px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.pdf-element:hover .resize-handle,
.pdf-element.selected .resize-handle {
    opacity: 1;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.modal-content h3 {
    margin-bottom: 20px;
    color: #1e293b;
    font-size: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #374151;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group input[type="range"] {
    padding: 0;
}

.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* Signature Canvas */
.signature-canvas-container {
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 20px;
    background: white;
    position: relative;
}

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

/* Range Input Styling */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-track {
    background: #e2e8f0;
    height: 6px;
    border-radius: 3px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    background: #2563eb;
    height: 18px;
    width: 18px;
    border-radius: 50%;
    margin-top: -6px;
}

input[type="range"]::-moz-range-track {
    background: #e2e8f0;
    height: 6px;
    border-radius: 3px;
}

input[type="range"]::-moz-range-thumb {
    background: #2563eb;
    height: 18px;
    width: 18px;
    border-radius: 50%;
    border: none;
}

/* Text Options Modal Enhancements */
.color-input-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-input-group input[type="color"] {
    width: 50px;
    height: 40px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    padding: 2px;
}

.color-input-group input[type="text"] {
    flex: 1;
    padding: 10px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    text-transform: uppercase;
}

.color-input-group input[type="text"]:focus {
    outline: none;
    border-color: #2563eb;
}

.font-size-control {
    display: flex;
    align-items: center;
    gap: 15px;
}

.font-size-control input[type="range"] {
    flex: 1;
}

.font-size-control span {
    min-width: 50px;
    text-align: center;
    font-weight: 600;
    color: #475569;
}

.checkbox-group {
    display: inline-flex;
    align-items: center;
    margin-right: 20px;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    margin-right: 8px;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.text-preview {
    background: #f8fafc;
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    padding: 20px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1.5;
    color: #334155;
    word-wrap: break-word;
    transition: all 0.3s ease;
}

.text-preview:hover {
    border-color: #94a3b8;
    background: #f1f5f9;
}

/* Enhanced Modal Form Groups */
.modal-content .form-group {
    margin-bottom: 20px;
}

.modal-content .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #374151;
}

.modal-content select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    transition: border-color 0.3s ease;
}

.modal-content select:focus {
    outline: none;
    border-color: #2563eb;
}

.modal-content textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.modal-content textarea:focus {
    outline: none;
    border-color: #2563eb;
}

/* Compact Text Options Modal Layout */
.form-group-row {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.form-group.half {
    flex: 1;
    margin-bottom: 0;
}

.style-controls {
    display: flex;
    gap: 20px;
    align-items: center;
    justify-content: flex-start;
}

.style-controls .checkbox-group {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

/* Compact textarea */
.modal-content textarea {
    min-height: 40px;
    max-height: 80px;
    resize: vertical;
    padding: 8px 12px;
    line-height: 1.4;
}

/* Compact color input group */
.color-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-input-group input[type="color"] {
    width: 40px;
    height: 36px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    padding: 2px;
}

.color-input-group input[type="text"] {
    flex: 1;
    padding: 8px 10px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    text-transform: uppercase;
}

.color-input-group input[type="text"]:focus {
    outline: none;
    border-color: #2563eb;
}

/* Compact form groups */
.form-group-row .form-group.half label {
    margin-bottom: 6px;
    font-size: 14px;
}

.form-group-row .form-group.half select {
    padding: 8px 10px;
    font-size: 14px;
}

/* PDF Element Selection and Resize Styles */
.pdf-element {
    position: absolute;
    cursor: move;
    user-select: none;
    transition: box-shadow 0.2s ease;
}

.pdf-element.selected {
    z-index: 100;
}

.pdf-element.text,
.pdf-element.date {
    padding: 4px 8px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    white-space: nowrap;
    min-width: 20px;
    min-height: 16px;
}

.pdf-element.text.selected,
.pdf-element.date.selected {
    border-color: #2563eb;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 2px #2563eb;
}

.pdf-element.signature {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
}

.pdf-element.signature.selected {
    border-color: #2563eb;
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 0 2px #2563eb;
}

.resize-handle {
    position: absolute;
    bottom: -4px;
    right: -4px;
    width: 12px;
    height: 12px;
    background: #2563eb;
    border: 2px solid white;
    border-radius: 50%;
    cursor: nwse-resize;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 101;
}

.pdf-element.selected .resize-handle {
    opacity: 1;
}

.resize-handle:hover {
    background: #1d4ed8;
    transform: scale(1.2);
}

/* Delete Button for PDF Elements */
.delete-button {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 24px;
    height: 24px;
    background: white;
    border: 2px solid #ef4444;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 102;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.8);
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.delete-button::before,
.delete-button::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 2px;
    background: #ef4444;
    top: 50%;
    left: 50%;
    transform-origin: center;
}

.delete-button::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.delete-button::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.pdf-element.selected .delete-button {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.delete-button:hover {
    background: #fef2f2;
    border-color: #dc2626;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
    transform: scale(1.1);
}

.delete-button:hover::before,
.delete-button:hover::after {
    background: #dc2626;
}

/* Touch-friendly delete button */
@media (pointer: coarse) {
    .delete-button {
        width: 32px;
        height: 32px;
        top: -16px;
        right: -16px;
    }
    
    .delete-button::before,
    .delete-button::after {
        width: 16px;
        height: 3px;
    }
}

/* Touch-friendly resize handle */
@media (pointer: coarse) {
    .resize-handle {
        width: 20px;
        height: 20px;
        bottom: -6px;
        right: -6px;
    }
}

/* PDF Canvas and Container */
.pdf-canvas {
    display: block;
    max-width: 100%;
    height: auto;
}

.pdf-page {
    position: relative;
    display: inline-block;
    margin: 0 auto 20px;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.pdf-page:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Pagination Controls */
.pagination-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 20px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    margin-top: 20px;
    border-radius: 0 0 8px 8px;
}

.pagination-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    color: #374151;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pagination-btn:hover:not(:disabled) {
    background: #f9fafb;
    border-color: #9ca3af;
    color: #2563eb;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f9fafb;
}

.pagination-btn:active:not(:disabled) {
    transform: translateY(1px);
}

.page-input-container {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #6b7280;
}

.page-input {
    width: 60px;
    padding: 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
    text-align: center;
    background: white;
    transition: border-color 0.2s ease;
}

.page-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.page-separator {
    font-weight: 500;
}

.total-pages {
    font-weight: 600;
    color: #374151;
}

/* How to Sign PDF Section */
.how-to-sign-pdf {
    padding: 40px 0;
    background: #ffffff;
}

.how-to-sign-pdf .section-title {
    margin-bottom: 50px;
}

.steps-grid {
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
}

.step-card {
    flex: 1 1 220px;
    max-width: 320px;
    text-align: center;
}

.step-number {
    width: 56px;
    height: 56px;
    border-radius: 9999px;
    margin: 0 auto 16px;
    background: #2563eb;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 24px;
}

.step-card h3 {
    font-size: 20px;
    margin-bottom: 10px;
    color: #1e293b;
}

.step-card p {
    font-size: 15px;
    color: #64748b;
    line-height: 1.6;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sign-pdf-section {
        padding: 20px 0;
    }
    
    .upload-box {
        padding: 40px 20px;
        margin: 0 10px;
        width: 650px;
    }
    
    .upload-box h2 {
        font-size: 24px;
    }
    
    .upload-box p {
        font-size: 16px;
    }
    
    .pdf-toolbar {
        padding: 10px;
        gap: 5px;
    }
    
    .toolbar-btn {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .toolbar-btn span {
        display: none;
    }
    
    .pdf-editor {
        padding: 10px;
    }
    
    .modal-content {
        padding: 20px;
        margin: 20px;
    }
    
    .signature-canvas-container canvas {
        height: 150px;
    }
    
    .pagination-controls {
        padding: 15px;
        gap: 12px;
    }
    
    .pagination-btn {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    .page-input {
        width: 50px;
        font-size: 13px;
    }
    
    .page-input-container {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .upload-box {
        padding: 30px 15px;
        width: 350px;
    }
    
    .upload-box h2 {
        font-size: 20px;
    }
    
    .pdf-toolbar {
        justify-content: center;
    }
    
    .toolbar-spacer {
        display: none;
    }
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .form-group-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .form-group.half {
        flex: none;
    }
    
    .style-controls {
        gap: 15px;
    }
}
