/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

header p {
    color: #7f8c8d;
}

h2 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

/* Upload section */
.upload-section {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .upload-section {
        flex-direction: column;
    }
}

.pdf-upload, .signature-upload {
    flex: 1;
    background-color: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.upload-box {
    border: 2px dashed #3498db;
    border-radius: 5px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 1rem;
}

.upload-box:hover {
    background-color: #f0f7ff;
}

.upload-box i {
    font-size: 2rem;
    color: #3498db;
    margin-bottom: 1rem;
}

.btn {
    display: inline-block;
    background-color: #3498db;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    text-align: center;
    margin-top: 1rem;
    border: none;
    font-size: 0.9rem;
}

.btn:hover {
    background-color: #2980b9;
}

.btn:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

.file-name {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-top: 0.5rem;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

.signature-preview {
    margin-top: 1rem;
    text-align: center;
    max-height: 100px;
    overflow: hidden;
}

.signature-preview img {
    max-height: 100px;
    max-width: 100%;
}

/* Document workspace */
.document-workspace {
    background-color: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
    display: none;
}

.instructions {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-bottom: 1rem;
}

.controls {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.pdf-controls, .signature-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.control-btn {
    background-color: #ecf0f1;
    color: #2c3e50;
}

.control-btn:hover {
    background-color: #bdc3c7;
}

#pageInfo {
    font-size: 0.9rem;
}

.canvas-container {
    position: relative;
    border: 1px solid #e0e0e0;
    overflow: hidden;
    background-color: #f5f5f5;
    min-height: 500px;
}

#pdfCanvas {
    display: block;
    margin: 0 auto;
}

.signature-element {
    position: absolute;
    cursor: move;
    border: 2px dashed transparent;
    display: none;
}

.signature-element:hover {
    border-color: #3498db;
}

.signature-element img {
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.resize-handle {
    width: 10px;
    height: 10px;
    background-color: #3498db;
    position: absolute;
    border-radius: 50%;
}

.top-left {
    top: -5px;
    left: -5px;
    cursor: nwse-resize;
}

.top-right {
    top: -5px;
    right: -5px;
    cursor: nesw-resize;
}

.bottom-left {
    bottom: -5px;
    left: -5px;
    cursor: nesw-resize;
}

.bottom-right {
    bottom: -5px;
    right: -5px;
    cursor: nwse-resize;
}

/* Action buttons */
.action-buttons {
    text-align: center;
    margin-bottom: 2rem;
}

.primary-btn {
    background-color: #2ecc71;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

.primary-btn:hover {
    background-color: #27ae60;
}

/* Loading indicator */
.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 2rem 0;
}

.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-left-color: #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Error message */
.error-message {
    background-color: #f8d7da;
    color: #721c24;
    padding: 1rem;
    border-radius: 4px;
    margin: 1rem 0;
    text-align: center;
}

.hidden {
    display: none;
}

.drag-over {
    background-color: #f0f7ff;
    border-color: #2980b9;
}
