.hidden {
    display: none !important;
}

svg {
    fill: none;
}

body {
    overflow-x: hidden;
}

body.download-active {
    height: calc(100vh - 81px);
    overflow-y: visible;
}

body.signature-active {
    overflow-y: hidden;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.loading-screen.active {
    opacity: 1;
    pointer-events: all;
}

.loading-bar-container {
    width: 300px;
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.loading-bar {
    position: absolute;
    height: 100%;
    background: #ff6154;
    border-radius: 2px;
    width: 40%;
    will-change: transform;
    animation: loading 1.2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes loading {
    0% {
        transform: translateX(-100%);
    }
    50% {
        transform: translateX(200%);
    }
    100% {
        transform: translateX(500%);
    }
}

.loading-text {
    font-size: 15px;
    color: #666;
    font-weight: 500;
}

.container {
    background-color: transparent;
    box-sizing: border-box;
    padding: 20px;
    border-radius: 16px;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto 10px auto;
    overflow: visible;
}

/* Upload Area */
.upload-area {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 12px;
    flex-wrap: wrap;
}

.file-input-label {
    display: inline-block;
    padding: 16px 48px;
    background-color: #ff6154;
    color: white;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    text-align: center;
    flex-shrink: 0;
}

.file-input-label:hover {
    background: #e5554a;
    box-shadow: 0 4px 12px rgba(255, 97, 84, 0.4);
    transform: translateY(-1px);
}

.file-input-label.drag-over {
    background-color: #e5554a;
    transform: scale(1.05);
}

input[type="file"] {
    display: none;
}

/* Signature Panel - Split View Layout */
.signature-panel {
    margin-top: 0;
    background: transparent;
    border: none;
    padding: 0;
    box-shadow: none;
    position: fixed;
    top: 81px;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: calc(100vh - 81px);
}

.signature-content {
    display: flex;
    gap: 0;
    align-items: stretch;
    height: 100%;
    width: 100%;
    overflow: hidden;
    position: relative;
}

/* Left side - PDF Preview */
.pdf-preview-section {
    flex: 1;
    background: #f8f9fa;
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
    margin-right: 360px;
    height: 100%;
    box-sizing: border-box;
}

.preview-header {
    margin-bottom: 32px;
    width: 100%;
    max-width: 700px;
    text-align: left;
}

.preview-header h2 {
    margin: 0 0 8px 0;
    font-size: 1.75rem;
    color: #1f2937;
    font-weight: 700;
}

.preview-subtitle {
    margin: 0;
    font-size: 1rem;
    color: #6b7280;
    font-weight: 400;
}

.preview-canvas-container {
    width: 100%;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
    margin-bottom: 20px;
    max-width: 700px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.pdf-page-wrapper {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    overflow: visible;
    position: relative;
    cursor: crosshair;
}

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

.page-number-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    pointer-events: none;
}

/* Signature Elements on PDF */
.signature-element {
    position: absolute;
    border: 2px dashed #ff6154;
    cursor: move;
    background: rgba(255, 97, 84, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.signature-element:hover {
    border-color: #e5554a;
    background: rgba(255, 97, 84, 0.15);
}

.signature-element.selected {
    border: 2px solid #ff6154;
    background: rgba(255, 97, 84, 0.2);
}

.signature-element img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

.signature-element .resize-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #ff6154;
    border: 2px solid white;
    border-radius: 50%;
    cursor: nwse-resize;
}

.signature-element .resize-handle.bottom-right {
    bottom: -6px;
    right: -6px;
}

.signature-element .delete-handle {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 24px;
    height: 24px;
    background: #ef4444;
    border: 2px solid white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.signature-element:hover .delete-handle {
    opacity: 1;
}

.signature-element .delete-handle svg {
    width: 12px;
    height: 12px;
    stroke: white;
    stroke-width: 2.5;
}

/* MINIMAL Right side - Tools Panel */
.tools-panel {
    position: fixed;
    right: 0;
    top: 81px;
    width: 360px;
    box-sizing: border-box;
    padding: 0;
    height: calc(100vh - 81px);
    background: #ffffff;
    border-left: 1px solid #e5e7eb;
    overflow-y: auto;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

/* Signature Groups Section */
.signature-groups-section {
    flex: 1;
    overflow-y: auto;
    padding: 24px 20px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.add-signature-btn {
    background: transparent;
    border: none;
    color: #ff6154;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.add-signature-btn:hover {
    background: #fff5f4;
}

/* Accordion Groups */
.signature-group {
    margin-bottom: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    background: white;
}

.group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    cursor: pointer;
    transition: background 0.2s ease;
    user-select: none;
}

.group-header:hover {
    background: #f9fafb;
}

.group-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.group-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.group-count {
    font-size: 0.8rem;
    color: #9ca3af;
}

.group-toggle {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.group-toggle svg {
    width: 16px;
    height: 16px;
    stroke: #6b7280;
    stroke-width: 2;
}

.signature-group.expanded .group-toggle {
    transform: rotate(180deg);
}

.group-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding: 0 12px;
}

.signature-group.expanded .group-content {
    max-height: 500px;
    padding: 0 12px 12px 12px;
}

.signatures-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.signature-item {
    background: #fafafa;
    border: 1.5px solid #e5e7eb;
    border-radius: 6px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    aspect-ratio: 2/1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.signature-item:hover {
    border-color: #ff6154;
    background: #fff5f4;
    transform: translateY(-1px);
}

.signature-item.selected {
    border-color: #ff6154;
    background: #fff5f4;
    box-shadow: 0 0 0 2px rgba(255, 97, 84, 0.15);
}

.signature-item img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.signature-item .delete-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    background: #ef4444;
    border: 1.5px solid white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s ease;
}

.signature-item:hover .delete-btn {
    opacity: 1;
}

.signature-item .delete-btn:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.signature-item .delete-btn svg {
    width: 10px;
    height: 10px;
    stroke: white;
    stroke-width: 2.8;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #9ca3af;
}

.empty-state-text {
    font-size: 0.9rem;
    margin-bottom: 20px;
    color: #6b7280;
}

.empty-state-btn {
    padding: 12px 24px;
    background: #ff6154;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.empty-state-btn:hover {
    background: #e5554a;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 97, 84, 0.25);
}

/* Finish Button */
.finish-section {
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
    background: white;
}

.btn-finish {
    width: 100%;
    padding: 14px 28px;
    background: #10b981;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-finish:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.btn-finish svg {
    width: 18px;
    height: 18px;
    stroke: white;
    stroke-width: 2.5;
}

/* MODAL for Creating Signatures */
.signature-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 20px;
    box-sizing: border-box;
}

.signature-modal.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 520px;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
    display: flex;
    flex-direction: column;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 24px 28px 20px 28px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.modal-close {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background 0.2s ease;
    color: #6b7280;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.modal-close:hover {
    background: #f3f4f6;
}

.modal-body {
    padding: 28px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
}

.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 10px;
    border: 2px solid white;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Modal Tabs */
.modal-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 28px;
    flex-shrink: 0;
}

.modal-tab {
    padding: 12px;
    background: #f9fafb;
    border: 1.5px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: #6b7280;
    transition: all 0.2s ease;
    text-align: center;
    white-space: nowrap;
}

.modal-tab:hover {
    background: #f3f4f6;
    color: #374151;
}

.modal-tab.active {
    background: #fff5f4;
    border-color: #ff6154;
    color: #ff6154;
}

.modal-tab-content {
    display: none;
    overflow-x: hidden;
}

.modal-tab-content.active {
    display: block;
}

/* Draw Content */
.canvas-wrapper {
    position: relative;
    width: 100%;
    margin-bottom: 20px;
    overflow: hidden;
}

#signature-canvas {
    width: 100%;
    height: 180px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: crosshair;
    background: #fafafa;
    display: block;
    max-width: 100%;
}

.canvas-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #9ca3af;
    font-size: 0.85rem;
    font-weight: 500;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.3s ease;
}

#signature-canvas.has-drawing + .canvas-placeholder {
    opacity: 0;
}

.canvas-actions {
    display: flex;
    gap: 10px;
}

/* Type Content */
.input-group {
    margin-bottom: 20px;
}

.input-label {
    display: block;
    font-size: 0.85rem;
    color: #6b7280;
    font-weight: 600;
    margin-bottom: 8px;
}

.text-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s ease;
    background: white;
    box-sizing: border-box;
}

