* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.steps-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.step {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.step.active {
    box-shadow: 0 15px 50px rgba(0,0,0,0.2);
}

.step-header {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px 25px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
}

.step-number {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1rem;
}

.step-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
}

.step-content {
    padding: 25px;
}

.upload-area {
    border: 3px dashed #ddd;
    border-radius: 12px;
    padding: 50px 20px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.upload-area.dragover {
    border-color: #667eea;
    background: #eef1ff;
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 15px;
}

.upload-area p {
    color: #666;
    margin-bottom: 20px;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    background: #e8f5e9;
    border-radius: 8px;
    margin-top: 15px;
}

.file-name {
    font-weight: 600;
    color: #2e7d32;
}

.page-count {
    color: #666;
    font-size: 0.9rem;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #43a047 0%, #2e7d32 100%);
    color: white;
}

.btn-success:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(67, 160, 71, 0.4);
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9rem;
    background: #eee;
    color: #333;
}

.btn-small:hover {
    background: #ddd;
}

.btn-large {
    padding: 16px 40px;
    font-size: 1.1rem;
}

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

.signature-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    color: #333;
}

.form-group input[type="text"] {
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1.1rem;
    transition: border-color 0.3s ease;
}

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

.form-row {
    display: flex;
    gap: 20px;
}

.form-row .form-group {
    flex: 1;
}

input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
}

input[type="color"] {
    width: 60px;
    height: 40px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.signature-preview {
    margin-top: 25px;
    padding-top: 25px;
    border-top: 1px solid #eee;
}

.signature-preview h4 {
    margin-bottom: 15px;
    color: #333;
}

.preview-box {
    background: #fff;
    border: 2px solid #eee;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.pdf-viewer-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.page-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

#pageIndicator {
    font-weight: 600;
    color: #333;
}

.pdf-canvas-wrapper {
    position: relative;
    background: #f0f0f0;
    border-radius: 8px;
    overflow: hidden;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pdf-preview {
    max-width: 100%;
    max-height: 600px;
    display: block;
    cursor: crosshair;
}

.loading {
    position: absolute;
    color: #666;
    font-size: 1.1rem;
}

.signature-overlay {
    position: absolute;
    cursor: move;
    border: 2px dashed #667eea;
    padding: 5px;
    background: rgba(255,255,255,0.8);
    border-radius: 4px;
}

.signature-overlay img {
    display: block;
    max-width: 100%;
    pointer-events: none;
}

.resize-handle {
    position: absolute;
    right: -8px;
    bottom: -8px;
    width: 16px;
    height: 16px;
    background: #667eea;
    border-radius: 50%;
    cursor: se-resize;
}

.hint {
    text-align: center;
    color: #666;
    font-size: 0.9rem;
    font-style: italic;
}

.download-section {
    text-align: center;
    padding: 20px 0;
}

.download-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    color: #666;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #ddd;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

@media (max-width: 600px) {
    header h1 {
        font-size: 1.8rem;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .step-content {
        padding: 15px;
    }
}
