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

body {
    font-family: 'Segoe UI', Tahoma, Arial, Helvetica, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 10px;
    color: #333;
    direction: rtl;
}

.container {
    max-width: 500px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

header {
    background: #4a5568;
    color: white;
    text-align: center;
    padding: 20px;
}

header h1 {
    font-size: 1.8rem;
    margin-bottom: 5px;
}

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

.canvas-container {
    padding: 20px;
    background: #f8f9fa;
}

#signatureCanvas {
    width: 100%;
    height: 250px;
    border: 2px dashed #cbd5e0;
    border-radius: 10px;
    background: white;
    cursor: crosshair;
    touch-action: none;
    display: block;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.controls {
    padding: 20px;
    display: flex;
    gap: 15px;
    justify-content: center;
}

.btn {
    flex: 1;
    max-width: 150px;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: #4299e1;
    color: white;
}

.btn-primary:hover {
    background: #3182ce;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover {
    background: #cbd5e0;
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

.instructions {
    padding: 20px;
    background: #edf2f7;
    border-top: 1px solid #e2e8f0;
}

.instructions p {
    font-size: 0.9rem;
    margin-bottom: 8px;
    color: #4a5568;
}

.instructions p:last-child {
    margin-bottom: 0;
}

.footer {
    padding: 15px 20px;
    background: #2d3748;
    color: white;
    text-align: center;
    font-size: 0.85rem;
    opacity: 0.9;
}

.footer p {
    margin: 0;
    font-weight: 500;
}

/* Mobile optimizations */
@media (max-width: 480px) {
    body {
        padding: 5px;
    }
    
    .container {
        border-radius: 10px;
    }
    
    header {
        padding: 15px;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    .canvas-container {
        padding: 15px;
    }
    
    #signatureCanvas {
        height: 200px;
    }
    
    .controls {
        padding: 15px;
        gap: 10px;
    }
    
    .btn {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
    
    .instructions {
        padding: 15px;
    }
    
    .instructions p {
        font-size: 0.8rem;
    }
}

/* Prevent scrolling when drawing */
body.drawing {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* Additional mobile touch optimizations */
* {
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.canvas-container {
    -webkit-overflow-scrolling: touch;
}

/* Loading state */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}