.text-input:focus {
    outline: none;
    border-color: #ff6154;
    box-shadow: 0 0 0 3px rgba(255, 97, 84, 0.1);
}

.signature-preview {
    margin-top: 16px;
    padding: 32px 20px;
    background: #fafafa;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    word-wrap: break-word;
}

.signature-preview #preview-text {
    font-family: 'Allura', cursive;
    font-size: 2.4rem;
    color: #1f2937;
    text-align: center;
    max-width: 100%;
    overflow-wrap: break-word;
}

.signature-preview #preview-text.empty {
    font-family: inherit;
    font-size: 0.85rem;
    color: #9ca3af;
}

.font-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}

.font-option {
    padding: 16px 10px;
    background: #f9fafb;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
}

.font-option:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.font-option.active {
    background: #fff5f4;
    border-color: #ff6154;
}

.font-option span {
    font-size: 1.4rem;
    color: #1f2937;
    display: block;
    overflow: hidden;
}

/* Upload Content */
.upload-area-modal {
    width: 100%;
    margin-bottom: 20px;
}

.upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 24px;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fafafa;
}

.upload-label:hover {
    border-color: #ff6154;
    background: #fff5f4;
}

.upload-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: #374151;
}

.upload-subtext {
    font-size: 0.8rem;
    color: #9ca3af;
}

.uploaded-preview {
    width: 100%;
    padding: 20px;
    background: #fafafa;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    box-sizing: border-box;
}

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

/* Modal Buttons */
.btn-primary {
    width: 100%;
    padding: 12px 24px;
    background: #ff6154;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.btn-primary:hover {
    background: #e5554a;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 97, 84, 0.25);
}

.btn-secondary {
    width: 100%;
    padding: 10px 20px;
    background: white;
    color: #6b7280;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.btn-secondary:hover {
    background: #f9fafb;
    border-color: #9ca3af;
    color: #374151;
}

.modal-actions {
    display: flex;
    gap: 10px;
}

.group-input-section {
    margin-bottom: 20px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

/* Download Screen */
.download-screen {
    display: none;
    padding: 0;
    max-width: 100%;
    margin: 0;
    min-height: calc(100vh - 81px);
    background: #f8f9fa;
}

.download-screen.active {
    display: block;
}

.download-content {
    display: flex;
    width: 100%;
    min-height: calc(100vh - 81px);
}

.download-actions-section {
    position: fixed;
    right: 0;
    top: 81px;
    width: 450px;
    height: calc(100vh - 81px);
    background: white;
    border-left: 2px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    padding: 40px 32px;
    overflow-y: auto;
    box-sizing: border-box;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.06);
}

.back-button {
    background: transparent;
    color: #6b7280;
    border: none;
    padding: 12px 20px;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    font-weight: 500;
    position: absolute;
    margin-top: -10px;
    left: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.back-button:hover {
    background: none;
    color: #ff6154;
    box-shadow: none;
    transform: translateX(-2px);
}

.back-button svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

#download-file-info {
    margin-top: 50px;
    margin-bottom: 24px;
}

.single-file-card {
    background: #f8f9fa;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.single-file-icon {
    width: 48px;
    height: 48px;
    background: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.single-file-icon svg {
    width: 28px;
    height: 28px;
    stroke: #ff6154;
    fill: none;
}

.single-file-details {
    flex: 1;
    text-align: left;
    min-width: 0;
}

.single-file-name {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.single-file-info {
    font-size: 0.875rem;
    color: #6b7280;
}

.done-button {
    background: #10b981;
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.done-button svg {
    width: 16px;
    height: 16px;
    stroke: white;
    fill: none;
}

.download-button-wrapper {
    margin-bottom: 16px;
}

.download-primary {
    width: 100%;
    padding: 16px 32px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background-color: #ff6154;
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.download-primary:hover {
    background: #e5554a;
    box-shadow: 0 6px 16px rgba(255, 97, 84, 0.4);
    transform: translateY(-2px);
}

.download-primary svg {
    width: 20px;
    height: 20px;
    stroke: white;
    fill: none;
}

.action-buttons-grid {
    display: flex;
    gap: 10px;
    justify-content: flex-start;
    margin-top: -6px;
    margin-bottom: 10px;
}

.action-button {
    background: #f7f8f9;
    border: none;
    color: #374151;
    padding: 12px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    flex: 1;
}

#share-action {
    flex: 2;
}

#print-action,
#delete-action {
    flex: 1;
}

.action-button:hover {
    background: #fff5f4;
}

.action-button svg {
    width: 24px;
    height: 24px;
    stroke: #6b7280;
}

.action-button:hover svg {
    stroke: #ff6154;
}

.extract-another-btn {
    width: 100%;
    padding: 14px 32px;
    background: transparent;
    color: #ff6154;
    border: 2px solid #ff6154;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.extract-another-btn:hover {
    background: #fff5f4;
    box-shadow: 0 4px 12px rgba(255, 97, 84, 0.2);
}

/* Hide elements when showing download screen */
.content-hidden {
    display: none !important;
}

.tools-panel::-webkit-scrollbar,
.pdf-preview-section::-webkit-scrollbar,
.download-actions-section::-webkit-scrollbar {
    width: 6px;
}

.tools-panel::-webkit-scrollbar-track,
.pdf-preview-section::-webkit-scrollbar-track,
.download-actions-section::-webkit-scrollbar-track {
    background: #f3f4f6;
}

.tools-panel::-webkit-scrollbar-thumb,
.pdf-preview-section::-webkit-scrollbar-thumb,
.download-actions-section::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 10px;
}

.tools-panel::-webkit-scrollbar-thumb:hover,
.pdf-preview-section::-webkit-scrollbar-thumb:hover,
.download-actions-section::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Responsive */
@media (max-width: 1200px) {
    .tools-panel {
        width: 340px;
    }
    
    .pdf-preview-section {
        margin-right: 340px;
    }
    
    .download-actions-section {
        width: 380px;
    }
}

@media (max-width: 968px) {
    body.signature-active {
        overflow-y: auto;
    }

    .signature-panel {
        position: relative;
        height: auto;
        min-height: calc(100vh - 81px);
    }

    .signature-content {
        flex-direction: column;
        height: auto;
    }

    .tools-panel {
        position: relative;
        width: 100%;
        height: auto;
        top: 0;
        border-left: none;
        border-top: 2px solid #e5e7eb;
        box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.06);
        order: 1;
    }

    .pdf-preview-section {
        margin-right: 0;
        height: auto;
        order: 2;
        padding: 32px 24px;
        overflow-y: visible;
    }

    .download-screen {
        position: relative;
        height: auto;
        min-height: calc(100vh - 81px);
    }

    .download-content {
        flex-direction: column;
        height: auto;
        min-height: calc(100vh - 81px);
    }

    .download-actions-section {
        position: relative;
        width: 100%;
        height: auto;
        border-left: none;
        border-top: 2px solid #e5e7eb;
        box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.06);
    }

    .pdf-preview-section {
        padding: 100px 20px 20px 20px;
        height: auto;
        min-height: 50vh;
    }

    .back-button {
        top: 20px;
        left: 20px;
    }
    
    .modal-content {
        width: 95%;
        max-height: 90vh;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 16px;
    }
    
    .pdf-preview-section {
        padding: 80px 16px 24px 16px;
    }
    
    .preview-header {
        margin-bottom: 24px;
    }
    
    .preview-header h2 {
        font-size: 1.5rem;
    }
    
    .preview-subtitle {
        font-size: 0.9rem;
    }

    .download-actions-section {
        padding: 24px 16px;
    }

    .back-button {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
    
    .signatures-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-tabs,
    .font-options {
        grid-template-columns: 1fr;
    }
}